text
stringlengths
8
6.12M
function str = join(pieces,delimiter) % join join an array of strings using a delimiter % % str = join(pieces,delimiter) % % pieces is a cell array of strings, delimiter is a string used to join these. % delimiter may include standard fprintf codes, e.g. \t or \n. % % See also SPLIT. % % JRI 3/13/07...
function [u] = homodyne(u, n, wname, sigma) %HOMODYNE [u] = homodyne(u, n, [wname, sigma]) % author: from QSM.m github, by Kames UBC narginchk(2, 4) if nargin < 4, sigma = [0.25, 0.25]; end if nargin < 3 || isempty(wname), wname = 'hann'; end wname = validatestring(wname, {'hann', 'hamming', 'gaussi...
function Rep = rlDeterministicActorRepresentation(Model, ObservationInfo, ActionInfo, varargin) % RLDETERMINISTICACTORREPRESENTATION construct a deterministic actor % (policy) representation for reinforcement learning agents. % % * Deep Neural Network Representation % % REP = RLDETERMINISTICACTORREPRESENTATION(N...
clear; clc; close all; restoredefaultpath; addpath(genpath('lib/')); addpath('param_files/'); suptitleStr = 'Image62 Green Channel'; DataPath = '../Stripping_Data/'; ElastixPath = '/Users/abhijitc/Documents/Software/elastix-5.0.0-mac/bin/'; MainPath = sprintf('output/%s/',strrep(suptitleStr,' ','_')); mkdir(MainPath)...
function yd=ord2a(t,y); global kp tp zeta u; yd(1)=y(2); yd(2)=(kp*u-y(1))/tp^2-2*zeta*y(2)/tp;
[X,genelist]=sc_readfile('example_data\GSM3204304_P_P_Expr.csv'); [X,genelist]=sc_rmmtgenes(X,genelist); [X,genelist]=sc_selectg(X,genelist,3,2); [X]=sc_selectc(X,20000); [X,genelist]=sc_selectg(X,genelist,3,2);
% Function to run spatial 3 oddity comparison of texture images. Each image % is physically unique, and subjects compare which is odd (from two % original / one synth or two synth / one original). Almost identical to % Balas (2006). function dnn_textures_expt_12() %% Experiment number: expt_num = 12; %% Set random s...
function [adj_qual_mat,new_adj_qual_mat,adj_nexts_mat]=adj_Qual(list_ind,b,QUALTHRESH,cann_pts,line_num) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % adj_Qual computes the ellipse fitting quality of adjacent point pairs % Params: % p,q are two points % Connected_Pts...
function [pose, f, Jc, Jr] = compute_energy3_2D(pose, radii, blocks, view_axis, settings) H = settings.H; W = settings.W; D = settings.D; num_points = length(pose.model_points); indices = pose.model_indices; model_points = pose.model_points; centers = pose.centers; P = pose.P; rendered_data = pose.rendered_data; dist...
% Author: Biao Hu % 2020-01-19 clear clc close all numProcessor=3; data=setupDataExample(numProcessor); info.n = size(data.w,1); % task count info.m = numProcessor; % processor count info.rank=rankqueue(data,info); % upward rank value data.RgoalG=0.95; sch=schedulstart(data,info); gantt(sch,info)
%********************************************************************* % Micro scale solver (MFEM) % % This code is based on: % Bahriawati, C., & Carstensen, C. (2005). % Three MATLAB implementations of the lowest-order Raviart-Thomas % MFEM with a posteriori error control. % Computational Methods in Applied...
function val = ninterp(x,y,t) %NINTERP Evaluate Lagrange interpolating polynomial % NINTERP(x,y,t) returns the value(s) of the Lagrange % interpolating polynomial for the points x and values % y, evaluated at t. x and y must be vectors of the % same length and x must have distinct entries. t may % be ...
function [tracker, param0] = tracker_init_ex(frm,p,opt) tracker.mask_opt = 0; img = double(rgb2gray(frm))/255; [templates,~,~] = init_library_v2(img,p,opt.sz); d = prod(opt.sz); % Initialization of library % N_dict = 6+16; % for i = 1:N_dict % tmp = target +(5*i/N_dict)*noise(:); % ...
function [P,h] = quantPlot(X,Y,Q) % [P,h] = quantPlot(X,Y,Q) % draws quantiles of vector, fills them, plots median % X is the x-axis values to be averaged over % Y are the values to be averaged for the Y axis % Q are the quantiles to plot, can be scalar (e.g. 20 will plot quantiles % 20% from the median, or a ve...
function epochs = gps2epochs(gpsWeek,tow) % gpsWeek = floor(epochs/(604800)); % tow = mod(epochs,604800); epochs = gpsWeek*604800+tow; end
clear L=[0.2 0.3 0.5]; T=10000; tmpu=normrnd(0,1,[1,T+length(L)-1]); y=zeros(1,T); for i=1:T y(i)=L*tmpu(1+i-1:3+i-1)'; end u=tmpu(3:end); save('2_lag_linear_memory_task.mat','u','y','L')
function net = cnn_imagenet_init_inception(varargin) % CNN_IMAGENET_INIT Initialize a standard CNN for ImageNet opts.scale = 1 ; opts.initBias = 0.1 ; opts.weightDecay = 1 ; opts.cudnnWorkspaceLimit = 1024*1024*1204 ; % 1GB opts = vl_argparse(opts, varargin) ; net = dagnn.DagNN() ; net.meta.inputSize = [299 299 3 1...
function [ sheet names ] = makeXlsSheets( u,chem,s, r, cfg ) %makeXlsSheets Transfers the data into easy to read excel files about the results. % Each tab is a new method output with the final two being the unit and % stream list along with the appendix. idp=r.idp; design=r.design; hierarchy = {'IntVal';'edp'; '...
function [ ] = aqp_solver( un, is_uv_mesh ) %BFGS_SOLVER Summary of this function goes here % Detailed explanation goes here global ver_num order total_volume u_n0 = un; u_n1 = un; u_n2 = un; p = un * 0; % theta = 0.8182; % theta = 0.9387; theta = 0.6; num = size(u_n1, 1); A = get_precomputed_info(is_uv_mesh); ...
[x,Fs] = audioread('singing44.wav'); output = phaseVocoder(x', Fs, 1024, 512, 1/2); soundsc(output, Fs); audiowrite('exercise3.wav', output, Fs);
%% Reaction time for movement % Author: Nisheet (npatel@student.ethz.ch or npatel@ini.uzh.ch) % Alternatively, contact Ariel Gilad (gilad@hifo.uzh.ch) % Description: % Calculates reaction time for movement % Dependencies: % 1. first_move_in_delay.mat or first_move_in_delay_forelimb_m2.mat, % 2. tri...
function X = mask(tsa, t0, t1, masking) % % mTSD = ctsd/Mask(tsd, t0, t1, masking) % % INPUTS: % X = ctsd object % t0 = sets of start times % t1 = sets of end times % masking = 1=NaN times inside trial pairs, 0=NaN times outside trial % pairs (default = 1) % NOTE: must be SAME units as tsd! % %...
function [ geo2 ] = supercell( geo1, array ) %SUPERCELL Create a supercell by replicating a geometry. % geometry2 = SUPERCELL(geometry1,array) generates a new geometry that is % an array(1) x array(2) x array(3) supercell of geometry1. % % See also IMPORT_POSCAR. geo2 = geo1; geo2.coords = []; f...
function [Xtrain,Ytrain,Xtest,Ytest] = split_db(dbname) fn = sprintf('~/Data/mldbs/%s',dbname); load(fn); n = size(X,1); r = randperm(n); nhalf = floor(n/2); trn_inds = r(1:nhalf); tst_inds = r(nhalf+1:end); Xtrain = X(trn_inds,:); Ytrain = classes(trn_inds); Xtest = X(tst_inds,:); Ytest = classes(tst_inds);
% RTMOCAP_SMOOTH Apply a low-pass Butterworth filter % % This function will help you to smooth your data with an appropriate % filter suited for human motion capture. (See Winter, 1990) % % Usage : DATA_SM = RTMocap_smooth(DATA,Fs,Fc,order) % % DATA, a N-by-3-by-M matrix of recorded data, with N the number of ...
function data fid = fopen('database.txt', 'w+'); for i=1:450 a=num2str(i); c1='.jpg'; filename=strcat(a,c1); fprintf(fid,'%s\r',filename); end fclose(fid);
%% SYS800 - Reconnaissance de formes et inspection % M'Hand Kedjar - December 2016 % Course Project on Age and Gender Classification function [y, list_images] = get_list_images(path) list_images = {}; count_images = 0; folder = list_files(path); y = []; names = {}; n = 1; for i=1:length(folder)...
% our parameters p.c1_l_y_gap = 0.7; % lag p.c2_l_y_gap = 0.1; % lead p.c1_dl_y_tnd = 0.8; p.ss_dl_y_tnd = 5; p.std_shock_l_y_gap = 3; p.std_shock_dl_y_tnd = 2;
%filter slice thickness close all; clear all; folderpath = 'D:\IO Cohorts\LCIO' cd (folderpath) mincc = 3; addpath('C:\Users\Mitch\Documents\MATLAB\git\batchconvert'); mkdir (strcat(folderpath, '\5mm')); all_files = dir; all_files = all_files(~[all_files(:).isdir]); num_files = numel(all_files); for i = 1:num_fi...
function c = ss_censored( spikes, use ) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % ss_censored - wrapper for censored.m % % Usage: % c = ss_censored( spikes, use ) % % Description: % Estimates the percent of a cluster that is lost due to censoring. % See censored.m for mor...
function [C, sigma] = dataset3Params(X, y, Xval, yval) %DATASET3PARAMS returns your choice of C and sigma for Part 3 of the exercise %where you select the optimal (C, sigma) learning parameters to use for SVM %with RBF kernel % [C, sigma] = DATASET3PARAMS(X, y, Xval, yval) returns your choice of C and % sigma. You...
result = zeros(x,10); money_sum = 0; for i = 1:x money_sum = 0; x_cor = sum_result_1(i).x; y_cor = sum_result_1(i).y; for e = 1:30 result(i,x_cor(e)) = result(i,x_cor(e)) + Consum_car(y_cor(e)); end for n = 1:10 [diff,money] = level_dif(result(i,n)); ...
Params=load([WorkingP 'PKM.mat']); GeneralDataFN=[WorkingP 'Params.mat']; Params2=load(GeneralDataFN); InterpolationFactor=ceil(Params.TimeBetweenDCEVolsFinal*Params.Options.SubSecondResolution); HTs=0:Params.TimeBetweenDCEVolsFinal/InterpolationFactor:Params.GoodTs(end)*60; STsI=1:InterpolationFactor:numel(HTs); HAIF=...
function cvecs = CH_intial_2D(N,T,k,seed) %{ CH_initial_2D initialised the solution matrix cvecs with user specified initial condition. Inputs: -N: number of grid spacings in one-dimension -T: maximum number of time-steps -k: specifies which initial condition -seed: seeds the random number generator Outp...
function [vertex,face,d,c] = read_ply(filename) % read_ply - read data from PLY file. % % [vertex,face] = read_ply(filename); % % 'vertex' is a 'nb.vert x 3' array specifying the position of the vertices. % 'face' is a 'nb.face x 3' array specifying the connectivity of the mesh. % % % Copyright (c) 2...
classdef reactor < handle properties s sc xpo kmax crdsteps iafull; tot_kan; irmx; tot_crd; mminj; power; end methods function obj = reactor(cc) obj.s=cc.s; ob...
[A,B,C,D] = textread('FMM_Treecode.txt','%f %f %f %f'); loglog(B(61:65),A(61:65),'-o');hold on for i=2:4 loglog(B(((i-1)*5+61):(i*5+60)),A(((i-1)*5+61):(i*5+60)),'-o'); end loglog(D(61:65),C(61:65),'--o');hold on for i=2:4 loglog(D(((i-1)*5+61):(i*5+60)),C(((i-1)*5+61):(i*5+60)),'--o'); end hold off
function batch = gen_batch_val(net,imdb,bthid,batchsize,neg_num) tuple_per_num = neg_num + 1; batchsize = batchsize * tuple_per_num; total_num = max(size(imdb.val_pair)); st = mod(bthid*batchsize+1,total_num); en = mod((bthid+1) * batchsize,total_num); if(st == 0) st = total_num;end if(en ==...
function dvdt=delta_t_global(t,v_v) delta_v=sym('delta_v'); parameter_initialization2; %o_p_d=(1-volume_ratio).*c_d0./(1-volume_ratio.*(1-delta_v)); %o_p_f=c_f0./(1-delta_v); %delta_o_p=2*r*T*(o_p_d-o_p_f)/10^5; %global c_d0; %global c_f0; %global volume_ratio; global delta_h_p; global volume_ratio; %o_p=niu*R*T*(c_d0...
close all clear all clc %% vehicle info x_min = -3; x_max = 3; y_min = -10; y_max = 10; x_config_count = 25; y_config_count = 81; theta_config_count = 7; costLog = []; costMatLog = []; start_n_goal_nodes_factore = 1; %% load data from files adjDirectory = '/home/az/git_repos/phd/road-traversability/data/adjacency/cl...
function dn = backprop(da,n,a,param) %SOFTMAX.BACKPROP Backpropagate derivatives from outputs to inputs % Copyright 2012-2015 The MathWorks, Inc. if isa(da,'gpuArray') dn = iBackpropGPU(da,a); else dn = iBackpropCPU(da,a); end end function dn = iBackpropCPU(da,a) [S,Q,N] = size(da); dn = zeros(S,Q,...
%% Mean square displacement analysis of particle trajectories. % %% % Mean square displacement (MSD) analysis is a technique commonly used in % colloidal studies and biophysics to determine what is the mode of % displacement of particles followed over time. In particular, it can help % determine whether the particle i...
function [ x_Id ] = outer_4( I_d, z_ft, G_ft, w, hash, sigma, offset, tau ) %outer_4 この関数の概要をここに記述 % 詳細説明をここに記述 for i = 1:L [ x_d ] = inner_6( I_d, z_ft, G_ft, w, hash, sigma, offset, tau ); x_Id(:,i) = x_d; end end
% mesure fermeture bump % depend de 8 parametres : Voltage et délais des 4 kickers delai0 =31522324; ddelai=1; k=10; % stepclk (5.6 ns) voltage0=4000; dvoltage=10 ; k=10; % en volt r=1.05; r=1.05; tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigStepDelay',delai0-4+1); tango_write_attribute2('ANS...
function [ log_l, indicator, epsilon, uvec] = likelihood(data, params,setup) %computes the log likelihood for the MA model eps_initial =setup.initial_eps; lag_length=setup.lags; indicator=zeros(size(data,1),lag_length+size(data,2)); epsilon=zeros(size(data,1),lag_length+size(data,2)); %data is supposed t...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 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:/...
classdef FixedPoint<handle %INTERFACE Summary of this class goes here % Detailed explanation goes here properties h = 'x(i) x(i+1) Error\n'; i = 1; root; initial iterations = 0; maxIterations = 50; eps = 0.0000...
function [ out ] = expect_norm2(U,V,row_cov,dim_cov,i,j,k) %E[XaXb] = µaµb + ?a,b. %E[Uki Vkj] %?a,b = ?ij?kl % fprintf('i:%d - j:%d \n',i,j+length(U)) out = U(i,k)*V(j,k) + row_cov(i,j+length(U))*dim_cov(k,k); end
plot February change rate and response time. time=1:1440; figure(1); for i=1:28 plotyy(time,FebTime(1+1440*(i-1):1440*i),time,Febpercent(1+1440*(i-1):1440*i)); hold on; end grid on; figure(2); for i=1:28 scatter(time,Febpercent(1+1440*(i-1):1440*i)); hold on; end grid on; figure(3); for i=1:28 plot(...
function Ephys_chan_plot(data, cfg) % Ephys_chan_plot(data, cfg): plots all the channels that have been loaded % using Ephys_load_data. Labels are applied based on the channel names. x % range can be specified in the cfg. % %inputs: % data [struct]: output from Ephys_load_data % - data % -...
clear;clc; g=9.81; %gravity a L=1; %assume length of pendulum is 1m m=1;%suppose m=1kg tvec = (0:0.01:10); for i=1:5 figure(); theta = 10*i; [thetat(i,:),~] = nonlinearpendulum(theta,tvec); [an, bn, fn] = fourier_a_b_coefs(thetat(i,:), tvec); subplot(1,2,1);hold on; plot(fn(1:20),a...
function [m, Res_term, TV_term, Tik_term] = nlcg_tik(m0, params) % % m: susceptibility chi of whole FOV or only local brain tissue % Res_term: norm of residual/fidelity term (L-curve purpose) % TV_term: norm of TV term % Tik_term: norm of Tik_term % % argmin ||Res_wt * (F_{-1} * D * F * sus_mask * chi - tfs)|| + TV_reg...
function RestoredImage = WienerFilter_fft(y,h,sigma); % RestoredImage = WienerFilter_fft(y,h,sigma); % y: Degraded image (with blur and noise) % h: Degrade kernel % sigma: standard deviation of noise R = size(y,1); %get number of rows C = size(y,2); %get number of columns Yf = fft2(y); Hf = fft2(h,R,C); Syy = abs(Yf).^...
function hor800meV_script %demo_dir='c:\temp\horace_demo'; demo_dir=pwd; %demo_dir=fileparts(which('demo_script')); %================================================================================================== % Unzip the data contained in the demo folder, and copy demo %=========================================...
clc; clear; load('gesture_data_dmp_weights'); % Discrete EM algo demos = [static_, iu_, triangle_, letterS_, UL_slash_, LL_slash_]; K = 6; m = size(demos,2); % number of examples m_all = m/K; train_ratio = 2/3; m_train = m/K*train_ratio; n = num_basis*3; % features per demo. W_all = zeros(n, m); % weights for i = 1:...
% Example 14.6 -- Table 14.2 -- differencing with uneven step clear all k = -5:1:-1; h = .5*10.^k; h2 = 2*h; exact = 1; meth1 = h./(h.*h2)*exp(0) + (h./h2.*exp(h2) - h2./h.*exp(-h)) ./ (h+h2); meth2 = (exp(h2)-exp(-h)) ./ (h+h2); format long g err1 = abs(meth1-exact) err2 = abs(meth2-exact)
clc timenow=0.01; timeglobal=0; tglobal=tic; matcounter = 1; % Starting row for output matrix max_operation = 5; % Maximum time robot will move matrixsize = max_operation * 100 + 100; % Based on the time for operation, will wait 1 second after robot stops to end recording Sheet1Mat = zeros(matrixsize,14);...
function dcmFolder2MATobject(PathName,MaxVarSize) % function dcmFolder2MATobject(PathName,MaxVarSize) % ------------------------------------------------------------------------ % This function converts the DICOM files in the folder PathName to a MAT % object which is stored as a file called IMDAT in a new subfold...
function [R]=CombineFactors(factors) % CombineFactors.m % Direction(right, left), Condition(gap, overlap) % This is an 2*2 experiment % gap:1; overlap:2 % left:1; right:2 % create [R] = [1, 1; 1, 2; 2, 1; 2, 2] tmpNum=1; for i=1:length(factors) tmpNum=tmpNum*factors(i); end R=zeros(tmpNum, length(factors)); for i=...
%% prep3_performanceIndicators.m description % This file predefines the variables that will be used to track performance % indicators over the simulation runs. % Add the code for your own performance indicators to this file. %% Performance indicators. % Actual fuel savings, comparing the actual fuel use to the tota...
% open figure % adds fill for all boxes for plotFig5_Sommerdata function addBoxPlotFillAll(colors,num_subdiv,num_total) % ADDBOXPLOTFILLALL adds filled in patch elements for box plots of gcf if nargin < 2 num_subdiv = 5; num_total = 30; end ax = gca; b = ax.Children(end); bc = b.Children; % box objects are 61:...
function D = bspline_approx(k,t,x,M) % B-spline curve control point approximation with known knot vector. % % Input arguments: % k: % B-spline order (2 for linear, 3 for quadratic, etc.) % t: % knot vector % x: % B-spline values corresponding to which data points are observed % M: % d-by-m matrix of observe...
clear all clc %% Parameters % Simulated data set (uncomment the data set to be used) data_path = 'sim_data/straight walk, 1000 steps.mat'; %data_path = 'sim_data/Closed trajectory, 1 loop.mat'; %data_path = 'sim_data/Closed trajectory, 10 loops.mat'; load(data_path) display('Simulated data loaded') global simdata ...
% op_rings.m clear all close all clc wL = 6.328e-9; k = 2*pi/wL; ES = 1e-3; a = 0.01; nR = 101; zP = 0.1; xQ = linspace(0,a,nR); rQP = sqrt(zP^2 + xQ.^2); EP = (ES ./ rQP) .* exp(-1i * k * rQP); %EP_sum = sum(EP) EP_sum = 0; T = zeros(1,nR); for c = 1 :nR if abs(angle(EP(c))/pi) < 0.5; EP_sum = EP_...
%% FingerPrint Demo % If manual comparison by a fingerprint expert is always done to say if two % fingerprint images are coming from the same finger in critical cases, % automated methods are widely used now. % % Among all the biometric techniques, fingerprint-based identification is % the oldest method which...
function mps_outputFolder = LymphNodeFuseCNNPredictions(CNN_image_folder,BatchFolder,PredictionsTextFile,opt) %% PARAMS if ~isfield(opt,'NumberBatches') opt.NumberBatches = 20; end if ~isfield(opt,'BatchStartIndex') opt.BatchStartIndex = 1; end if ~isfield(opt,'ope...
clear all; clc; n = -10:10; x = n+3; [esDePotecia,potencia] = esFuncionDePotencia(n,x); if(esDePotecia) disp('Es funcion de potencia'); disp(['La potencia es: ',num2str(potencia)]); end [esDeEnergia,energia] = esFuncionDeEnergia(n,x); if(esDeEnergia) disp('Es funcion de energia'); disp(['La energia e...
%setAxes %Self-explanatory xL = xlim; yL = ylim; line([0 0], yL); %x-axis line(xL, [0 0]); %y-axis set(gca,'fontsize',12);
clear clc close all format compact %% Define System to Identify SysID = 3; switch SysID case 1 %First Order Linear System A = [-3]; B = [1]; C = [3]; D = 2; x_deriv = @(x,u) A*x + B*u; y_out = @(x,u) C*x + D*u; case 2 %Second Order Non-Linear Syste...
ampli = input('Please enter how much you want to raise/decrease the volume: '); in_f= 'ben_trim.wav'; [y, fs] = audioread(in_f); %sound(y,fs); amp_new = y*ampli; audiowrite('bensound_amp_high.wav', amp_new, fs); % clear y fs; % out_f = 'bensound_amp.wav'; % [y, fs] = audioread(out_f); % player = audioplayer (y, fs...
function [ex_mat ex_mats] = TestImage_Refine(ex_mat_ini, M, I, in_mat, minDim, minTz, maxTz, delta, photometricInvariance, method, verbose) % adding 2 subdirectories to Matlab PATH AddPaths % preCalculation [marker, img, bounds, steps, dim] = preCal(in_mat, M, I, minDim, minTz, maxTz, delta, verbose); ...
function [ sum_rhs ] = bellman_rhs( currS, currA, V ) p = 0.4; sh = currS + currA; %if you get heads then current captial goes up by the "action" amount st = currS - currA; if sh > 100 sh =100; end if st < 0 st = 0; end st = currS - currA; %if you get tail then current capital goes down by the "action" amount...
%converts an input image to opponent colorspace function new_image = rgb2opponent(image) [r, g, b] = getColorChannels(image); o1 = (r-g)./sqrt(2); o2 = (r+g-2*b)./sqrt(6); o3 = (r+g+b)./sqrt(3); new_image = cat(3, o1, o2, o3); end
function [W, W_hist, loss_steps] = newoasis(images, labels, agress, ... total_steps, seed, filename) % The difference between old and new oasis is that the new one chooses % randomly the triplet (pivot,plus,minus), instead of looping (in % random order) over pivots, then plus...
function [printusage, infostr, key, val, scell] = set_id_check_inputs(functionname, varargin) %<<<1 % function identifies and partially checks inputs used in infoset* functions % if printusage is true, infoset* function should call print_usage() % % input possibilities: % ...
classdef DataSource < handle methods(Abstract) % actually load this into the database, assume all dependencies have been loaded loadInDatabase(src, database); end methods function str = describe(src) % return a string describing this datasource str = class(...
function re_vector = lbpCodingOld(image) % 最传统的ibp编码 [row column num] = size(image); re_vector = zeros(row,column,8); for i = 2:row - 1 for j = 2:column - 1 matrix = image(i-1:i+1,j-1:j+1,1); % 取出3*3矩阵块 value = matrix(2,2); index = matrix > value; re_vecto...
function [col,ins] = convsig2c(freq) %this function chooses the colours that display on the led in relation to %the signals that generate it cs = freq/(1000/255);%change the range to match the led image ins=cs; if cs <= 85 col= 3; elseif ((85<cs) && (cs <= 170)) col=2; elseif cs > 170 col =...
function class_nameObj = method_name(class_nameObj,arg1) % The "method_name" method ... TODO: Add description % % SYNTAX: TODO: Add syntax % class_nameObj = class_nameObj.method_name(arg1) % % INPUTS: TODO: Add inputs % class_nameObj - (1 x 1 package_name.class_name) % An instance of the "package_name...
%% clear all; clear cache; close all; global channelNumbers collectionInterval countNew isCollecting indexFlip collectFlag inNam dataSample imgArray stimTime startTime stopTime rawWindow trials labeled Hd mode subject repeat_trials numDevices samplingRate xx yy; %% Data Structure initialization variables %dataSample =...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This function runs a simulated annealing process % to find the best fit for the model % for young and old. All the other parameters are fixed, % only epsilon_str and epsiln_pfc change % Input parameters % % simAnnVarsAge = simAnnByAge(100,10) function s...
function readSampleWaveforms(ch) global FileInfo; global Handles; global WaveformInfo; w = waitbar(0,'Please wait, reading sample waveforms'); for j = 1:length(ch) PacketNumbers{j} = []; for i=1:length(FileInfo) nums = find(FileInfo(i).PacketOrder == ch(j)); PacketNumbers{j} = [PacketNumbers{...
clear;clc;close all; entrada = [0 0;0 1;1 0;1 1]; saida = [0 1 1 0]'; numcentros = 10; tamanho = size(entrada,1); centros = entrada; % CALCULO DA DISTANCIA MAXIMA ENTRE OS CENTROS % ============================================ soma = 0; for i = 1 : numcentros distancias = zeros(tamanho,numcentros); for j = ...
%Andrew Brown Homework 9 Problem 3 clc clear close all %Model an elliptical staircase in different ways %h=4 n=2 elipse %define variables t=linspace(-400,400,10000); %independent variable a=8; %m b=4; %m h=4; %m n=2; %m [x,y,z] = Staircase(a,b,h,n,t); %Make the staircase subplot(2,3,1) %place in subplot plot3(x,y,z...
%% 改进的re-adjustScore代码。代码正确,效率较re-adjustScore2高。 function score1 = readjustScore( score, adjList) % 把原来的分数s, adjust为PNR(s) exceptZeros = score > 0; % 不对分数为0的link进行调整 step = adjList(2,1)-adjList(1,1); bin_theta = adjList(1,1) - step; score = score - bin_theta; binIndex = floor(score/step)+1; % 注意,若去除0的hybriddistribution...
function [sample, spheresample, linesample, samplesize] = generatesphereline(sampleparam,rgparam,varargin) %========================================================================== % Syntax % [sample, spheresample, linesample, samplesize] = generatesphereline(sampleparam,rgparam) % [sample, spheresample, linesam...
%% Calibration Eye Validity % % Defines the validity of calibration eye sample. % %% classdef CalibrationEyeValidity < EnumClass properties (Constant = true) %% InvalidAndNotUsed % The eye tracking failed or the calibration eye data is invalid. % % CalibrationEyeValidity....
function [fl, fh, fc] = nth_octave_freq (n, k, f0) if (nargin < 3) f0 = 1e3; end if (nargin < 2) k = 0; end if (nargin < 1) n = 3; end fc = power (2, k/n) * f0; fh = sqrt (2.^(k/n) .* 2.^((k+1)/n)) * f0; % = sqrt (2^((2*k+1)/n)) * f0; % = (2^k) * sqrt (1/n) * f0; fl = sqrt (2.^((k-1)/n) .* 2.^(k/n)...
function [e, J_e_rob, J_e_lmk] = error_observe(rob, lmk, y) % in: % rob: robot pose (x, y, th) % lmk: landmark position (px, py) % y: polar measurement (d, a) % out: % e: estimation error % J_e_rob: Jacobian of error wrt. robot pose (2x3 matrix) % J_e_lmk: Jacobian of error wrt. landmark position (2x2 matrix) % ...
function results = mc_nca(featuremat,pheno,edgethresh,FDRthresh,nets,varargin) p = inputParser; %addRequired(p,'featuremat'); %addRequired(p,'pheno'); %addRequired(p,'edgethresh'); %addRequired(p,'FDRthresh'); %addRequired(p,'nets'); addParameter(p,'nPerm',0); addParameter(p,'nuisance',[]); addParameter(p,'verbose',0);...
function model = ibpmultigpSortModel(model) %% Sort etadq according to its values [~, sorteta] = sort(sum(abs(model.etadq.*model.kern.sensitivity)),'descend'); if any(sorteta~=1:model.nlf), temp = model.latX; for q = 1:model.nlf, model.latX{q} = temp{sorteta(q)}; end model.etadq = model.etadq(:...
function makeplot(hObject,event,Data,Timestamp,hplot,htxt1,htxt2) n = get(hObject,'Value'); n = ceil(n); if n == 0; %slider bar remaps from 1 to end, excludes zero n = 1; end set(hplot,'Zdata',Data{n},'Cdata',Data{n}); set(htxt1,'String',{['Frame ' num2str(n)]}); set(htxt2,'String',{['Time ' Timestamp{n}]}); draw...
function arplot_dcct(monthStr, days, year1, month2Str, days2, year2) %ARPLOT_DCCT - Plots various performance data from the ALS archiver % arplot_dcct(Month1 String, Days1, Year1, Month2 String, Days2, Year2) % % EXAMPLES % 1. arplot_dcct('January',22:24,1998); % plots data from 1/22, 1/23, and 1/24 in 1998 % % ...
for i = 1:size(raw,1) if ~isempty(raw{i,40}) try TMT_vals1 = str2num(raw{i,40}); catch TMT_vals1 = raw{i,40}; end else TMT_vals1 = NaN; end if ~isempty(raw{i,41}) try TMT_vals2 = str2num(raw{i,41}); catch ...
function obj = reduceunion(obj) %REDUCEUNION Remove redundant hyper-rectangles in a union (array). % B = reduceUnion(A) % % All redundant hyper-rectangles in A (i.e. ones that are contained in % others) are removed. B is the result. % % (C) 2011 by Truong X. Nghiem (nghiem@seas.upenn.edu) % Remove thin sets o...
% Relevant tests for modification of MixedLogitDemandNew clear testdiff = @(x,y)assert(abs(x - y)<10e-4, 'Obtained %f instead of %f' ,x, y); testtrue = @(x,y)assert(abs((x - y)/y)<1e-3); testtrue1 = @(x,y)assert(abs((x - y)/y)<1e-2, ... 'Percentage difference is %f', abs((x - y)/y)); testtrue5 = @(x,y)asser...
function [bnet,engine] = kyu_BN_paramlearn(data,dag,ns,alpha_d,option) % Construct a full Bayesian Network model by learning parameters (CPTs) % given the graph and data % input % data: training data with a BNT format (rows:nodes,cols:patients) % dag: a DAG matrix % ns: node sizes % alpha_d: equivalent sample size fo...
function gb=gabor_fn(sigma,theta,lambda,psi,gamma) % % % sigma_x = sigma; % sigma_y = sigma/gamma; % % % Bounding box % nstds = 3; % xmax = max(abs(nstds*sigma_x*cos(theta)),abs(nstds*sigma_y*sin(theta))); % xmax = ceil(max(1,xmax)); % ymax = max(abs(nstds*sigma_x*sin(theta)),abs(nstds*sigma_y*cos(theta))); % ymax...
classdef SERIAL_CONNECTOR < CONNECTOR_CLASS % Serial通信用クラス % properties result serial baudrate = 115200; % Arduinoと合わせる end properties(SetAccess=private) port end methods function obj = SERIAL_CONNECTOR(param) % 通信する対象毎にインスタンスを作成する. % param.port : COM n...
function day_of_week(n) if n == 1 fprintf('Sunday,'); day_type = 2; elseif n == 2 fprintf('Monday,'); day_type = 1; elseif n == 3 fprintf('Tuesday,'); day_type = 1; elseif n == 4 fprintf('Wednesday,'); day_type = 1; elseif n == 5 fprintf('Thursday,'); day_type = 1; elseif n == 6 ...