text stringlengths 8 6.12M |
|---|
%% The entry function to get all features
%% set hyper params
blockSize = 4096;
hopSize = 2048;
fs = 44100;
%% prepare trainning data
train_audio_path = './trainSet/audio/*.wav';
train_annotation_path = './trainSet/annotation/Fender Strat Clean Neck SC.csv';
[train_data, train_GT] = getTrainData(train_audio_path, train... |
function [betv,lcv,A]=MIMC(clv,tol)
% MIMC computes the vector of minimum increase in players marginal contribution when they leave the grand coalition.
%
% Source: Multi-Player Allocations in the Presence of Diminishing Marginal Contributions:
% Cooperative Game Analysis and Applications in Management Science... |
%文件名:cellauto.m
%程序员:李巍
%编写时间:2003.10.7
%函数功能:这是一个细胞自动机及相应的vote和smooth函数
%输入格式举例:[chaoticrand,chaoticcell,watermark]=cellauto(72,72,52,20)
%参数说明:
%row,col为要求得到的水印模板大小
%seed为随机数种子
%do_num为细胞自动机处理次数
function [chaoticrand,chaoticcell,watermark]=cellauto(row,col,seed,do_num)
%生成随机模板
rand('seed',seed);
chaoticrand=rand(row,... |
function [SL,f] = wavSL(fname,cues,nfft,len)
%
% [SL,f] = wavSL(fname,cues,nfft,len)
%
if nargin<2 | isempty(cues),
cues = [0 Inf] ;
end
if nargin<3,
nfft = 1024 ;
end
if nargin<4,
len = 10 ;
end
cue = cues(1) ;
endcue = cues(2) ;
nov = nfft/2 ;
% get the sampling frequency
[sz fs] = wavread16(fname... |
function [] = simFuture(NET, level, MATRIX, lastday, LOAD)
disp("Simulating Future");
% One year is 8760 data points
% Last day in known data is 8/14/2019 at 12:00pm
% We Need to add
%
% 8760 + (17 x 24) + (30 x 24) + (31 x 24) + (30 x 24) + (31 x 24) =
% = 12096
%% Retrieve Last Weeks Data
for ... |
%converts an input image to normed rgb
function new_image = rgb2normedrgb(image)
[r,g,b] = getColorChannels(image);
sumAll = r+g+b;
r = r./sumAll;
g = g./sumAll;
b = b./sumAll;
new_image = cat(3, r, b, b);
end |
function [found,search,percentIonMatch,Top10]=spectracmp(SpectraA, SpectraC, MS2tol,MS2tolUnit)
%SPECTRACMP: Compare SpectraA (experimental) with SpectraC (theoretical) to
% see which peaks match with an error tolerance of 'MS2tol'.
%
% Syntax:
% [found,search,percentIonMatch,Top10]=SPECTRACMP(SpectraA, SpectraC, ... |
%% Find complexes of a simple exemplary model.
% We consider a simple AR model, X(t+1) = AX(t)+E(t), with six elements
% (N=6). The connectivity matrix A is symmetric and consists of two
% modules, one consisting of two elements, 1 and 2, and the second
% consisting of four elements, 3-6. The intra-connection strength... |
%% This is the main function for assessing given video segments
% Read given video segments
video = VideoReader('./testVideoSegs/twoSeg2.avi');
%video = VideoReader('./testVideoSegs/testSeg1.avi');
%video = VideoReader('./testVideoSegs/testSeg2.avi');
% Convert video to cell array
source = {};
count = 1;
% put every f... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012 Analog Devices, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http:/... |
function y = stab_fun(x, a)
y = zeros(size(x));
for i=1:numel(x)
y(i) = f(x(i), a(i)) - x(i);
end
end |
function mechFourier
w = 4;
K = 5;
couplingK = 2.5
tRange = linspace(0, 1/w*200, 1000);
numMasses = 20;
damp = .1;
masses = linspace(0, 1, numMasses);
init = zeros(1, numMasses*2);
M = makeM(masses, damp);
f = figure;
ax = axes('Parent',f,'position',[0.13 0.39 0.77 0.54]);
sW = uicontrol('Parent',f,'Style','slider'... |
function writeKnossosConf( savePath, expName, boundary, scale, ...
magnification, classT, cubesize, prefix)
%writeKnossosConf( savePath, expName, boundary, scale, magnification, cubesize )
% Write KNOSSOS configuration file
% Author: Manuel Berning <manuel.berning@brain.mpg.de>
% Modified by Benedikt Staffler <be... |
classdef RRTNode < handle
%UNTITLED2 此处显示有关此类的摘要
% 显示详细说明
properties
kdInTree;
rrtParentUsed ;
inOSQueue;
isMoveGoal ;
inPriorityQueue;
priorityQueueIndex;
rrtTreeCost ;
rrtLMC ;
position;
... |
% a while based implementation of the requested function
function p = Pi1(n)
current = 0;
estimate = 0;
while current <= n
estimate = estimate + the_sum(current);
current = current + 1;
end
p = vpa(single(estimate * 4));
end
% the sum component for each n
function s = the_sum(n)
s1 = sum_element(n, 1);
s2 =... |
%% Creates GIF animations of BVP solver iterations
clc, clear, close all
M = 20; N = 21; L = 5;
directory = 'BVP_data';
filePattern = fullfile(pwd, [directory,'/*','.mat']);
list = dir (filePattern );
[~,index] = sortrows({list.name}.');
list = list(index);
%% Grid
h = figure;
filename = 'grid.gif';... |
function oe = IJKtoOrbitalElements(state, GM)
oe = zeros(6, 1);
% Position and Velocity
rECI = state(1:3);
vECI = state(4:6);
% Specific Angular Momentum
h = cross(rECI, vECI);
W = h./norm(h);
% Inclination
i = atan2(norm(W(1:2)), W(3));
% Right Ascension of the Ascending Node
Omega = atan2(W(1),-W(2));
if Omega <... |
function [gaboutPQ2,gaboutt] = tiqu(gaboutP,gaboutQ,n)
%%%%%%%%%%%%%%%%%%%%本函数提取小波系数图中的椎间盘圆环%%%%%%%%%%%%%%%%%%%%%%%
% Usage:
% [gaboutPQ2] = tiqu(gaboutP,gaboutQ,n)
% input parameter:
% gaboutP —— 小波系数图前景
% gaboutQ —— 小波系数图前景
% n —— 大小椎间盘(大1,小2)
% output parameter:
% gaboutPQ2 ... |
function [dx, dy] = lk_pyramidal_track(raw_img1, raw_img2, X, Y, win_rad, accuracy_threshold, max_iterations)
max_levels = get_max_pyramid_level(raw_img1, 128);
num_points = size(X,1);
% Get images for each pyramid levels
img1_pyramidized = generate_pyramid(raw_img1, max_levels);
img2_pyramidiz... |
%%% Combines the valid parameter values acquired in the script
%%% Parameter_Sweep_Transmission_Coeffs
%%% When saving the combined variables use same rho value as considered in
%%% the original Parameter_Sweep_Transmission_Coeffs script
load('var0year')
var1 = var;
load('var03rdyear')
var2 = var;
load('var... |
%Guillermo Santiago Novoa P?rez 000125089
%
%diary resumen ;
%diary on;
% Este es un script que ayuda a correr el programa (funci?n) mad_max. Dadas las
% especificaciones del mismo, se corre 5 veces mad_max, las primeras 3
% con gradiente aleatorio y n?meros de condici?n 10^1, 10^2, y 10^3
% respectivamente y... |
function h = subplot_ex(total_no, current_no)
m = floor(sqrt(total_no));
n = ceil(sqrt(total_no));
if m*n < total_no, n=n+1; end
h = subplot_tight(m, n, current_no, 0.1, 0.1); |
function theta = dihedralAngle(plane1, plane2)
%DIHEDRALANGLE Compute dihedral angle between 2 planes.
%
% THETA = dihedralAngle(PLANE1, PLANE2)
% PLANE1 and PLANE2 are plane representations given in the following
% format:
% [x0 y0 z0 dx1 dy1 dz1 dx2 dy2 dz2]
% THETA is the angle between the two vectors give... |
% sp50.m
%% How do the planets move
close all
clear all
clc
a = [5.79e10 1.08e11 1.496e11 2.28e11 7.78e11 1.43e12 2.86e12 4.52e12 5.90e12];
T = [7.60e6 1.94e7 3.156e7 5.94e7 3.74e8 9.35e8 2.64e9 5.22e9 7.82e9];
G = 6.67e-11; MS = 1.95e30;
K = 4*pi^2/(G*MS);
aF = linspace(0,6e12,500);
TF = sqrt(... |
%Rundora
clc
clear all
[player1,Fs1]=audioread('1.wav');
[player2,Fs2]=audioread('2.wav');
[player3,Fs3]=audioread('3.wav');
[player4,Fs4]=audioread('4.wav');
prevState=0;
curState=0;
PACE_THRESH_HIGH = 12;
PACE_MED=10;
HEART_THRESH = 105;
%%
% Save the serial port name in comPort variable.
%gauss;
%comPort = '/d... |
file_list = dir();
k = 1;
Errors = []; % mean squared errors for each image would be stored here
X = [];
for i = 3:length(dir) % running through the folder
file_name = file_list(i).name; % get current filename
% Read image, convert to double precision and map to [0,1] interv... |
x = 1;
for i = 1:length(saltdata)
if saltdata(i).r2point8 == 1
Dsalt(x) = saltdata(i).slope/2;
saltsalt(x) = saltdata(i).salt;
x = x+1;
else
end
end
%%
hold on
x = DnoATP(saltnoATP ==70);
% x = Dsalt(saltsalt ==70);
mean(x)
histogram(x,30)
hold on
pd = fitdist(x', 'Lognormal');
x_... |
function [lon,lat,sst] = f_readcwf(filename)
% - import a Coastwatch Satellite SST file
%
% USAGE: [lon,lat,sst] = f_readcwf('filename');
%
% -----Input/Output:-----
% filename = input file created by cwftoasc program
%
% lon, lat, sst = longitude, latitude, sea surface temp
%
% -----Notes:-----
% This function impor... |
initialize_folder_names;
close all;
filename=strcat(DATA_FOLDER,'physics_constants.mat');
load(filename);
filename=strcat(DATA_FOLDER,'pressure_profile.mat');
load(filename);
filename=strcat(DATA_FOLDER,'flux_geometry.mat');
load(filename);
filename=strcat('../METIS_profiles.mat');
load(filename);
filename=strcat(DATA... |
data=AMC037_ECOGS001R09.data;
info=AMC037_ECOGS001R09.info;
sent_window_word_tens=[];
wlist_window_word_tens=[];
sent_window_probe_tens=[];
wlist_window_probe_tens=[];
for j=1:length(data);
stim_data=data{j,1}.signal_gaus_band_hilb_dec_zs_parsed_win;
new_combined=cell(size(new_stim,1),1);
for i=1:size(s... |
clc; close all; clear;
load('k_means_data.mat');
curr_centroids1 = init_centroids_1;
curr_centroids2 = init_centroids_2;
for i = 1:5
[idx,C] = kmeans(X,3,'MaxIter',1,...
'Start',curr_centroids1);
figure;
subplot(2,1,1)
grid on;
xlim([0 20]);
ylim([0 10]);
set(gca,'XTick',0:1:20);... |
fileRoot = pwd;
folderName = 'wavFiles';
demo = 0;
%% stimulus parameters
ramp = 0.02; % AB: gating with 20-ms raised-cosine ramps
fc = 500;
fs = 100e3; % CHANGE AS NEEDED
dur = 0.5;
dur_gap = 0.5;
t = 0:1/fs:dur_gap-1/fs;
gap = zeros(2, numel(t));
% NOTE: ITD here is only for one of two stimulus segments in the "jump... |
rng(123);
%Case 1:
dimx=1024;
dimy=1024;
indata = rand(dimx, dimy);
indata = tom_bandpass(indata, 0, 128);
%indata(1:end/2, 1:end/2) = 1;
%indata(end/2+1:end, end/2+1:end) = 1;
% indata(1:4:end,:) = 1;
% indata(:,1:4:end) = 1;
fid = fopen('Input_Warp2D.bin','W');
fwrite(fid,indata,'single');
fclose(fid); |
% RMS-nICA
clear; close all;
set(0,'DefaultFigureVisible','on');
% set(0,'DefaultFigureVisible','off');
addpath('../matlab_lib');
addpath('../matlab_lib/nICA');
%% Setting
file_loc_prepend = './data/raw_';
file_extension = '.txt';
filename_prepend = 'S2WA_21_';
tdsep_file_list = {'FLX_1', 'EXT_1', 'PRO_1', 'SUP_1'}... |
% Initial condition for test case 6. uc contains the velocity in Cartesian
% coordinates with uc(:,1:3) the x,y,z direction, respectively. gh contains
% the geopotential height field from the mean geopotential gh0.
function [uc,gh,us] = tc6_computeInitialCondition(atm)
% Extract out the constants from the atm ... |
%%% This function is suitable for denoising noisy images.
% StepSize=1/7 is more stable for image denoising purpose.
%sigma0 is the variance of u_g in lines 32 and 64.
%Compare the results at high noise level with NLM method.
function [ue] = Edge-Preserving_Denoising(NoisyIm,sigma0,sigma1,NumIter,StepSize)
Input... |
function param_value = get_parameter(target_instance,param_name)
% GET_PARAMETER - 'parameters' slot accessor. If a valid parameter
% name is provided, return its value.
%
% Usage: param_value = get_parameter(target_instance,<param_name>)
%
if nargin < 2
% Default method accesses all parameters
param_value =... |
function [ tout, E ] = RiccatiDiff( A,B,C, D, beta, gamma, T,Nt)
%Computation of the solution to the Riccati Differential Equation
%for the control problem:
%min J(u)=\frac{1}{2}[\int_0^T|u(t)|^2dt+\int_0^T|Cx(t)|^2dt].
%x_t+Ax=Bu, t\in (0,T)
%x(0)=x_0.
%In particular, the Riccati Differential Equation
%for such pr... |
function [ ] = computeFiber(lambdaStart, lambdaEnd, lambdaStep, geometryTypeShort, numberOfLayers, coreDiameter, claddingDiameter, doping, latticeConstant, holeDiameter, saveFiles, displayStep)
%computeFiber Computes neff, neff_imag, Aeff, n2eff for given fiber
% Detailed explanation goes here
import com.comsol.mode... |
function ret = computeInnerFstd( innerState )
%COMPUTEINNERFSTD Compute standard deviation of function values in inner
%states
n_innerState = numel(innerState);
fstd = nan(1, n_innerState);
for i = 1 : n_innerState
if ~isempty(innerState{i})
fstd(i) = std(innerState{i}.f);
end
end
fstd(isnan(fstd)) = [];
ret = m... |
clf;clc;clear;
x=0:pi/9999:10;
y=sin(x)+sin(4*x);
z=cos(x)+sin(3*x);
% plot(x,y,'r','DisplayName','y=sinx+sin(4x)',...
% x,z,'b','DisplayName','cosx+sin(3x)');
plot(x,y,'r','DisplayName','y=sinx+sin(4x)');
hold on
plot(x,z,'b','DisplayName','cosx+sin(3x)');
hold off
legend;
|
%% Simulation of an airplane trajectory, placing of sensors, TOA measurements
global folder0 folder1 folder2 folder3 folder4 folder5;
folder0 = fullfile('Figures','MLAT-Literature Algorithms','Trajectory and Sensors');
folder1 = fullfile('Figures','MLAT-Literature Algorithms','Std Dev Output Error - noises');
fol... |
%Works Local
i=1;
%v = 2.84e-4; %0,1SLM
v=0.0048; %1,7SLM
Points2 = -10;
while max(Points2)<0.06
SeedIds(i) = 0;
IntegratedTime(i) = 0.1*i-0.1;
Points0(i) = 0;
Points1(i) = 0;
Points2(i) = -0.06+v*IntegratedTime(i);
i = i+1;
end
IntegrationTime = IntegratedTime';
Points0 = Points0';
Points1 = Po... |
clear paramsAll;
clear params;
params.Gridjob.runLocal = false;
params.Gridjob.requiremf = 4000;
params.Gridjob.jobname = 'GenerateClustConnmat';
params.Gridjob.initRandStreamWithJobid = false;
params.Gridjob.continue = false;
params.Gridjob.requiredThreads = '1';
params.Gridjob.queue = 'nbp.q';
params.GenerateClustC... |
% Compute the essential matrix using the eight point algorithm
% Input
% x1s, x2s Point correspondences 3xn matrices
%
% Output
% Eh Essential matrix with the det F = 0 constraint and the constraint that the first two singular values are equal
% E Initial essential matrix obtained from the eight point a... |
function exit_map_plot_fcn(src,~,hplot)
% set(src, 'Pointer', 'hand');
% ax=ancestor(hplot(1),'axes');
% % obj=findobj(ax,'Tag','tooltip');
% % delete(obj);
% objt=findobj(ax,'Tag','tooltipt');
% delete(objt);
end |
close all
writerObj = VideoWriter('reconnection_movie.avi');
writerObj.FrameRate=6
open(writerObj);
fig=figure;
set(fig, 'position', [150 150 w h]);
for (f=1:101)
time_step=(f-1)
if (time_step<100)
frame_name='0';
else
frame_name='';
end
if (time_step<10)
frame_... |
function stats=collect_stats_per_drop(stats, SNR_asoc,SNR,PLs_asoc,...
Prx_asoc,Cap_tot,num_iter,SINR_tot_lin,~, Tput_tot, Rate_oh_tot, SINR_lin_eff_tot, Rate_rec_oh_tot, updates_overiters)
stat_cap=(1/num_iter)*sum(Cap_tot,2); %vector of UE capacity avaeraged over all iterations for a given drop
... |
function [input,theta,x,y]= Maximize_Intensity_In_Pits(Input,TRC,TLC,BRC,BLC)
%MAXIMIZE_INTENSITY_IN_PITS: Translates and rotates the frame relative to
%previously localized pits to collect total max intensity in the pits.
% Uses masks to get the intensity in the pits and maximizes it. Doesn't
% change the dimensio... |
function [c] = squared_dist_shapes( pt, shapes_array, epsilon )
%SQUARED_DIST_SHAPES Summary of this function goes here
% Detailed explanation goes here
[~, d, ~] = shapes_point_check( pt, shapes_array );
if (d < 0)
c = -d + 0.5*epsilon;
elseif (d < epsilon)
c = (1/(2*epsilon))*(d - epsilon)^2;
else
c = ... |
function M = matriz_masas( datos )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
%% Definición de constantes
% Cuerpo 1 = tierra
% Disco 1 (cuerpo 2)(masa concentrada en el centro i):
m2=datos.mA1;
r2=0.275/2; % radio disco
L2=datos.LA1; % disancia 02A (longitud entre los punto... |
function B = computeBmatrix(alpha, beta, gamma, delta)
theta_z = -(delta+beta)/2;
theta_y = -gamma/2;
R_z = [exp(-i*theta_z/2) 0; 0 exp(i*theta_z/2)];
R_y = [cos(theta_y/2) -sin(theta_y/2); sin(theta_y/2) cos(theta_y/2)];
B = R_y*R_z;
endfunction |
function D = dim1d(frac) # calculates the dimension of the frac with the box count method
n = floor(log3(columns(frac)))
for i=1:n
r = pow3(i - 1) # amount of squares
draw(frac, r);
squares = countSquares(frac, r)
xs(i) = log(r);
ys(i) = log(squares);
endfor
mmq = (xs'\ys');
D = mmq(1);
en... |
for i = 1:4
display(i)
end |
function compareCameras(folder, method)
%Compare the recovered camera parameters to the ground truth
%Load ground truth values (assumes every K has an RT next)
fid = fopen([folder 'cameras.txt.gt'], 'r');
K0 = {};
RT0 = {};
R0 = {};
while(~feof(fid))
line = fgetl(fid);
tmp = split(line);
if(tmp{2} ==... |
function q = quadrants(n)
a = ones(n);
b = ones(n)*2;
c = ones(n)*3;
d = ones(n)*4;
q = [a, b; c, d];
end
|
clc
clear
close all
ts = 0.001;
%% module
% x_{k+1} = A x_k + K e_k
% y_k = C x_k + e_k
% cov(e_k) = R
innum = 2;
outnum = 1;
statenum = 2;
A = [-0.85 -0.35;
0.35 -0.85];
C = [0 1];
q = [0.01 0.1;0.1 1];
r = 0.1; % cov(e_k)
%% noise
n = 100; % input_length
eo = randn(n, 1); % white noise
e = eo*chol(r); % ch... |
%clear; close all; clc;
compare = true;
half_window_size = 0;
start_offset = 1;
end_offset = 50;
line_width = 1;
figure_size = [0.3, 0.3, 0.3, 0.35];
figure_borders = [0.05 0.08 0.93 0.84];
display_title = true;
display_silhouette = false;
num_iters = 6;
data_path = 'E:/Data/MATLAB/figure_16_compare_sequences/';
... |
function Q = IK(P,m,robot)
l0 = robot.links(1,1); l1 = robot.links(2,1); l2 = robot.links(3,1);
l3 = robot.links(4,1); l4 = robot.links(5,1); l5 = robot.links(6,1); l6 = robot.links(7,1);
if ~robot.orientation
l4 = l4 + l5 + l6;
l5 = 0; l6 = 0;
end
T = Tx(P(1))*Ty(P(2))*Tz(P(3))*... |
function [array] = extend(vector,int)
%UNTITLED Summary of this function goes here
%
%
% Copyright Julian Lopez-Uricoechea & Kenny Breuer, Brown University 2019
%
array = zeros(3,int);
for i=1:+1:int
array(1,i) = vector(1,1);
array(2,i) = vector(1,2);
array(3,i) = vector(1,3);
end
|
classdef TestDatetime < TestCase
methods
function this = TestDatetime()
this.name = 'TestDatetime';
end
function exec_(this)
dt1 = datetime(2013, 12, 1, 0, 0, 0, 'TimeZone', 'Europe/Berlin');
dt2 = datetime(2013, 12, 2, 0, 0, 0, 'TimeZone', 'Europe/Berlin');
dt3 = plus(dt... |
function input = loadinVar()
% Problem Definition
input.sim.problemtype = 'shocktube';
input.sim.ICtype = 'fromIC';
input.sim.BCtypeL = 'outflow';
input.sim.BCtypeR = 'outflow';
input.sim.BCmode = 'dirichlet';
input.sim.fluxfunc = 'Roe';
input.sim.realpl... |
function [ finalImage ] = createMHI( images , cropBounds )
imageSize = size(images{1});
finalImage = zeros(imageSize(1),imageSize(2));
n = size(images);
colour = 1/n(2);
c = n(2);
start = round(c/4);
half = round(c/2);
finish = round(start + (c/2));
third = rou... |
gaussianKernel([1 2 3], [2 4 6], 3)
% result
% ans = 0.45943
x1plot = linspace(-2, 2, 10)';
x2plot = linspace(-2, 2, 10)';
[X1, X2] = meshgrid(x1plot, x2plot);
X = [X1(:) X2(:)];
Xval = X + 0.3;
y = double(sum(exp(X),2) > 3);
yval = double(sum(exp(Xval),2) > 3);
%[C sigma] = dataset3Params(X, y, Xval, yval... |
function [C,U] = pald_triplet_block(D,b)
if D' ~= D
error('distance matrix must be symmetric');
end
n = size(D,1);
U = triu(2*ones(n),1); % init each conflict focus size to include 2 points
C = zeros(n);
% consider all unique triplet blocks to compute conflict focus sizes
for x = 1:b:n
Xb = x:min(x+b-1,n... |
function sim_parameters
%%initialize_eq_sim_parameters_struct Initializes the parameters (namely
%%time)
% Initializes time and savenames
global par
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Folder/file names
par.paths=initialize_folder_names_struct;
% Save names:
% Raw - if fail... |
function [bin2_8] = zf_Decimalism_Binary(value)
% 函数说明:将十进制预测值转换成8位二进制数组(补码),
% 输入:value(十进制预测值)
% 输出:bin2_8(8位二进制数组)
% 具体操作:最低位是符号位,其余七位是数值位(七位最大127);负数符号位为1,正数符号位为0
if value>0
bin2_8 = dec2bin(value)-'0';
if length(bin2_8) < 8
len = length(bin2_8);
B = bin2_8;
bin2_8 = zeros(1,8); %正... |
close all; clear all;
M = 100;
T = 10;
N = 1000;
x = zeros(N+1, M);
t = zeros(N+1, 1);
x(1,:) = 10;
dt = T/N;
a = 0.7;
b = 0.17;
for i=2:N+1
t(i) = t(i-1) + dt;
x(i,:) = x(i-1,:) + a*dt + b*sqrt(dt)*randn(1,M);
end
plot(t,x); |
function dxdt=odefcn(t,x)
dxdt=[x(2);-4*x(2)-3*x(1)+abs(sin(t))];
end |
%Javier Salazar 1001144647 9/29/18
%Monte Carlo Integration Techniques (Method 2)
%-----------parameters-----------------------
clc
clear all
iterations = 1000;
domain = [0, 2*pi];
func = @(x) (1-cos(x))./x;
plotOption = "Yes";
relativeTolerence = 1e-12;
rng('shuffle');
probabilitySeed = rng(564, 'twister');... |
function s = H_J(grid, J_Cell_Cell, J_Cell_Medium, x, y)
[nx, ny] = meshgrid(x-1:x+1, y-1:y+1);
n = [nx(:) ny(:)];
n(n(:,1) <= 0 | n(:,1) >= size(grid,1)+1 | n(:,2) <= 0 | n(:,2) >= size(grid,2)+1,:) = [];
n(grid(sub2ind(size(grid),n(:,1),n(:,2)) < 0),:) = [];
x = n(:,1); y = n(:,2);
s = 0;
for i = 1:length... |
function [ru,zu,rv,zv] = plotSurfaceDetail(surface)
[ru,zu,rv,zv] = surfaceCrossSection(surface);
% plot(R(rays1.valid),Z1(rays1.valid),R(rays2.valid),Z2(rays2.valid));
plot(ru,zu,rv,zv);
axis equal;
|
function out = f_simple(x, t,p,u,b)
out = x.*sin(x) +2*u(1)^2 -0.2*sqrt(u(2));
end |
%% second_level_AUE
% Runs paired t-test and/or displays results
function paired_t_AUE(subj, study, dd, pair, create, plot)
%% check inputs
if length(subj) < 2
error('Submit ALL subjects!')
end
if ~isstruct(subj) || ~isstruct(study)
error('subj and study are both struct!')
end
if ~isnumeric(dd)
error('d... |
% just testing, a short cut for running the model
epoch = 5000;
record = trainAgent(epoch);
save('record','record');
checkDevelop()
|
function [FfA, AtA, fs, dcell]= ...
single_step_single_cell(F1, Params, kernel, kerns,NT, npad, dcell)
znpad = zeros(npad,1);
F1copy = cat(1, znpad, F1, znpad);
Nbasis = size(kerns,2);
F1copy = double(F1copy);
[c, st] = deconvL0(Params, F1copy, kernel);
imax = find(c==0, 1);
c = c(1:ima... |
function [day, mouse] = get_metadata(z, list)
% This function gets the day and mouse number of the folder that is
% currently being processed. Based on our default naming convention:
% XXX_d_40_m_05_s02, where d = day, m = mouse no, s = set, XXX may be any
% information.
str_index = findstr(lower(list(z).name)... |
function AfficherVehicule(coins, color)
%Affiche les coins et les arêtes du véhicule
if (~exist('color', 'var'))
color = 'b';
end
hold on;
plot(coins(1,1),coins(1,2), strcat(color, '.'));
plot(coins(2,1),coins(2,2), strcat(color, '.'));
plot(coins(3,1),coins(3,2), strcat(color,... |
% dj.internal.AutoPopulate is an abstract UserRelation class that
% automatically populate its table.
%
% Derived classes must define the callback function makeTuples(self, key),
% which computes new tuples for the given key and inserts them into the table as
% self.insert(tuple).
%
% The constant property 'keySource' ... |
function [val] = splitWhite(sin)
sin = strtrim(sin);
val = regexp(sin,'\s','split');
numSet = cellfun(@(x)isempty(regexpi(x,'[a-df-z]','once')),val);
for si = find(numSet)
val{si} = str2num(val{si});
end
end |
function ilQ=ImpSetEqsLwsQ(clv)
% IMPSETEQSQ checks if the lower set and the imputation set are equal.
%
% Usage: ilQ=ImpSetEqsLwsQ(v)
%
%
% Define variables:
% output:
% ilQ -- Returns true (1) if the lower set and the imputation set coincide,
% otherwise false (0).
% input:
% clv -- TuGam... |
function resp = putLabel3d(dvid, dataName, pos, data)
% check data
if ~isa(data, 'uint64')
error('Grayscale data must be of type uint8');
end
% convert to byte sequence
resp = dvid.putData3d(dataName, pos, data);
end |
clear;clc;
fid = fopen('input.txt');
%% read
result = 0;
i = 0;
commands = "";
while 1
tline = fgetl(fid);
if ~ischar(tline)
break;
end
i = i + 1;
commands(i,1) = tline;
end
%%
sum = 0;
for i=1:length(commands)
result = solveGeneral(char(commands(i)));
sum = sum + str2num(r... |
function [sdx, sdy, Icent, Rsquare] = fit2DgaussianFixedCenter4(image_data,Ibg_avg, Isp, x_centre, y_centre,myfit,options,p)
subarray_halfwidth=p.subarray_halfwidth;
guess_sigma_Fit=p.guess_sigma_Fit;
show_output=p.show_all_output;
sigmaFit_max=p.sigmaFit_max;
sigmaFit_min=p.sigmaFit_min;
if show_output... |
function [] = createScript(model_name)
%CREATESCRIPT Summary of this function goes here
% Detailed explanation goes here
model_name = sprintf('%s.m', model_name);
fid = fopen(model_name, 'wt');
fprintf(fid, '%% %s \n', model_name);
fprintf(fid, '%s \n', '% The purpose of this script is to ... ');
fprintf(fid... |
function mask = computeMask(img_cell)
mask = img_cell{1} | img_cell{2} | img_cell{3} | img_cell{4} | img_cell{5};
end
|
clear all
load("Random_instances.mat")
%% initialization/definition
n_size=100;
ran_size=20;
rho=0:0.0025:0.1;
X_I=cell(ran_size,1,n_size);
X_O=cell(ran_size,1,n_size);
Wors_I=zeros(ran_size,size(rho,2),n_size);
Wors_N=zeros(ran_size,size(rho,2),n_size);
Wors_N_inv=zeros(ran_size,size(rho,2),n_size);
Wors_O=zeros(ran_s... |
function v = MatlabMPI_ver
%MATLAB_MPI Returns the MatlabMPI version as a string
v = '1.2br2';
|
function update_plots_nn_ps
global hnds
global r nn asz G ps dsm
global hpb ht hi
ax1=hnds.axes1;
ax2=hnds.axes2;
cla(ax1);
cla(ax2);
nn=str2num(get(hnds.nn,'string')); % number of cities
ps=str2num(get(hnds.ps,'string')); % population size
r=asz*rand(2,nn); % randomly distribute cities
% r(1,:) -x... |
%% Compute Residuals and State Estimation Errors
%%
% This example shows how to estimate the states of a discrete-time Van der
% Pol oscillator and compute state
% estimation errors and residuals for validating the estimation.
% The residuals are the output estimation errors, that is, they are the
% difference between... |
%........................................... TAMPER DETECTION ...............................%
%......... Reading Video into vid Object .........%
obj = VideoReader('dataset/2.mp4');
image = read(obj, 1);
binarization_threshold = 10;
nFrames = obj.NumberOfFrames;
nFrames
rate = obj.FrameRate;
rate
figur... |
classdef MDP < handle
% This is a class for a Markov Decision Process
properties
num_states
num_actions
actions
rewards
gamma = 1
Value
time_steps
end
methods
function obj = MDP(num_states, num_actions, actions, reward... |
function [ b ] = select( F4 )
%this part select one picture from 60 which contains the most information for further research
a=zeros(1,60);
for i = 1:60
sum=mean(F4.images{1,i});
for j = 1:105
for k = 1:120
if F4.images{1,i}(j,k)> sum+2.4;
a(i)=a(i)+1; %record the summit value
... |
function output_folder = XuGenHEorLEConfigs(s_config_fbp,...
s_config_preprocessing,...
s_config_ring_correction,...
s_config_bone_correction, input_config_folder, s_energy_bin)
% generate config for te,le or he images from te config
% major task is to change '\te' or '_te' to the specfic energy bin string
... |
function [net,TSE, VSE, deltaB, deltaW, trainingDerivB, trainingDerivW] = resilientBackPropagation(net,trainingSetInput, trainingSetLabels, validationSetInput, validationSetLabels, errorFunction, errorFunctionDx, etaMinus, etaPlus, epoch, derivativeWPrec, derivativeBPrec, deltaWPrec, deltaBPrec,softmax, printFlag)
% F... |
% Lab1
% Regularization
% Question 2-3
load data3.mat
[B,FitInfo] = lasso(X,Y);
lassoPlot(B,FitInfo,'PlotType','Lambda','XScale','log');
[B_LS,FitInfo_LS] = lasso(X,Y, 'Lambda', 0);
hold on
y = B_LS*ones(size(FitInfo.Lambda));
plot(FitInfo.Lambda, y)
legend('B_1', 'B_2', 'B_3', 'B_1(LS)', 'B_2(LS)',... |
function [P,V,A]=cal_P2(C,V1,V2,t)
%[P,V,A]=cal_P(C,V1,V2,t)
L=0.254;
NC=length(C);
RC=[C(:,1)-V1*L,C(:,1),C(:,1)+V1*L,C(:,2:NC-1),C(:,NC)-V2*L,C(:,NC),C(:,NC)+V2*L];
N=length(RC);
if(t>=N-3)
I=N-4;
t=1;
else
I=fix(t);
t=mod(t,1);
end
f1=(1-t).^3/6;
f2=(3*t.^3-6*t.^2+4)/6;
f3=(-3*t.^3+3*t.^2+3*t+1)/6;
f... |
% Read no. of buses and machines
prompt = 'No. of buses:';
nbs = input(prompt);
prompt = 'No. of machines:';
nms = input(prompt);
% Read bus_dat
fileID = fopen('test_bus.txt','r');
formatSpec = '%d %d %f %f %f %f %f %f';
bus_dat = fscanf(fileID,formatSpec);
bus_dat =reshape(bus_dat,8,nbs); %each column cont... |
% function fit_kulfan(N1, N2, degu, degl)
%
% Fit an airfoil to kulfan parameterization
% Airfoil coordinates must be put in file airfoil.txt in two columns
% Coordinates must start from TE, go over lower curve, then upper curve and
% back to TE.
%
% N1, N2 are powers for LE/TE definition : (psi)^N1 * (1-psi)^N2
% degl... |
for struc = unique([targets step2OARs step3OARs])
%Find relevant voxel indices
if length(targets)>=2 && struc == targets(2)
% subtract PTV1
mask3M = getUniformStr(struc) & ~getUniformStr(targets(1));
%downsample if necessary.
if sampleRates(struc) > 1
mask3M = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.