text
stringlengths
8
6.12M
function [ positions,pnl,action ] = backtest( p,spread,beta,lambda ) %BACKTEST Summary of this function goes here % Detailed explanation goes here positions=zeros(length(p),2);%持仓 pnl=zeros(length(p),1);%每日损益 action=zeros(length(p),2);%买卖操作 action=action*NaN; upperlimit=mean(spread)+std(spread,1)*lambda;%上界 lowerlimi...
function [xf, Pf, xp, Pp] = nonLinearKalmanFilter(Y, x_0, P_0, f, Q, h, R, type) %NONLINEARKALMANFILTER Filters measurement sequence Y using a % non-linear Kalman filter. % %Input: % Y [m x N] Measurement sequence for times 1,...,N % x_0 [n x 1] Prior mean for time 0 % P_0 [n x n] Prio...
function sbmlv23_edited = sbmlv23_modifications(sbmlv23_unedited, list) sbmlv23_edited = sbmlv23_unedited; sbmlv23_edited.mets = correct_metsNaming(sbmlv23_edited.mets); %first modfications done to sbmlv22 sbmlv23_edited = sbmlv22_modifications(sbmlv23_unedited); %***************************...
%% s_barWidthTest % % This is just a test scritp. Nothing special. % % (HJ) April, 2014 %% Init wave = 400:10:700; sceneSz = 1200; fov = 1; vDist = 1; pupilDiameterMm = 3; %% Create scenes param.sceneSz = sceneSz; param.offset = 0; param.barWidth = 1; param.barReflect = 1; param.bgReflect = 0.1; scene = sceneCreat...
function flag = isOutOfBound(row, col, imageSize) flag = not(floor(row) >= 1 & ceil(row) <= imageSize(1) & floor(col) >=1 & ceil(col) <= imageSize(2)); end
function KPart = lin_kernelDiffX(X, theta, q); % KERNELDIFFX Compute the gradient of the kernel with respect to X. % Since the result is all zeros apart from one row/column combination, % and the result is symetric, here we return a matrix whose rows are the % vectors which give the row/column combinations theta =...
% Ruben Hinojosa Torres, Jianai Zhao, CSCI 1320 %========================================================================== load('raw.mat'); raw = Raw; clear Raw [r1,~,~] = size(raw); %Greatest number of tweets in state. %max task3(Filename,Row where the data starts (tweets), Column where the %states are) [~...
classdef Filter < dagnn.Layer properties pad = [0 0 0 0] stride = [1 1] dilate = [1 1] end methods function set.pad(obj, pad) if numel(pad) == 1 obj.pad = [pad pad pad pad] ; elseif numel(pad) == 2 obj.pad = pad([1 1 2 2]) ; else obj.pad = pad ; end ...
%%%%%% maybe the last banben %%%%%%%%%%%%%% add the points from area 1,and then merge the samll areas. %%%%%%%%%%%rhok > number(SS{i}) %%%%%%%%%%%%%cross-entropy clear all close all clc disp('The only input needed is a distance matrix file') disp('The format of this file should be: ') disp('Column 1: id of element i...
function hw4_bin_img_reconstruction clc; disp('HW4'); load('projectionData') n = size(sumR,2); % 20 m = 2*n-1; I = zeros(n,n); countOfIterations = 7; countOfPairs = 6; for i = 1:countOfIterations for p = 1:countOfPairs % CR if p == 1 p1 = sumC; p2 = sumR; ...
function shank = electrodeFactory(name) % This builds the probe files that we use to handle channel maps and % filtering corrections % if no argument is passed in, use the gui to choose from a list of options if nargin == 0 shankList = {'Shank2', ... 'AcuteZif2Om32', ... 'MTSingleElectrode'...
function kmh = ms2kmh(ms) %ms2kmh - Convierte un valor en m/s en km/h % % kmh = ms2kmh(ms) kmh = ms * 3.6; end
img = imread('01.jpg'); img2 = zeros(size(img, 1), size(img, 2), 3, 'uint8'); for i = 1: size(img, 2) for j = 1: size(img, 1) x = cosd(45)*(i - 200) + sind(45)*(j - 150) + 200; y = -sind(45)*(i - 200) + cosd(45)*(j - 150) + 150; if(x >= 1 && x <= size(img, 2) && y >= 1 && y <...
function newS=optimizeS(option,admmrho,Gamma,Z) [U,Sig,V]=svd(Z+Gamma./admmrho); [row,col]=size(Sig); temp = zeros(size(Sig,1),size(Sig,2)); for i=1:row for j=1:col temp(i,j)=max(Sig(i,j)-option.mu/admmrho,0); end end newS = U*temp*V'; end
function h=ncreadandcat(files,vars) % h=ncreadandjoin(files,vars) % in % files cell array, names of files to read % vars cell array, names of variables to read % % out % h h.vars{i} contains the variable, concatenated along the last dimension for i=1:length(files) [f,dims]=nc...
%HVMAKESTRUCT - issue 1.1 (27/01/10) - HVLab HRV Toolbox %------------------------------------------------------- %[newtruct] = HVMAKESTRUCT(title, yunit, xunit, dtype, dxvar, stats, xvals) % Creates a new empty workspace data structure array with fields in the % required order % % newtruct = new workspace d...
function a = kridgereg( K, y, gamma ) %kridgereg %Input %K - kernel (gaussina kernel in this case) %y - y set %gamma - ridge regression parameter %Output %a - dual weight vector a=(K + gamma.*length(K).*eye(length(K)))\y; end
function noMargin(axHandle) % NOMARGIN % % Description: % Expand the axes to fill figure window % % Syntax: % noMargin(axHandle); % % Input: % axHandle axes handle (default = gca) % % History: % 3Mar2018 - SSP % ------------------------------------------------------------------ if nargin == 0 axHan...
function plotAverage(x,y,grps,cols) % Unique groups [unq,~,ind] = unique(grps); numG = numel(unq); h = zeros(numG,1); % Correct for numeric grps if isnumeric(unq) nunq = cell(size(unq)); for n = 1:numG nunq{n,1} = num2str(unq(n)); end unq = nunq; end % Create new figure figure('Position',[200...
%------------------------------------------------------------- % plik wczytujący wagi kryteriów %------------------------------------------------------------- % Hubert Gawryś 2014-03-16 % Instytut Zarządzania w Budownictwie i Transporcie (L-3) % Wydział Inżynierii Lądowej % Politechnika Krakowska im. Tadeusza K...
function Spikes = Spike_Detector(dF,std_threshold,static_threshold) %dF function is the first derivative where %dF(ROI_index,Time,Multiple_Videos) Spikes = zeros(size(dF,1),size(dF,2)); dev = std_threshold*std(std(dF)); avghx = mean(mean(dF)); for j = 1:size(dF,1) for k = 1:size(dF,2) droploc=...
%%%%%%%%%%%%%%%%%%%%%%%%%% % Driver function for catching simulation % Micah Corah %%%%%%%%%%%%%%%%%%%%%%%%%% close all clear all disp('Beginning simulation'); rng('shuffle','twister'); t=clock; step=0.0016; %Sampling space block_dir=rand(1)*pi; %block_dir=2.0548; block_u=[0;0.5;0.09]; block_nu=[rot([0;0;1],block_dir)...
% evaluation - FBPConvNet % modified from MatconvNet (ver.23) % 22 June 2017 % contact : Kyong Jin (kyonghwan.jin@gmail.com) clear restoredefaultpath reset(gpuDevice(1)) run ./matconvnet-1.0-beta23/matlab/vl_setupnn load preproc_x20_ellipse_fullfbp.mat load('./pretrain/net-epoch-151.mat') % cmode='gpu'; % 'cpu' cmod...
function [p sc] = plotPRC_phases(conStren,Sphasez,PSphasez,NcS_sel,cmap) p(1) = plot(conStren,Sphasez ); p(1).Color = [0 0 0]; p(1).LineWidth = 2; p(1).LineStyle = '-'; hold on sc(1) = scatter(conStren(NcS_sel),Sphasez(NcS_sel),75,cmap(NcS_sel,:),'filled'); sc(1).Marker = '^'; p(2) = plot(conStren,PSphasez ); p(2).Co...
function dq = ODE_boundary_problem(x,q,theta,area_ann,dia_bit,dx,g,mu_mud,Cl) % for source terms % 2 - drillstring % 1 - annulus source_ann = source_terms(q,theta,area_ann,dia_bit,dx,g,mu_mud,1); dq = [source_ann/Cl^2; 0]; end
function y = stdsourcefile(x) if x == 1 y = [196, 42, 220, 253, 131, 226]; end end
function package = ... sharcnet_testingLoopPackage(dataset, patientList_training, patientList_full, ... exerciseList, ind_exercise, param, exerciseCropLength, specialCommand, specialPackage) if iscell(patientList_full) % the testing array may be passed in as a cell array. if that's % th...
function [T1,T2] = SWAP(Ta,Tb) LA = size(Ta,1); LB = size(Tb,1); if LB < LA T1 = Tb; T2 = Ta; else T1 = Ta; T2 = Tb; end end
function dispstr=dispplane(valstr) if (numel(valstr)<6)||(~strcmp(valstr([2,5,6]),''''',')) dispstr=['best fit plane through atom group ''',valstr(2:end-1),'''']; elseif strcmp(valstr(3),'3') dispabbr=struct('a','atoms','r','Cartesian coordinates','c','direct coordinates'); temp=regexp(valstr,'[{}\[\],]','spl...
function CLwing = VLMImplementation(Mach,Alt,span,Sweep,rootChord,fuseDia,taperRatio) % clear all % close all % clc % % % taperRatio = 0.373; % rootChord = 39; % fuseDia = 27; % Alt = 30000; % Mach = 0.77; % Sweep = 25; % span = 262.5; %% Start Point %% Geo Setup geo.fnx= [0,5]; %number of panels on flap chor...
% BME313L_Lab4_P2_ShaoPoHuang % This code will 1) determine various Thiele moduli corresponding to % different efficiency values and 2) make a plot relating these two % variables clear; close all; clc; % clear existing values/console N = 0.3:0.1:0.6; % vector of N (efficiency values) Es = 0.03; % pre-specifie...
%% =========== computing the eroor rate and accuracy ============= function counter = Test(layer,number_of_sampels,Train_or_Test,L,labels,dataset,tanh_or_sigmoid) layer(1).a=dataset'; counter=0; for num_in=1:number_of_sampels for c=2:L if c==2 layer(c).z = (layer(c-1).a(:,num_in))'*(l...
function [f_cohr] = calc_fcohr(PDPMat_cut, dt) P_T = sum(PDPMat_cut); Tau = [0:1:size(PDPMat_cut,2)-1]; Tau_mean = sum(Tau .* PDPMat_cut)/P_T; Delta_T = sqrt(sum(Tau.^2 .* PDPMat_cut)/P_T - Tau_mean^2) * dt; f_cohr = 1/(2*pi*Delta_T); end
if accel_B(i,1) <= 0 traction; Fv(i,1) = Fv(i,1)*u(i,1); acc(i+1,1) = Fv(i,1)./mass; if acc(i+1,1) > max_accel acc(i+1,1) = max_accel; end elseif accel_B(i,1) > 0 braking; Bv(i,1) = Bv(i,1)*u(i,1); acc(i+1,1) = Bv(i,1)./mass; if acc(i+1,1) < max_decel ...
function time_out = time2pattern(time_in,resol) %TIME2PATTERN convert input time vector to time patter (e.g. yyyymmdd) % % Input: % time_in ... time vector (datenum) or time matrix % resol ... string switch for output precission: % 'day': yyyymmdd % 'hour': yyy...
clc; clear all; close all; a=imread('images.jpg'); b=im2bw(a,0.5); figure; imshow(b); [m, n] = size(b); w=[1,1,1; 1,1,1; 1,1,1]; reg=zeros(m,n); reg(200,150)=1; figure; imshow(reg); imgcmp=~b; figure; imshow(imgcmp); while(true) finalimg= imdilate(reg,w) & b; if(finalimg==reg) break; end ...
run('../util/import_data'); neg_sizes = [20; 35; 50; 70; 90; 110; 130; 150]; gda_far = zeros(8,1); gda_frr = zeros(8,1); svm_far = zeros(8,1); svm_frr = zeros(8,1); gtrain_far = zeros(8,1); gtrain_frr = zeros(8,1); strain_far = zeros(8,1); strain_frr = zeros(8,1); for z=1:8 NUM_NEG_TRAIN = neg_sizes(z); run('....
publish('Untitled.m','doc') winopen('html/Untitled.doc')
function load_mass_budget_rules %% load_mass_budget_rules.m global params r = global_jess_engine(); r.eval(['(bind ?mass_budget_rules_clp "' params.mass_budget_rules_clp '")']); r.eval('(batch ?mass_budget_rules_clp)'); r.eval(['(bind ?mass_budget_rules_clp "' params.adcs_design_rules_clp '")']); r.eval('(batch ?mass_...
function f = evalFunc2(grid) % grid: a 9x9 matrix representing a complete grid % initial_grid: a grid where all non zero elements are the initially fixed % digits % returns the number of digits appearing twice in the line/colum/square % of the grid. % If a digit appears three times in a same line/column/square, it wi...
function [S_k, alpha_k] = update_active_set(S_k, alpha_k, v_k, gamma_k, gamma_max, is_aw) % Active set update the weights alpha associated with the solution found at % every iterate. Depending on weather an swap step is chosen or a fw step % the update is different. For a good explanation please refer to the % follwin...
function W = fix_adc_jitter(W) V = clip_channels(W); % figure; plot(V) X = get_channel_width(V); for i = 1:NUM_CHANNELS s = W(X(i,1)-BETA:X(i,2)+BETA); width = X(i,2)-X(i,1)+1; h = floor((X(i,1) + X(i,2))/2); offset = h - STD_START - (i-1)...
function res = opdracht_1_versie_1_CHECK(apStudentSol) %%========== PLACE SOLUTION IN COMMENTS HERE % % % % % % % wrijvingsKracht= [ 12 31 31; 123 124 14; 102 182 21]; % % % % % % % wrijvingsKracht((1,3)) % % % % wrijvingsKracht= [ 12 31 31; 123 124 14; 102 182 21]; % % % % wrijvingsKracht(1,3) %%========== %% FI...
% demo_multiband_RF_pulse_design.m % Written by Namgyun Lee % Email: ggang56@gmail.com % Created: 03/01/2017, Last modified: 03/01/2017 close all; clear all; clc; %-------------------------------------------------------------------------- % Information about fremex05: % amplitude range of am_fremex05: -163 <=> 32767 ...
%% Extreme Learning Machine tutorial / improvements: change activation function clear all addpath datasets folder = 'datasets\cifar'; %~0.577 with n=1000 and 5 ensemble %% n = 10000; % number of neurons N = 10000; O_ensemble = zeros(10,n,5); w_ensemble = zeros(n,3072,5); b = -1 + (2).*rand(n,1); B = zeros(n,N); for...
function wM = oneStepMotors(Kt, R, Ke, IWheels, VM,wM,Tsample) %UNTITLED5 Summary of this function goes here % Detailed explanation goes here BEMF = Ke.*wM; T = (VM - BEMF)*Kt/R; wM = wM + T./IWheels*Tsample; end
f_s=3000; t=(1:f_s)/f_s; ff1=100; ff2=400; ff3=1000; x=sin(2*pi*ff1*t)+sin(2*pi*ff2*t)+sin(2*pi*ff3*t); figure; subplot(211);plot(t,x); subplot(212);hua_fft(x,f_s,1); % y=filter(bz1,az1,x); y=bandp(x,900,1100,800,1200,0.1,30,f_s); figure; subplot(211);plot(t,y); subplot(212);hua_fft(y,f_s,1);
function plot_sub(X,K,i) % plot_sub(X,K,i) % plot submatrix of K for element i=[i1 i2 i3] from the mesh X{1} X{2} X{3} p=hexa_sub(X,K,i); hexa_plot(p.X,p.X,p.S2);
timeperiod={{[0 100 900 1000]} {[1000 1200 2800 4000]}}; labels={'1sec'}; nomove='NO1'; immove='IM1'; ammove='AM1'; n_con_ex=6; clear dm Res_in Res_out code_louk_2_gen gzerds1=ztype; gdsR1o=Res_out; gdsR1i=Res_in; timeperiod={{[0 250 2750 3000]} {[3000 3250 5750 6000]}}; %timeperiod={{[0 250 3750 4000]} {[4000 4250 5...
function [Si_a, Sti_a] = reorder(Si, Sti) Si_a = Si; Sti_a = Sti; Si_a(1) = Si(12); Sti_a(1) = Sti(12); Si_a(2) = Si(13); Sti_a(2) = Sti(13); Si_a(3) = Si(1); Sti_a(3) = Sti(1); Si_a(4) = Si(2); Sti_a(4) = Sti(2); Si_a(5) = Si(4); Sti_a(5) = Sti(4); Si_a(6) = Si(5); Sti_a(6) = Sti(5); Si_a(7) = Si(8); Sti_a(7) ...
function qqSwap(varargin) % twoQSwap: two qubits swap % bias qubit q1 or q2, drive qubit q1 and q2, readout qubit q1 or q2, % q1, q2 all has to be the selected qubits in the current session, % % <_o_> = qqQSwap('qubit1',_o|c_,'qubit2',_o|c_,... % 'biasQubit',<_i_>,'biasAmp',[_f_],'biasDelay',<_i_>,... % 'q...
function varargout = dock(varargin) varargout={}; try if nargin>=1 switch length(varargin) case 1 if isnumeric(varargin{1}) fignum = varargin{1}; f = figure(fignum); elseif ischar(varargin{1}) figname = v...
function xsol = odesol(fun,t,x) % % [xsol = odesol(fun,t,x) % % Risolve l'ODE y'(t) = fun(t) % % INPUTS: % fun : campo vettoriale associato % t : vettore di tempi in cui vogliamo calcolare la soluzione % x : dato iniziale % % OUTPUTS: % xsol : matrice le cui colonne s...
close all ; % Data from onlyincluded prior2normal % 'D:\MaggiesFarm\2019_04_17_MF_dev_explore\data_thompson_mod12_new.xlsx' tmp = load('datathompsonmod12.mat'); data = tmp.datathompsonmod12; clear tmp; tmp = load('dataquestionnaire.mat'); data_quest = tmp.dataquestionnaire; clear tmp; %%% demo ID ...
function y= ef(l) a=0; b=2; c=1; K=((l-a)+sqrt((a^2)-2*a*l+(l^2)-4)); r=[K^2+(a-l)*(K^(-1)); c*K^(-1); 0]; M=[K^2+(a-l)*K, c, 0; c*K, b-l, c*K; 0, c, a*K+K^2]; x=r\M; R=x(1); X0=x(2); T=x(3); y=abs(R)^2+abs(T)^2; end
clear all; run Settings.m load clusters.mat %create cluster vecs u = unique(names); vec=zeros(1,length(names)); for k=1:length(u) ind=find(contains(names,u{k})); vec(ind)=k; end a=double(jet); ind=round(vec/length(u)*64); col=a(ind,:); %% c=clusters; A=zeros(size(c,2)-2); algos=size(c,1); %number of cluste...
function [avg_fft_open_1,avg_fft_open_2,avg_fft_close] = alpha_analyse(EEG, fs_new,dur) EEG = pop_resample(EEG, fs_new); EEG = pop_eegfiltnew(EEG, [],0.5,[],true); %HP filtering (Filter DC) EEG = pop_eegfiltnew(EEG, [],20); %LP filtering EEGfilt = EEG.data(1,:)'; strt = 16; stp = strt+dur; ...
function [subj] = raicar_rank (subj) % % function [subj] = raicar_rank (subj) % % Author: Zhi Yang % Version: 2.0 % Last change: June 08, 2007 % % Purpose: % search through the CRCM, idenfy the aligned components and rank them by reproducibility % Input: % subj: subject object. The following input fie...
function centroids = kmeans_mpi(data_slaves,centroids, N_slaves) K=size(centroids,1); % Master Broadcasts Centroids to slaves for i=1:N_slaves local_centroids{i} = centroids; end % Slaves run k-means on local data for i=1:N_slaves local_clusters{i} = kmeans_mpi_slave(data_slaves{i}, local_centroids{i}); end ...
clear all, close all figure('position',[2436 875 1120 600]) % subplot(211) dc = load('~/Work/MITgcm/Downloads/dispersionCurve.mat'); load('ke_end.mat') leg = cell(length(om),1); hline = []; cols = [0 1 0; 1 0 0]; desc = fileread('../description.txt'); subplot(211) pcolor(dc.L,dc.sigs,log10(dc.P0P)'); shading flat co...
choice=5; n=3; A = [1 5 3 18 ;2 4 7 10; 4 6 2 50]; B=A(1:n,1:n); % pivoting for i = 1:n-1 [maxc , m]= max(A(i:n,i)); m=m+i-1; A([i m],:)=A([m i],:); end B_real=A(:,n+1); % storing real constants B PiA=A(1:n,1:n); % Pivoted Matrix of coefficients only L=zeros(n); % set L to be a ...
%{ -> acquisition.Session cell_id: varchar(36) # a string identifying the cell in which this intracellular recording is concerning --- cell_type: enum('excitatory','inhibitory','N/A') -> reference.ActionLocation -> reference.WholeCellDevice %} classdef Cell < dj.Manual end
function [ B ] = MPS_ReduceBondDim_left_sweep_down( A, B, rhol_B_B, rhol_A_B ) %pinv is used everywhere, not optimal. [N, ~] = size(B); fprintf('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n'); fprintf('The error at position %i in sweep is %d.\n', N+1, normDifferenceBetweenStates_left(A,B)); ...
% % Script for computation of average RDFs and CNs % % Directories to consider dir_names = dir('seed_*'); dir_names = {dir_names.name}; ndirs = length(dir_names); % All data % Stresses all_s_xx = zeros(ndirs, 20); all_s_yy = zeros(ndirs, 20); all_s_zz = zeros(ndirs, 20); all_s_xy = zeros(ndirs, 20); all_s_yz = zeros(...
function [I_hyper,I_rgb,I_gt,g,G,extra,wl,wl_ori,Sel,s,bbl,H1] = ... prepare_fusion_dataset(dataset, options) %PREPARE_FUSION_DATASET Summary of this function goes here % Detailed explanation goes here if nargin < 2 options = []; end I_hyper = []; I_rgb = []; switch dataset case {'pavia_nonrigid_algo','...
function strengistreng = checkStrinstri( a,b ) n=size(a,2); m=size(b,2); strengistreng=-1; for i=1:m-n+1 if checkString(b(i:i+n-1), a) strengistreng = i; return; end end end
% test on efficient schur complement inversion %clc; clear all; close all; % B = B(:,1); A = mmread('A.mm'); B = mmread('B.mm'); P = mmread('P.mm'); % figure; spy(A) % figure; spy(P) % e = eigs(A\(A+P),50,'lm'); % figure; plot(e) % A = (triu(A,0) + tril(A.',-1)); % X = A\B; % fprintf('%2.4g s\n', toc)...
caseno = 1; switch caseno case 1 sys = tf(1,[1 2 1])*tf(1,[1 0]); kp = 0.25; ki_by_kp = 0.25; leadlag = tf([1/0.5 1],[1/2 1]); case 2 w1 = 8; w2 = 2; sys = tf(w1*w2,[1 w1 w1*w2])*tf(1,[1 0]); kp = 0.25; ki_by_kp = 0.25; leadlag = tf([1/0.25 1],[1/1 1]); end cla...
%% part 1 % part a clearvars, close all; dbstop if error; testmat=zeros(64,128); for j=1:size(testmat,2) if j<=32 testmat(:,j)=10; elseif j<75+32-10 testmat(:,j)=10+j-32; else testmat(:,j)=75; end end imagesc(testmat) colormap gray % part b, plot brightness as a function of pos...
function [new_sound_fields,new_sound_field_ids] = get_sound_features_v7(input_matrix,numfilts,post,type); new_sound_fields = []; new_sound_field_ids = {}; % sound_on = zeros(1,size(the_matrix,2)); % sound_off = zeros(1,size(the_matrix,2)); % a = find(diff(the_matrix(6,:))>0); % b = find(diff(the_matrix(6,:))<0); locati...
% Leap Motion Data Processing Script % Load raw data from text (ASCII) file %Left hand raw data Lraw = importdata('L3N',' ',1); %imports data and ignores first row (headers) % Read coordinate data (PalmX, PalmY, PalmZ) xL = Lraw.data(2000:3000,9); yL = Lraw.data(2000:3000,10); zL = Lraw.data(2000:3000,11); % D...
function [ftfj] = ft_fj(T, Td, J, Jd) %% Parameters Description % T, actual run time % Td, Expected run time % J, Jerk % Jd, The rate of acceleration that passengers can accept % ftfj, 时间惩罚与舒适度惩罚之积 %% main % clear; clc; % load J h = 0.2; cj = 1; alpha = 0.03; % T = linspace(120, 200, 100); % Td = 160; ft = 1 + ((T -...
%CALLSIMULATIONANDGRAPHOBJECTS calls the simulation and graphics objects % into the workspace. % % Syntax % ------ % [sim,gr] = ui.CallSimulationAndGraphObjects(); % % Details % ------- % Returns the current simulation and graphics objects, entering them into % the workspace. % % Examples % -------- % ...
function foundColorName = ColorName(checkColors) %checkColors = [38 77 83]; %colorMat = readtable('colortable.csv','Delimiter','@'); %colorMat = table2cell(colorMat); colorMat = {... %'Blue', '153.0014 100.2472 125.8768'; 'Black', '143.8997 35.5542 53.8000'; 'White', '134.8410 41.4204 212.967'... }; %disp(colorMat); ...
%script to print out the ENFs cur_directory = pwd; training_data_path = 'C:\Users\Andrew\Desktop\Unsorted\UNSW Signal Processing Cup\training_data'; cd(training_data_path); all_wav = dir('*.wav'); for i = 1:length(all_wav) [y,fs] = audioread(all_wav(i).name); [enf1, ~] = extractenf(y,fs,10,2^14,1,9,0.5); ...
%% Ideal Data robot.bodyHeight = 0.185; % robot.bodyHeight = 0.5; robot.bodyEx = 0.300; robot.bodyIn = 0.100; robot.armAngle = deg2rad(10); % robot.armAngle = 0; robot.shoulderLength = 0.197; robot.shoulderLength = 0.6; robot.shoulderEx = 0.100; robot.shoulderIn = 0.0900; robot.elbowHeight = 0.233; % robot.elbowHeigh...
function results = uq_lar(Psi, Y, options) % RESULTS = UQ_LAR(PSI, Y, OPTIONS): sparse regression with Least Angle % Regression. PSI is the matrix of evaluations of the regressors in the % experimental design points, while Y are the corresponding model % responses. The OPTIONS structure is optional and can contai...
function displayBytes(p) % PACKET/DISPLAY Displays the packet to the user % %It prints all fields as single byte arrays %in decimal notation % %If the DISPAY_HEX global variable is set then it prints in %hexidecimal notation. % %It also prints the number of bytes of each field %next to it's label in parenthesis. % % ...
function Y = DLM_Inference(x,para) %input: % x is the observation sequence, M by N matrix % para.A, para.T, para.C, para.sigma, para.u0, para.V0 are the model parameters %output: % Y.z is the latent state sequence % Y.P, Y.u, Y.V, Y.K, Y.J, Y.uAll, Y.VAll are the latent parameters % Y.givenAll is the flag to ind...
close all clear all load('16-07-15v20a-1-10b-15-11pk-11_tr-20_param15V.mat') %% Currently only focusing on linear run data %% str = '16-07-15_v20LinData_TimesIncl'; % Enter particle number here and order parameter ORDER = 0.95; % Minimum number of data points (look at FpS?) MINPOINTS = 100; q = size(prcle); % Count is ...
function Z = cost(X1,alpha, beta, gama, PD , lambda) Voilation = constraint(X1,PD); yy = length (X1(:,1)); generation_cost = zeros(yy,1); for co = 1:yy generation_cost(co) = generation_cost(co) + sum(alpha + beta.*X1(co,:)+gama.*(X1(co,:).^(2))); end Z = generation_cost + lambda .* Voilation; end
function [stiffener_cords,XY_stiffener] = VAT_stiffener_v3_RigidRotational(T01,a,b,stiffener_nodes_number,RigidTheta) XY_stiffener = zeros(2,stiffener_nodes_number,2); number_of_nodes = 100001; x_RHS = linspace(0,a/2,number_of_nodes ); T0 = T01(1)/180*pi; T1 = T01(2)/180*pi; if T0 == T1 T1 = T1+1e-2/180*p...
function [PPInirs] = PPI_nirs(SPM_file, nirs_file, seed_channels, Uu, dir_save,HB) %SPM_file - name of SPM_indiv_HbX.mat file %nirs_file - name of filtered, step-removed file %y is the seed channel time series. %Uu - Matrix of input variables and contrast weights. This is an % [n x 3] ...
%TrainingData_File='csv_data/ACTEWAGL/train_wd.csv';TestingData_File='csv_data/ACTEWAGL/test_wd.csv'; FileName='input_data/ACTEWAGL/elm_input_wd'; %TrainingData_File='csv_data/ACTEWAGL/train_lwd.csv';TestingData_File='csv_data/ACTEWAGL/test_lwd.csv'; FileName='input_data/ACTEWAGL/elm_input_lwd'; %TrainingData_File='csv...
%% Topological Ordering of Animal Species %% set(0, 'DefaultFigurePosition', get(0,'screensize')); clc; clear; close all; %% Introduction % *Units* % If we were to use RBF units, we would have for every unit an activation: % % $$RBF(in, w) = \exp\left( \frac{||in-w||^2}{\sigma} \right)$$ % % and the winner unit would...
function [] = demo() % QMS demo delete(timerfindall); mktlogout clear all; rehash; % cloud_doc_dir = 'C:\Users\Rick Zhu\Documents\Synology Cloud'; cloud_doc_dir = 'D:'; fn = '\intern\5.ÎâÔÆ·å\optionStraddleTrading\OptInfo.xlsx'; file_path = [cloud_doc_dir, fn]; qms_ = QMS_TEST; qms_.init(file_path); pause(30); vs =...
function error = errorPosteriori(xActual,xAnterior) e = abs(xActual-xAnterior); error = e/xActual; end
function [EEG, HDR] = bdf2eeg(varargin); % BDF2EEG Reads file in .BDF format and places data in EEGLAB format (EEG struct) % % Required inputs: data directory ('pathname') % filename ('filename') % % Optional inputs: re-reference ('reference') DEFAULT= 'none' % ...
%sharpening the image by minus the laplacian (second derivative) function [imgOut]=imsharpen(imgIn,method) I1=imgIn; %Preallocate the matrices with zeros I=zeros(size(imgIn)); %Filter Masks if method==1 F=[0 1 0; 1 -4 1; 0 1 0]; elseif method==2 F=[1 1 1; 1 -8 1; 1 1 1]; end %Padarray with zeros imgIn=padarray(im...
clear A = [1 2; 3 5]; b = [4;11]; n = 2; L=eye(n); for k = 1:(n-1) for i= (k+1):n m = A(i,k)/A(k,k); A(i,k) = 0; L(i,k) = m; for j = (k+1):n A(i,j) = A(i,j) - m * A(k,j); endfor; endfor; endfor; y(1) = b(1); for i = 2:n soma = 0; for j = 1:(i-1) soma = soma + L(i,j) * y(j); ...
%% This script carries out stall analysis on our aircraft and will output the stall speed %The stall speed may be determined directly from the wing loading obtained %at the conceptual poster stage and maximum lift coefficient. %They will be calculated for take-off, cruise, apprach and landing. function [Vstall]= ...
clear all close all load('nbModel.mat'); dir_path = '../imageSets/INRIAPerson/Test/pos/'; image = imread(strcat(dir_path,'crop_000006.png')); tic [humanBlob, humanMap, blobMeasure] = getHumanBlob(image, nbStruct, model); toc %% Output image with human blob figure imshow(imfuse(image,humanBlob,'falsecolor','Scaling'...
layers=[65 65 65]; sae=saesetup(layers); opts.numepochs = 10; opts.batchsize = 520; for i=1:numel(layers)-1 sae.ae{i}.activation_function = 'tanh_opt'; sae.ae{i}.learningRate = 1; sae.ae{i}.inputZeroMaskedFraction = 0.5; end [sae t outx]=saetrain(sae,x,opts);
function s = stores(jb,je,ncjt,ndof,nsc,gk) s = zeros(ndof, ndof); i = 1; while i <= 2*ncjt if i <= ncjt i1 = (jb - 1)* ncjt + i; n1 = nsc(i1); else i1 = (je - 1)*ncjt + (i - ncjt); n1 = nsc(i1); end if n1 <= ndof j = 1; while j <= 2*ncjt ...
% % clear % Test new mediation code N = 112; Gr = round(rand(N,1)); Nmed = 1; V = randn(N,1); W = randn(N,1); X = randn(N,Nmed) + 10; M1 = 0.2*X + randn(N,1)*0.5;% + i; M2 = 0.2*X + randn(N,1)*0.5;% + i; Y = 0.3*M1(:,1) + 0*M2(:,1) + 0.5.*X + randn(N,1)*0.5;% + 0.1.*X.*M1(:,1); % X = randn(N,1); % M = randn(N,1)...
%%Recognize Black\White Modules function [ qr_matrix ] = get_matrix_from_image( image_qr ) image_qr = uint8(ones(size(image_qr)))-uint8(image_qr); %image_qr = crop_QR(image_qr); qr_matrix = image_to_matrix(image_qr); end %%Crop the image after the right orientation function [ cropped_image ] = crop_QR(qr)...
function Pres = PresentationPanelTHR_Geisler % ---Queries BeginSPL = paramquery('BeginSPL', 'Begin SPL:', '100', 'dB SPL', ... 'rreal/positive', 'SPL to start recording with.',1); MaxNPres = paramquery('MaxNPres', 'Max # pres:', '1500', '', ... 'rreal/posint', 'Maximum number of presentations while searching SP...
function trainnew_Callback(hObject, eventdata, handles) %% Train a new neural network cd(handles.data.squeakfolder); % Apparently, "wind" is a function name, so initialize it as empty wind = []; %% Select the tables that contains the training data waitfor(msgbox('Select Image Tables')) [trainingdata, trainingpath] = ...
%% process_input.m % A script which processes the input string, outputs how many jobs and % machines there are, as well as providing an initial allocation. %% Input: % input_array: n+1 length vector of job costs, and n+1th element is % # of machines % init_algo: A string specifying how to pick an init...
function [ hfig ] = plot_delta_tau( pricer ) %PLOT_DELTA_TAU 画delta~tau的图 % --------------------- % 沈杰,20160124 % 吴云峰,20160129,增加了不改变原有值的方法 %% 预处理 % TODO: 相关预处理 % 将旧的变量进行保存 original = pricer.getCopy(); %% 作图 tau = 0.01:0.02:0.5; delta = zeros( 1 , length( tau ) ); for i = 1 : length(tau) pricer.tau = tau(i); ...