text
stringlengths
8
6.12M
% cleanup routine clear screen ShowCursor if expmnt.useEyeTracker == 1 Eyelink('ShutDown'); end clear mex
% Computational Inteligence I - Final Script % % 5-fold Cross-Validations and Visualizations of Results % keep('Results'); clear all; close all;clc epVal=10.^linspace(2,4,3); lrVal=linspace(.1,.9,3); mcVal=linspace(.1,.9,3); Results=cell(28,12); Results{1,1}='epochs'; Results{1,2}='learning rate'; Re...
% This file is aim to select the bigger information frame from all % the frames.To do this,there has three steps to do: % % 1、select all frames of an object.This used A、B、C status. % 2、Delete the unsuitable frame,such as the beginning frame which has the % gap. % 3、Choose the frame which has more information to rec...
function id = uffind(field, varargin) %UFFIND Find UF Collection instances. % ID = UFFIND(FIELD, VARARGIN) returns the list of IDs matching the % search criteria. FIELD is the field name to search on. VARARGIN % contains the list of values to match. Currently supported fields are % % ID = UFFIND('kind...
% Example script for basic Kohonen map algorithm. clear all % close all data = dlmread('data.txt'); % read in data labels = dlmread('labels.txt'); % read in labels name = 'Frédéric Ouwehand'; % REPLACE BY YOUR OWN NAME targetdigits = name2digits(name); % assign the four digits that should be used digitstor...
function p = normcdfO ( t ) %normcdfO: Computes the cummulative Gaussian distribution at a specified %point of interest % normcdfO: A different function from Matlab's normcdf. Here 'O' is used to % differentiate these two functions sqrt2 = 1.4142135623730951; p = (erfcO (-t / sqrt2)) / 2.0; end
function nframes = getNFrames(this) % getNFrames Returns the number of frames in the object. % % nframes = getNFrames(obj) returns the number of frames % within the object or the array of object in argument. For his % default method (@multipagedrawable), it simply returns the number % of objec...
%[4-2] ADD function [z1,z0,cout1,cout0] = fourbitadder_int(x1, x0, y1, y0, cin1, cin0) %cin_vec=zeros(5); cout_vec=zeros(5); carry=zeros(5); sum=zeros(5); z1=zeros(1,5); z0=zeros(1,5); z0(5) = cin0; %Original t_j+3 = Z_j+3_minus cin_vec(5) = cin1; %hj+3 %64-bit parallel online ...
function dz = forwardstart(w,p,z,param) %CONVWF.FORWARDSTART Propagate derivative from weight to weighted input % Copyright 2012-2015 The MathWorks, Inc. [S,Q] = size(z); M = length(w); mframe = 0:(M-1); pt = p'; dz = zeros(S,Q,M,'like',p); for i=1:S dz(i,:,:) = pt(:,i+mframe); end end
function flag = nntwarn(cmd) %NNTWARN % % Syntax % % nntwarn on % nntwarn off % % Description % % NNTWARN allows Neural Network Toolbox warnings to be temporarily % turned off. % % Code using obsolete Neural Network Toolbox functionality can % generate a lot of warnings. This function allows you to...
function D = dist(C, im, r1, c1, S, m) % Squared spatial distance % ds is a fixed 'image' we should be able to exploit this % and use a fixed meshgrid for much of the time somehow... [rows, cols, chan] = size(im); [x,y] = meshgrid(c1:(c1+cols-1), r1:(r1+rows-1)); x = x-C(4); % x a...
function range_average(file_in,file_out,start,stop,range,samples) #output_points=int32(samples) resample_x=linspace(start,stop,samples); resample_y=[]; X=load(file_in); temp_x=X(:,1); x=temp_x'; temp_y=X(:,2); y=temp_y'; first_x=x(1); last_x=x(end); count=int32(0); fid=fopen(file_out,'w'); for i=1:length(resample_x) el...
function [output1] = Jb_Pelvis(var1) if coder.target('MATLAB') [output1] = Jb_Pelvis_mex(var1); else coder.cinclude('Jb_Pelvis_src.h'); output1 = zeros(6, 20); coder.ceval('Jb_Pelvis_src' ... ,coder.wref(output1) ... ,coder.rref(var1) );...
function [NetParams, GDparams] = SGD_Momentum(grads, NetParams, GDparams) layers = length(NetParams.W); fn = fieldnames(grads); for j = 1:length(fn) for i = 1:layers % GDparams.v_t{j,i} = GDparams.gam * GDparams.v_t{j,i} + GDparams.eta*grads.(fn{j}){i}; GDparams.v_t{...
%% CHARLIE JIANG % SSCP | Sunwhale % Run WSC route with Luminos altered for various concentrator/array charging % configurations and plot the performance impacts, benchmarked against actual Luminos. clc; clear; close all; cd('Z://sscp//sunbad//strategy//LuminosModels') % Night/morning array standing is equivalent to ...
function [mpiFV fpiFV report] = FSE_GL(mpiV,fpiV,aF0,L,print,rev) mm=[6 12 8 6 24 24 0 12 30 24 24 8 24 48 0 6 48 36 24 24]; mm4=4*mm; Nf=2; x=(mpiV./(4*pi*aF0)).^2; lambda_pi = mpiV .* L; z = sqrt([1:20]')*lambda_pi; g1=mm4 * (besselk(1,z)./z); %g1=mm4 * (sqrt(pi./(2*z)) .* exp(-z) ./ z); Rmpi=x .* g1 /(2*Nf); Rfpi=-...
function z = marker(fname,method) %MARKER Creates a marker element in old AT version (Obsolete) %MARKER('FAMILYNAME','METHOD') % creates a new family in the FAMLIST - a structure with fields % FamName family name % Length is set to 0 for marker type % PassMethod name of the function on disk to use for ...
function Out=MultiConcat(A,B) if(iscell(B)) for i=1:length(B) Out{i}=[A B{i}]; end else for i=1:length(A) Out{i}=[A{i} B]; end end
function GA clear all close all clc set(0,'DefaultFigureWindowStyle','normal'); global cut Mpay Udes DEBUG g0 Isp type test finalName global PATH POP fTEST scalingGain fGain global ALLbool MVECbool DELVbool COSTbool global W global Fit P PATH = 'C:\Users\Bruno\Google Drive\TG\Codigo\Main\Data\'; test = struct('Nmin'...
classdef HMMModel2 < handle properties(SetAccess=private) transProb, emitProb, initProb, cachedAlpha, cachedBeta, isCache, end properties(Dependent) nStates, nObserve, end properties(Constant) ITER_TOLERENCE = 1e-...
% PDF,frequency clear clc %data_path='/Users/hcq/workspace/MCS/Result/run_globalTropical_86-05_1exp3/'; %output_path='/Users/hcq/workspace/MCS_2016_private/data/'; data_path='/home/hxm_stu/WORK1/hcq/MCS/Result/run_globalTropical_86-05_1exp3/'; output_path='/home/hxm_stu/WORK1/hcq/MCS/data/'; % record_name = 'record_tra...
% load game identity kernel based on GLM 1 % function [ker, features] = load_game_kernel(EXPT, subj_id) game_names = get_game_names_ordered(subj_id); [ker, features] = load_GLM_kernel(EXPT, 1, subj_id, game_names, false); end
%%******************************************************************** %% genSDPdata: generates the SDP corresponding to the BSOS hierarchy %% %% F: objective polynomial %% G: a cell array containing the constraint polynomails %% dd: the degree of Lagrangian dual relaxation %% kk: the degree of SOS relaxation %%...
% GMMB_EM_INIT_CMEANS1 % % initS = gmmb_em_init_cmeans1(data, C) % % Create an initialization structure for EM, % called from gmmb_em, see gmmb_em. % % C-means clustering means, uniform weight and covariance % % Author(s): % Pekka Paalanen <pekka.paalanen@lut.fi> % % Copyright: % % Bayesian Classifi...
function varargout = setParams(self, varargin) % Set parameters of this MoDT object % setParams(self, ...) % % Unless otherwise specified, all of the publically-accessible properties of an % MoDT object can be set using this function. % % New values can be specified as key/value pairs: % >> modt_obj.setParams('mu',...
% Version : 4.10 % Author : Dano Bagus net = network; % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ % % This function creates a feedforward neural network with 100 % neurons in the input layer and 1 neuron in the output layer. % to study more about how to create a network like this see h...
clearvars clc rho=7800; % density 7800 kg/m^3 G = 0.8e11; % in N/m^2 d = 0.03; % diameters of shafts in m nele = 6; % no. of elements connect = [1 1 2; %% First Column is element number 2 2 3 3 3 4 4 4 5 5 5 6 ...
%ChooseMotherWavelet motherWavelet='bior1.1'; CWTScale=8; % ---------------------------------------------------------------- % Path fileMotherPath='Test-source/'; SourcePath='Transparent/2'; outPutDataPath=strcat('Data/',SourcePath,'/'); if ~exist(outPutDataPath) mkdir(outPutDataPath) end ...
function y = cdiff2(f, x) h = eps( )^(1/4)*max(1, abs(x)); y =(f(x+h) - 2*f(x) + f(x-h)) ./ h.^2; end
function savegeo(obj,outputFilePath,varargin) %SAVEGEO dumps the geometry into an ASCII file, using the Gmsh syntax. % SAVEGEO('file.geo') dumps the geometry in file named file.geo. % % SAVEGEO('file.geo','option1',val1,'option2',val2,...) set name-value % arguments for meshing option. The available options are th...
function [h] = plot_gp_variance_2d(limits, gp_handle, train_inputs) nx = 400; ny = 400; axlim = limits; ax_x=linspace(axlim(1),axlim(2),nx); %computing the mesh points along each axis ax_y=linspace(axlim(3),axlim(4),ny); %computing the mesh points along each axis [x_tmp, y_tmp]=meshgrid(ax_x,ax_y); %meshing the input d...
%{ % pseudo-data setting t=-pi:.01:pi; x=sin(t); y=cos(t); xn=.05*randn(1,629); yn=.05*randn(1,629); x=x+xn; y=y+yn; % additional data for objective function mydata.x=x; mydata.y=y; ds(1,'circlefit',mydata,10,3,-10,10,2000) plot(x,y,'o','markersize',2); hold on plotcircle(globalminimizer(1),...
function [C,R] = weiss2(T,I) %WEISS2 Estimate rheobase and chronaxie based on 2 thresholds and Weiss's law % [C,R] = weiss2(T,I) C = (I(2)-I(1))/(I(1)/T(2)-I(2)/T(1)); R = I(1)/(1+C/T(1));
function [ im ] = seam_carveA( im, m, alpha, Gmag_flag ) %SEAM_CARVEA Seam carving using A* approach on A GMAG IMAGE % Detailed explanation goes here plot_flag = 1; if ~Gmag_flag im2 = rgb2gray(im); im2 = im2double(im2); [Gx, Gy] = imgradientxy(im2); [Gmag, ~] = imgradient(Gx,Gy); else im2 = rgb2g...
function [psnr]=psnr(A, B, MAX, Q) %A = A / Q; %B = B / Q; %d = sum((A(:)-B(:)).^2) / numel(A); %psnr = 10*log10((MAX*MAX)/d); B = B * Q; MSE = mean2((A-B).*(A-B)); psnr = 10*log10(MAX^2/MSE); end
function cancerStudies = getcancerstudies(cgdsURL, varargin) %GETCANCERSTUDIES Get cancer studies from the cBio CGDS portal. % A = GETCANCERSTUDIES(cgdsURL) loads a list of available cancer types % into A. cdgsURL points to the CGDS web API, typically % http://www.cbioportal.org/public-portal/. % % The func...
function [tNew, stateNew] = equidistantializer(t,state, nSteps) tNew = linspace(min(t),max(t),nSteps); stateNew = spline(t,state.',tNew); stateNew = stateNew.';
function mag = k_quat_mag(q) % Quaternions are w x y z, active. % Magnitude of a quaternion. q_norm = k_quat_norm(q); mag = 2*acos(q_norm(1)); end
function [flag, der1, der2] = AlterBsplineType(pts, p, ctrl, knots, curveParameter, ce ) % Determine which one of the six middle control points should be altered. % After knot inserting, each curve parameter in the knot vector has a multiplicity of the % degree, which means the curve point at the parameter is one of th...
clc clear all %% Batch Oja rule % tutorial 7-7 % % input=[[-5;-4],[-2;0],[0 ;-1], [0; 1], [3 ;2],[4; 2]] % input x--------- % N=size(input,2); %number of input vector % x_mean=[sum(input(1,:))/N;sum(input(2,:))/N]; % mean of x % % zero_mean_x = input-x_mean; % turn inout into 0 mean data % w = [-1,0]; % initial we...
function [gmdmproduct] = y_gmdmp(tensor1, d1, tensor2, d2) %GMDMP General Multi Dimensional Matrix Product. %C = GMDMP(A, d1, B, d2) Computes the product %C(i[1],...,i[d1-1],i[d1+1],...,i[m],j[1],...,j[d2-1],j[d2+1],...,j[n]) = % A(i[1],...,i[d1-1],k,i[d1+1],...,i[m]) * B(j[1],...,j[d2-1],k,j[d2+1],...,j[n]) %(Sum ...
clear all ;close all ; subs = {'alex','charest','esteban','fabio','gab','gabriella','genevieve','gina','guillaume','jeremie','julie','katrine','lisa','marc',... 'marie','mathieu','maxime','mingham','patricia','po','russell','sunachakan','tah','vincent'} ; flips = [1,0,0,0,0,1,1,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,...
% Fold data, assuming dim1 is time. function [out_data] = fold_data(in_data, is_stag_baryon) parse_Nt = size(in_data, 1); connected = in_data; if (~exist('is_stag_baryon', 'var')) is_stag_baryon = 0; end for t=2:(parse_Nt/2) if (is_stag_baryon == 1) connected(t,:) = (connected(t,:)+(1-2.*r...
function y = testFunction(x) y= x^2;
clear; clc; start=clock; id=1; switch id case 1 Da='4k2_far-d2.txt'; % 4-400 case 2 Da='iris-d4.txt'; % 3-150 case 3 Da='yeast-d7.txt'; % 5-384 case 4 Da='pima-indians-diabetes-d8.txt'; % 2-768 c...
function [totalCost,imOut] = intelligentResize(imInput,v,h,W,mask,maskWeight) % Function increaseWidth % Inputs iminput(m*n*3) - 3-channel colored image % v - the number of vertical seams to process v, % h - the number of horizontal seams to process h % W - the weight vector W for...
clear all files_in.partition = '/Users/AngelaTam/Desktop/adsf/ct_basc/adsf_basc_ct_20160316/msteps_part.mat'; files_in.data = '/Users/AngelaTam/Desktop/adsf/structure_data/cortical_thickness/thickness_files_bl_vertex_20150831/preventad_civet_vertex_bl_20160216.mat'; files_in.model = '/Users/AngelaTam/Desktop/adsf/mode...
clc clear close all % creat data % % Linear ooo = ones([50, 1]); moo = zeros([50, 1]) - ooo; yt = [ooo;moo]; xt = zeros([100, 2]); for i= 1:50 %y > x xt(i, 1) = i; xt(i, 2) = (50 - i) * rand + i + 1; end for i= 1:50 %y < x xt(i + 50, 1) = i; xt(i + 50, 2) = (i - 1) * rand; end %%Circuit % xt = zer...
function LOSpoint = FindLOSpoint(wp_k,wp_k1,vessel_pos,R) %FindLOSpoint(wp_k,wp_k1,vessel_pos,R) finds the crossing point between the % line formed by the waypoints (wp_k and wp_k1) and the circle centered in % (vessel_position) with a radious (R). LOSpoint=wp_k1; LOSpoint1=wp_k1; LOSpoint2=wp_k1; slope=(wp_k1(2)-wp_k...
function [lpeig,apeig]=fft2e(xref,x,Ts) Xref=fft(detrend(xref)); X=fft(detrend(x)); nmin=round(0.3*Ts*length(xref)); nmax=round(0.7*Ts*length(xref)); [xxref,ixref]=max(abs(Xref(nmin:nmax))); ixref=ixref+nmin-1; lpeig=X(ixref,:); apeig=Xref(ixref); %@(#) fft2e.m 1.1 03/08/26 08:02:52
function [Nonblockingness] = Nonblockingness(Pre,Post,M0,Te1,w,k) % __________________________________________________________________________________________________________________________________ %| ...
function [x,n] = shift(y,n1,n0) x = y; n = n1-n0; end
function [y] = exp_wlimiter(x) %% % Created by Kyle Gorkowski [LAPTOP-A4QKFAC8] on 2018-Oct-31 4:58 PM % Copyright 2018 Kyle Gorkowski %% ulimiter=690.7755;%log(10^300); llimiter=-690.7755;%log(10^-300); % force upper limit upperlimit=x>ulimiter; x=x.*not(upperlimit)+upperlimit.*ulimiter; % force lower...
%% 语音信号谱估计 参数化方法 clc,clear,close all; %% 读取语音信号 ReadAudio = audioread('Test.m4a'); InputSignal = ReadAudio; SignalLength = length(InputSignal); InputSignal = InputSignal - mean(InputSignal);% 零均值处理 %% Yule-Walker方程求AR模型系数向量 [a1,~] = yulewalker(InputSignal,20); PSD_YWAR = argamse(1,a1,1024); %% 最小二乘法求AR模...
function [extra_edges,missing_edges,precision,recall,skeleton_F1_score]=... learning_errors(A,B) A = (A+A')>0; B = (B+B')>0; skeleton_errors = B-A; extra_edges = nnz(skeleton_errors>0)/2; missing_edges = nnz(skeleton_errors<0)/2; precision = nnz(A.*B)/nnz(B); recall = nnz(A.*B)/nnz(...
function Get_group_avg(myDataDir, n_subject, n_trial, tasks) %myDataDir = '/NAS/home/kh_guy/Capstone/Brainstorm/brainstorm_db/shin_worload/data'; %n_subject = 26; %n_trial = 9; %tasks = {'0-back_session', '2-back_session','3-back_session'}; for i_task = tasks sFiles = {}; task_name = char(i_task); ...
function [Y,DY,DDY] = ControllerOutput(VirtualCon, rbm, phi, dphi, d2phi, parameterization_type) arguments VirtualCon (1,1) VirtualConstraint rbm (1,1) DynamicalSystem phi (:,1) casadi.SX dphi (:,1) casadi.SX d2phi (:,1) casadi.SX parameterization_type (1,:) {mustBeMember(parameterization_type...
function result = simreadcell(cellnumber) result = 0; motionobject = getMotionObject(); if isempty(motionobject) error('No Simulation Motion object started!!!'); else result = motionobject.readcell(cellnumber); end end
function [ newS ] = scaleAllResults( S, Scaling ) newS = S; for i = 1:length(newS) %dispstat(sprintf('Scaling Surfaces %i,%i\r',i,1)); newS{i}{1}.surfacesS = scaleSurfaces(S{i}{1}.surfaces, Scaling.AppliedEField); newS{i}{1}.plots3Ds = scalePlots3D(S{i}{1}.plots3D, Scaling.AppliedEField); end for...
% downsample densely skeletonized k0725 cube. % this cube was initially intended as seeds for contouring, using for efpl validation also. %skelin = '/Data/datasets/skeletons/k0725_contourcube_cube_8to9_9to10_3.055.nml'; %skelout = '~/Downloads/k0725_contourcube_cube_x4_y4o64_z3_dsx2y2z1.055.nml'; skelin = '/Data/data...
function [F, Jc, Jr] = compute_energy6(centers, radii, tangent_blocks, tangent_spheres, verbose) D = length(centers{1}); %% Compute projection on the triangle plane F = zeros(D * length(tangent_blocks), 1); Jc = zeros(D * length(tangent_blocks), length(centers) * D); Jr = zeros(D * length(tangent_blocks),...
function im_rec = tomo_recon_sart_im(im, angles, n_it) %TOMO_RECON_SART_IM Tomographic reconstruction using SART method. % % Phymhan % 09-Aug-2013 09:16:25 if nargin < 3 n_it = 100; end siz = size(im); [W, p, ~, ~] = buildWeightMatrix(im,angles); f = sart_solve(W,p,n_it); im_rec = reshape(f,siz);...
function v_t=DM_Derived_game(clv,x) % DM_DERIVED_GAME computes from (v,x) a modified Davis-Maschler reduced game vS on S at x for % game v. % % Source: H. I. Meinhardt. The Modiclus Reconsidered. Technical report, Karlsruhe Institute of Technology (KIT), Karlsruhe, Germany, % 2018. URL http://dx.doi.org/10.13...
function [idx,IsEst]=GetConsistentCorrespondences(Grid3D,Pts,Rad3D,StrLBoxPad,BackProjThresh,Cams,ScaleMargin,KeyP,KeyScale,Points) p1=KeyP; [Mean,Var,IsEst]=Get3DGridEst(Grid3D,Pts,Rad3D,p1(1),p1(2)); if(IsEst) Var=Var+StrLBoxPad; Q=Mean*ones(1,8)+[Var(1)*[-1 1 -1 1 -1 1 -1 1];Var(2)*[-1 -1 1 1 -1 -1 1 1];Var...
clc; clear all; close all; figure(1); hold on; lb = 1;ub = 2;%自变量取值范围[1,2] ezplot('sin(10*pi*X)/X',[lb,ub]);%画出函数曲线 xlabel('自变量X') ylabel('因变量Y') %%定义遗传算法参数 NIND = 40;%种群大小 MAXGEN = 20;%最大遗传代数 PERCI = 20;%个体长度 GGAP = 0.95;%代沟 px = 0.7;%交叉概率 pm = 0.01;%变异概率 trace = zeros(2,MAXGEN);%寻优结果的初始值 FieldD = [P...
function [pNum,pSym] = SolveCoeff(x,y,dLevel) % % [pNum,pSym] = SolveCoeff(x,y,dLevel) % %FUNCTION: % This function is used to symbolically find the coefficients of a % polynomial that precisely meets the constraints described in the % arguments. % %INPUTS: % x = vector of input constraints % y = vector of o...
% OCR (Optical Character Recognition). warning off % Clear all clc, close all, clear all % Read image imagen=imread('TEST_3.jpg'); % Show image imshow(imagen); title('Inpute Image') % Convert to gray scale if size(imagen,3)==3 %RGB image imagen=rgb2gray(imagen); end % Convert to BW threshold = graythresh(imagen);...
function [theta, J_history] = gradientDescentOld(X, y, theta, alpha, num_iters) %GRADIENTDESCENTMULTI Performs gradient descent to learn theta % theta = GRADIENTDESCENTMULTI(x, y, theta, alpha, num_iters) updates theta by % taking num_iters gradient steps with learning rate alpha % Initialize some useful values m ...
% Changed to enable multi-cell fiber simulations. Should be consistent with % equations in karma_sim_statefbtest as of 10/18/09. Changed stimduration % and epsil1 and presence/absence of acoeff*, hprime, etc. to depend on the % number of cells. Changed function arguments to vectors instead of % scalars. % Older...
function Q = IC(x, y, gas_gamma, gas_const) % function Q = IC(x, y) % Purpose: Set Initial conditions for double mach reflection % Location of initial discontinuity xc = 1/6; yc = 0; aos = pi/3; p1 = 116.5; rho1 = 8.0; u1 = 7.14471; v1 = -4.125; p2 = 1.0; rho2 = 1.4; u2 = 0.0; v2 = 0; % Initial pr...
function [ J_opt, u_opt_ind ] = LinearProgramming(P, G) %LINEARPROGRAMMING Linear Programming % Solve a stochastic shortest path problem by Linear Programming. % % [J_opt, u_opt_ind] = LinearProgramming(P, G) computes the optimal cost % and the optimal control input for each state of the state space. % % Input ...
function [is1, is2] = circleIntersectionHF(A,B,ra,rb) D = norm(B-A); Sa = (ra^2 - rb^2 + D^2) / (2*D); AM = Sa*((B-A)/D); if (ra^2-Sa^2) < 0 is1 = [NaN; NaN]; is2 = is1; return; end q = sqrt(ra^2-Sa^2); AB = B-A; MS1 = [-AB(2); AB(1)]; MS2 = [AB(2); -AB(1)]; is1 = A + AM + (MS1/norm(MS1))*q ; is2 = A + AM ...
function [zetamat, thetamat, theta_star_vmec, zeta_boozer, theta_boozer] = ... generate_vmec_and_boozer_coords(file_vmec_outputa, surfs_to_make, numtheta, numzeta) % function [zetamat, thetamat, theta_star_vmec, zeta_boozer, theta_boozer] = ... % generate_vmec_and_boozer_coords(file_vmec_outputa, surfs_to_ma...
%%Same as new_presenation_figures, but now combine position tensors along %%dim3 instead of dim1 before calculating angles & averaging %% specify where the data is, initialize cell to store tensors for each probe position data_path='C:\Users\kirsi\Dropbox\struct_rep_data'; subject_id={'AMC026','AMC029','AMC031','AMC0...
function [pwav]=p_wav(x,a_pwav,d_pwav,t_pwav,li) l=li; a=a_pwav; x=x+t_pwav; b=(2*l)/d_pwav; n=100; p1=1/l; p2=0; for i = 1:n harm1=(((sin((pi/(2*b))*(b-(2*i))))/(b-(2*i))+(sin((pi/(2*b))*(b+(2*i))))/(b+(2*i)))*(2/pi))*cos((i*pi*x)/l); p2=p2+harm1; end pwav1=p1+p2; pwav=a*pwav1;
function s = num2strcell(x) % % s = num2strcell(x) % Convert number array to cell array of strings for savecsv % s = cell(size(x)) ; for k=1:length(x(:)), if isnan(x(k)), s{k} = '' ; else s{k} = num2str(x(k),6) ; end end if length(x)==1, s = s{1} ; end return
%% Esempio funzionamento img = imread('esempio_funzionamento.PNG'); image(img) title('Esempio di funzionamento con 4 processori e dimensione della matrice 7x8');
function tev = findeventsbydiffandgap(data, delta) if ~exist('delta','var') delta=1/24; end tev=[]; for ii=1:length(data) M=max(data(ii).data)-min(data(ii).data); time = data(ii).time; ixdiff = find(diff(time)<1 & diff(data(ii).data)>M*0.02); ixgap = find(diff(time)>1)+1; tev = [tev, time([ixdiff; ixga...
function a = alphah(v) a = 0.07 * exp(-(v + 65) / 20); end
function [J, gradient] = costFunctionLogistic(theta, X, y, lambda=0) %COSTFUNCTIONLOGISTIC Compute cost and gradient for logistic regression % J = COSTFUNCTION(theta, X, y) computes the cost of using theta as the % parameter for logistic regression and the gradient of the cost % w.r.t. to the para...
function [s] = startSerial( port ) % startSerial(port) % sets up serial communication with MATLAB for use to % send data to Arduino or other software. This function deletes all % previous open serial ports and then creates a new serial object, s, with % a BaudRate of 115200. The function also pauses before ending, whi...
clear all ;close all ; subs = {'alex','charest','esteban','fabio','gab','gabriella','genevieve','gina','guillaume','jeremie','julie','katrine','lisa','marc',... 'marie','mathieu','maxime','mingham','patricia','po','russell','sunachakan','tah','vincent'} ; subgenders = [1,1,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0,1,1...
function [] = training() averageError = 0; fileError = fopen('error.txt','w'); for r = 1 : 20 % 1 : 20 load(['processed/training_feature_vector_' num2str(r)]); load(['processed/training_truth_' num2str(r)]); ['Training: ' num2str(r) ' / 20'] cvpart = cvpartition(roi_response,'holdout',0.3); Xt...
function imagePreProcessing(directoryPath) % Creates Locatin matrices for all 150 training images, while also prepping % the tableGenerator functions to generate "Randomly Sampled" data or % "Evenly Sampled data." srcLabelled =... dir(strcat(directoryPath, 'Labelled\*.png')); srcUnlabelled =... dir(str...
mp = zeros(size(M)); i = 1 idx = transform_particles(pose(:, 1), scanAngles, ranges(:, 1),... param.resol, param.origin, size(M)); mp(idx) = 255; figure; imshow(mp);
%% Wei Tao Chen clear; filename = 'MNIST_X_train.mat'; m = matfile(filename); Xtrain = m.Xtrain; filename = 'MNIST_y_train.mat'; m = matfile(filename); ytrain = m.ytrain; filename = 'MNIST_X_test.mat'; m = matfile(filename); Xtest = m.Xtest; filename = 'MNIST_y_test.mat'; m = matfile(filename); yte...
function pitchflow_processdir(indir, outdir) % pitchflow_processdir(indir, outdir) % Process an entire directory of wavfiles and write out pitchflow % feature files. % 2014-01-16 Dan Ellis dpwe@ee.columbia.edu % Get a list of all the *sph files in <indir> fdir = dir(fullfile(indir, '*.sph')); for i = 1:length(fdi...
function obj_feature = getDetectionFeature(frame_obj) % calculate features of detected objects % Input % - frame_obj: frame points of a certain object % % Output % - obj_feature features of the detected objects, N*1 struct % - average_speed: average speed of all the object points % - average_power: average power of ...
function g = Sigmoid(z) % This function runs the sigmoid function on every element in a matrix g = 1./(1+exp(-z)); end
function VsP = grpaction_i2p(p, Vs) %GRPACTION_I2P performs group actions for each V of Vs to translate from %T_{I}M to T_{p}M. p^1/2 V p^T/2 = p^1/2 V p^1/2 since p^1/2 is symmetric. % % % See Also: QUADFUNC, GRPACTION_P2I % $ Hyunwoo J. Kim $ $ 2016/04/18 15:07:00 (CDT) $ %pp = inv(sqrtm(p)); % Can be opt...
function tdiDitherP4A(file) %% A short model of noise influence to TDI CMOS imaging and their effects. %% %% Usage: see comments below %% %% Initial version P1A - 01/12/2014 - Deyan Levski %%\ %%%%% Some Global Variables %%%%% %close all; %clc; %clear all; %ResHor = 640; %ResVer = 480; N = 2; % Number of TDI stages ...
% Figure 6.70 Feedback Control of Dynamic Systems, 5e % Franklin, Powell, Emami % clear all close all; num=0.9*0.05*conv([1 2],[10 1]); num=conv(num,[1 0.005]); den=[1 2 0 0 0]; den=den+[0 0 2*0.9*0.05*conv([10 1],[1 0.005])]; t=0:.5:40; y=step(num,den,t); subplot(2,1,1) plot(t,...
function [pore_data , throat_data] = rawNetworkConstruction(numX , numY , numZ ,... minThroatR , maxThroatR , etaThroatR , deltaThroatR , ... minThroatL , maxThroatL , etaThroatL , deltaThroatL , ... minAspectRatio , maxAspectRatio , etaAspectRatio , deltaAspectRatio) %% global nx ny nz n_p n_t nx = ...
%% %Exakt lösning dt=0.01; t=0:dt:5; N=exp(-t); plot(t,N) shg %% %Euler framåt clear N1 N1(1)=1; for i=2:length(t) N1(i)=N1(i-1)-dt*N1(i-1); end hold on plot(t,N1,'r'); shg %% % Euler bakåt clear N2 N2(1)=1; for i=2:length(t) N2(i)=N2(i-1)/(1+dt); end plot(t,N2,'g'); hold off shg legend('Exakt','Framåt','Bak...
function ctr = histogram_bins( binwidth, maximum ) ctr = binwidth/2:binwidth:maximum; assert( ctr(1) == (ctr(2)-ctr(1))/2 ); end
function [c,ceq]=constraint(policy) global z lambda1 lambda2 param_V [~,B001,B002,J,~,~,D0,~,D,B01,B02,B1,B2]=fun_vstar(policy,param_V); if J>1 ceq=D(J-1)+B01(J-1)*exp(lambda1*(policy(2)-z*(J-1)))*(lambda1)+B02(J-1)*exp(lambda2*(policy(2)-z*(J-1)))*(lambda2); for i=1:(J-1) ceq=ceq+B1(J-1,i)*exp(la...
%========================================================================= % % Simulation demonstration of the finite sample properties of the % AR(1) estimator % %========================================================================= function stsm_finite( ) clear all clc RandStream.setDefaultStr...
global gESR %test2=squeeze(yellowData2(:,1,:)); test=gESR.data(:,:); test=squeeze(test); xstart=2.78; xend=3.3; ystart=0; yend=200; leng=size(test,1); sweep=size(test,2); for i=1:leng test(i,:)=test(i,:)-mean(test(i,:)); test(i,:)=test(i,:)/std(test(i,:)); end xaxis=xstart:(xend-xstart)/...
function [t,y] = odeEuler(diffeq,tn,h,y0) % odeEuler Euler's method for integration of a single, first order ODE % % Synopsis: [t,y] = odeEuler(diffeq,tn,h,y0) % % Input: diffeq = (string) name of the m-file that evaluates the right % hand side of the ODE written in standard form % ...
function make_sensdefs(d3path) % % make_sensdefs(d3path) % Automatically generate the sensdefs.h header file % from the master d3sensdef.csv % Use \ for the path definition % When this function has finished, copy the resulting sensdefs.h % file from the d3/matlab directory to d3/api/include. ...