text
stringlengths
8
6.12M
function Task1=MLE_BAYESIAN(Control_data,Effect_data) % ML estimation with Gaussian assumption followed by Bayes rule %% Make ready the training and test set according to inputs format long nSubj=size(Control_data,2); nPixel=size(Control_data,1); if nPixel==1920 nROW=48; else nROW=23; end Training...
function predictedY = subfnLOOPredictPCs(data,beta,ModelNum,predictedM,NselPCs,SubjectIndex) % predictedM: the predicted value of the combination of SSFs for this ONE % person % NselPCs: The number of PCs used to create this pattern % data: the data for this All subjects % beta: the regression coefficients derived fro...
% 2) A partir do conceito de convolução do ponto de vista da máquina de convolução, escrever % seu próprio programa de convolução. function y = convSaida(x, h) N = length(x); M = length(h); y = zeros(1, M+N-1); for p=1:N+M for q=1:M if p-q>=0 && p-q<=N-1 y(p) = y(p) + x(p-q+1)*h(q); en...
% to generate periodic traj with optimal stability % aircraft should have VR, N and params set function [aircraft, sol] = optimize_stability(aircraft, x0, p, M, params, type, stab_type) % dec vec = [ax0, ... , ax1_N,ax2_1, ... , ax2_N, ay0, ... , ay2_N, az0, ... ,az2_N, tf] % a$1_i corresponds to teh coeffi...
function [x,z] = readSolution(T, b) [nr, nc] = size(T); x = zeros(1, nc-1); x(1,b(1):b(length(b)))=T(2:nr, nc); x = x'; z = T(1,nc); end
%Frequency w = 1643.83836; Omega=linspace(0,pi,w); %Set up vector of Omega for Discrete time Omega1=linspace(0,pi,10001); %Set up vector of Omega for Continuous Time %Setting up the Discrete Time Transfer Funtion using Tustin Approximation z=exp(i*Omega); %Define z on unit circle Htustin=15.4743...
parpool('local', 6); load('traintest.mat','all_imagenames'); imgPaths = all_imagenames; alpha = 600; K = 125; dictionary = getDictionary(imgPaths, alpha, K, 'harris'); save('dictionaryHarris.mat','dictionary'); save('filterBank'); parpool('local', 6); load('traintest.mat','all_imagenames'); imgPaths = all_imagenames; ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function pFac = getPrimeFactor(n) % Return the smallest prime factor we can find for n % this should have a second argument to say where to start looking from. % No need to start at 2 every time. maxVal = 1 + floor(sqrt(n)); % In case n is ...
function prodz = imModulo(x,y) % test if the differences of elements of x are multiples of y: N = numel(x); if N<5 error('N>=5 is required'); end z = []; countr = 0; for i = 2:N z(N-i+1) = mod(imag(x(1))-imag(x(i)),y); if abs(z(N-i+1))<5e-4 countr = countr+1; end end if countr>=2 prodz =...
clear all; clc; close all Matrix_values=[]; prompt= {'Multiple ref:','Number of points:', 'Initial:','Final:', 'Stats_FAD_single (0/1)'}; dlg_title='Input Data'; num_lines=1; excel_file_dFAD_single = 'mydata_dFAD_single.xlsx'; if exist(excel_file_dFAD_single)==1 delete(excel_file_dFAD_single); end %%%% Modifi...
function [ output_args ] = processFunctionID_3( functionIDs, functionNames, dataStream ) functionID_index = 3; functionID = functionIDs( functionID_index, : ); tagLength = getTagLength( functionID ) functionNames{ functionID_index } Command = functionID(1:tagLength) index = tagLength + 1;...
%% MOC calc offline cd /noc/altix/scratch/hb1g13/MITgcm/nchannel/glued_state_files/ V=ncread('220-225all.nc','V'); Y=ncread('220-225all.nc','Yp1'); X=ncread('220-225all.nc','X'); Z=ncread('220-225all.nc','Z'); %Depth integrate dz=Z(1:23)-Z(2:24); dz=[0-Z(1);dz]; V(V==0)=NaN; Vf=flipdim(V,3); dzf=flipdim(dz,1); %timeave...
function outHex = GF256Inv(inHex) % outHex = GF256Inv(inHex) % Input: A hexadecimal 2 digit string, inHex representing a nonzero element of the field % GF(256) % Output: outHex, the corresponding hexadecimal representation of the inverse element GF(256) % A brute-search is done, as opposed to the more efficient Eucl...
clear, close all; clc; % regularization parameter alpha = 1e-2; % construct matrix B = [1, 1, 1; 1, 2, 3]; A = B' * B + .001 * eye(3); % define true solution xtrue = [1; 2; 3]; % compute right hand side (and add random perturbation) eta = 0.05*norm( xtrue ); per = eta*randn(3,1); b = A*xtrue + per; % compute regul...
function repair(list_name); file_list=readlist(list_name); [n_files,str_len] = size(file_list) for k=1:n_files filename=deblank(file_list(k,:)); filename [filetype,info_blocks,... n_channels,n_lines, sampling_rate,... first_line,last_line,n_directions,... comment1, comment2] ...
% daqSessionPlotEvent_TTL shows a real-ish time plot of pulses from % the syncing TTL, pulling data from the session's data buffer (see % daqSessionUPdateDataBuffer.m), and plotting it on the axes specified by % the variable 'ax' (can put on as many axes as desired) % % updated by Mai-Anh Vu, 12/10/2018 funct...
fileToOpen = strcat('plotLeapfrog','.dat'); fidPosi = fopen(fileToOpen); nbRows = 16; Plot_File = fscanf(fidPosi,'%g',[18 nbRows]).'; fclose(fidPosi); bWantToSaveJPEG = true; filename = strcat('boundFraction.jpeg'); % Init of our time vector t = [1 (nbRows)]; for i = 1: (nbRows) t(i) = Plot_File(i,2); end % Init ...
function [nn, xx] = hist_pdf(x, n_bin); [nn,xx] = hist(x, n_bin); nn = nn/length(x)/(xx(end)-xx(1))*length(nn);
function feat = extract_feat(faces,type) feat = cell(1,length(faces)); if strcmp(type,'dsift') descriptor = @dsift; elseif strcmp(type,'mlbp') sift_fac = 0.5; szPatch = 14; scales = [1 3 5 7]; feat = lbpExtract(szPatch,sift_fac,scales,faces); return; elseif strcmp(type,'hog') ...
function [mDiff,indRun] = rundiffs(strDirFunc) % rundiffs.m - for a given functional task, loads any .nii images and % calculates summed absolute difference values across all images % % INPUTS % strDirFunc - string, path to functional dir (below it should be the "run_##" subdirs) % % OUTPUTS % mDiff - numTotalTimePoi...
function download_horseSeg( data_path, dataset_version ) % This function downloads the OCR dataset: https://pub.ist.ac.at/~akolesnikov/HDSeg/ % Input: (optional) data_path - path where to put the downloaded data (default: <package root path>/data/horseSeg) % (optional) dataset_size - version of the dataset to do...
clear, clc, close all git = getGitInfo(); git = git.hash(1:6); notes = ''; % Params dataset_name = 'synthetic'; n_resamples_per_trial = 10; n_trials_per_corruption_level = 10; nprocesses = 2; n_resamples_per_corruption_level = n_resamples_per_trial*n_trials_per_corruption_level; % number of bootstrap iterations per ...
function loop3D(xx,yy,zz,QQ,xxQ,yyQ,zzQ,fnout) fid=fopen(fnout,'w'); fprintf(fid,"# %12s %12s %12s %12s %12s %12s %12s\n",'x','y','z','Ex','Ey','Ez','V'); for k=1:length(zz) for j=1:length(yy) # printf("%d/%d",j,length(yy)); for i=1:length(xx) [Ex,Ey,Ez,V]=funcT2EV(xx(i),yy(...
function [] = ex2() a = load('clock.mat'); a = a.y_cl; b = load('flowers.mat'); b = b.y_fl; [a_filtered, a_laplaced] = laplacian_filter(a); figure(1) subplot(1,3,1); imshow(uint8(a)); title('Original'); subplot(1,3,2); imshow(uint8(a_filtered)); ti...
function fpga_struct = LoadFpgaStereo(fpga_csv_filename) % Loads fpga stereo csv file % % @param fpga_csv_filename filename of the csv file without header line % % @retval fpga_struct structure with the following entries: % <pre> % fpga.frame: frame number % fpga.time_us: device time % fpga.plan...
% [ Copyright (c) 2007 Andrea Tagliasacchi - ata2 at cs dot sfu dot ca - All rights reserved ] % % SYNOPSIS % - D = norm3( A, B ) % D = norm3( A ) % % DESCRIPTION % - This function computes the euclidean distance % between two points in the space % % INPUT % - A: the first point coordinate % - B: the seco...
function timeTraces=barPlotGenotypeCombo(timeTraces,cellTypes,pairsToDoStats,figName) numGenos=length(cellTypes); colors=lines(numGenos); f=MakeFigure('Name',figName,'NumberTitle','off'); set(f,'visible','off'); nflies=zeros(1,numGenos); for l=1:length(timeTraces) if ~isempty(timeTraces{l}) nflies(l)=len...
function mat = twoDct_compression(x, Ks) [N,~] = size(x); mat = []; for a = 1:8:N-7 col = []; for b = 1:8:N-7 sec = x(b:(b+7),a:(a+7)); press = twoD_DCT(sec); [A, I] = sort(abs(press(:)), 'descend'); maxK_value = abs(A(Ks)); X = pre...
function Q=buildQ(Theta,Wi,T,P,N,S) % Build the matrix 'Q' Wbar=repmat(reshape(Wi,[T*P 1]),[N 1]); % [TPN x 1] Qcell=cell(1,S); for s=1:S Qcell{s}=reshape(sparse(Theta{s}*Wbar),[T P*N]); % [T x PN] end Q=blkdiag(Qcell{:}); % [TS x PNS] end %#EoF buildQ
function calc_mfcc(infile, outfile, outfilespec, verbose) % calc_mfcc(infile, outfile) % Emulate HTK MFCC calculation as best as possible % 2013-02-26 Dan Ellis dpwe@ee.columbia.edu if nargin < 4; verbose = 0; end VERSION = 0.2; DATE = 20130624; if verbose disp(['*** calc_mfcc v', num2str(VERSION), ' of ', num2...
clear all; clc file_path = 'D:\课件\大三下\综合课程设计\Part2设计图片库\保存图片\';% 图像文件夹路径 img_path_list = dir(strcat(file_path,'*.jpg'));%获取该文件夹中所有.jpg格式的图像 img_num = length(img_path_list);%获取图像总数 chepai=[]; %iii=1; if img_num > 0 %有满足条件的图像 for pn = 1:img_num %逐一读取图像 image_name = img_path_list(pn).na...
close all; clear; cd ~/research/ActiveVisionDataset/Home_001_1/ load image_structs.mat; % 2 image_structs(2) depth1 = imread('high_res_depth/000110000020103.png'); im1 = imread('jpg_rgb/000110000020101.jpg'); image_structs(2).world_pos R1 = inv(image_structs(2).R) t1 = -R1*image_structs(2).t*scale/1000 ...
function index=turnO(surplus,O,X,first) Oi=100;PO=0;PX=0; precheckO=checkBelongsTo(O,X,2); for i=1:length(surplus) m=ceil(surplus(i)/3); n=mod(surplus(i),3); if(n==0) n=3; end if(precheckO(1)==m) index=i; return; elseif(precheckO...
function [para_corr,active_set] = constraintchecker(params, model) epsilon = 10^(-6); para_corr = zeros(length(params),1); if model == 'Heston' active_set = zeros(length(params) + 1, 1); if params(1) <= epsilon para_corr(1) = epsilon; active_set(1) = 1; elseif params(1) > epsilon para_cor...
function err=w_assembly_fortran(A,X,u0,lambda,params) % call fortran version and compare results lambda2 = lambda(:); W_m=w_assembly(A,X,u0, lambda2,params); U_m = W_m{1}; V_m = W_m{2}; W_m = W_m{3}; %Writing all arrays to text files for use by fortran tester write_array(A,'A_test'); n = size(X{1}); lambda=reshape...
function [outputArg1] = Matrixmultiplikation(inputArg1,inputArg2) %UNTITLED7 Summary of this function goes here % Detailed explanation goes here input1Rows = size(inputArg1(1:end,1),1); input1Cols = size(inputArg1(1,1:end),2); input2Rows = size(inputArg2(1:end,1),1); input2Cols = size(inputArg2(1,1:end),2); if input1...
function [x, flag, iter, res] = GMRES( A, b ,tol, MaxIter, x0) % conjugate gradient method % solving A * x = b % input % A % b % MaxIter : max number of iteration, default: size of A % x0 : initial value of x % tolerance : specifies the tolerance of the method, default: 1e-6 % output % X CheckSquareMatrix(A); if(~isve...
% ======================================================================== % FUNCTION: make3DTransform % mat = make3DTransform(vec) % Tim Dorn % Sept 2010 % ======================================================================== function mat = make3DTransform(vec) l = length(vec); mat = zeros(l,l); for i = ...
%find the growth rate corresponding to single reaction deletion for i = 1:length(sce.rxns) model = sce; model = changeRxnBounds(model,sce.rxns{i},0,'b'); FBAsolution = optimizeCbModel(model,'max'); GROWTH(i) = FBAsolution.f; C(i,1) = GROWTH(i); end
clear all; clc; tic cd(userpath); %% Editables Folder = 'F:\DATA\02.26.21 Phenix Imaging of iPOND Abs and others\Images\'; %Where are the images located? This filepath should end with a folder name, not a file name. %IMPORTANT: Use format 'FILEPATH\'. The apostrophes and ending slash are important. IgnoreCha...
% inverted pendulum - parameter file for hw8 addpath ./.. % adds the parent directory to the path beamParam % general pendulum parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % State Space Pole Placement %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % tuning parameters tr_th = .15;%.35; ...
% MAE670 NonLinear Control Class Project % Instructor Professor Dr. TarnRaj Singh % Submitted by Swapneel Bhavesh Mehta and Ankur Soni % University at Buffalo clc; clear all; close all; tspan=[0, 20]; x_0 = [0 10 pi/4 0 0 0 0]; options=odeset('RelTol',1e-8,'AbsTol',1e-8); [t2, x] = ode45(@mobile_robot, ts...
% Program to Generate EIC's from .ascii data exported from compass Xport % Must export data with mass precision 4. Xport still outputs the % whole spectral time series despite selecting TIC or EIC. % Masses at each time are recorded in odd columns, intensity of listed mass % at those times are in the adjacent cell ...
%hvstiffness - issue 1.1 (30/07/10) HVLab HRV Toolbox %---------------------------------------------------- %[dynamic_stiffness, stiffness, damping] = hvstiffness (acceleration, force, increment, fmax) % Computes dynamic stiffness from acceleration and force measured in an % indenter test % % dynamic_stiffness = ...
clear %inicjalizacja stałych i wektorów kk = 200; k0 = 9; [dU,dZ] = meshgrid(-1:0.1:1); size = length(dZ); y = zeros(size,size); U = zeros(1,kk); Z = zeros(1,kk); %symulacja obiektu dla kolejnych skoków sterowania i zakłócenia for i = 1:size for j = 1:size Y = zeros(1,kk); U(k0:kk) = dU(i,j); ...
% Network of Izhikevich Neurons learns a song bird signal with a clock % input. Note that you have to supply your own supervisor here due to file % size limitations. The supervisor, zx should be a matrix of m x nt dimensional, where % m is the dimension of the supervisor and nt is the number of time steps. % RLS...
function rp_ca=load_complex(complex_file,dims,precision,endian,componentboolean,real_first) % function complex=load_rp_file(paht_to_complex,dims,precision,endian,componentboolean) % loads an interleaved complex file to a variable, % if this is not cartesian data, % dims should be just the number of points, % compon...
function RunFilesMods(option,var_name,var_value,group) global vinf switch option case 'modify' eval('vinf.RunFileMods;test4exist=1;','test4exist=0;'); if test4exist % Check if name already exists-- if so replace value ListValue=strmatch(var_name,vinf.RunFileMods(:,1),'exact'); ...
%%%%%%%%%%%%%%%%%%%%%%%%%%% % read noraxon data file % Marie Moltubakk 18.5.2013 % Read noraxon data file, set first frame as time = zero, EMG+torque data treatment, resample % Produce a new noraxon data array % version 21.1.2015, adapted to use individually calculated norm conversion factors % used by create_...
function ionex = readionex(ionexname) % % Fuction readionex % ================= % % This function reads the contents of a ionex file and store the data into % a structure called ionex % % Sintax % ====== % % ionex = readionex('ionexname') % % Input % ===== % % ionexname -> string with ionex file name ...
clear clc %% Control Relevant Variables % For long-short factor construction, either integer or fraction. That % means if one wants to long three securities and short three, set both to % 3. However, if one wants to long the upper tercile and short the lower % tercile, set both to 1 / 3. If one gives an integer, set f...
x = 0:0.2:pi; plot(x , sin(x)); hold on plot(x , cos(x));
function W = STL_lasso2(Xtrn, Ytrn, param,opts) % [W3,status]=l1_ls(a{1},b{1},best_param,1e-5,1); no_trn_idx = []; for i = 1: length(Xtrn); if size(Ytrn{i},1) > 1 W(:,i) = l1_ls(Xtrn{i},Ytrn{i},param,1e-5,1); else no_trn_idx = [no_trn_idx,i]; end end tmp = setdiff(1:length(Xtrn),no...
function writepts(folder_pts,pts_name,points,n_points) fid=fopen([folder_pts pts_name(1:end-4),'.pts'],'w'); fprintf(fid,'version: 1\n'); fprintf(fid,['n_points:' int2str(n_points) '\n']); fprintf(fid,'{\n'); for p=1:n_points fprintf(fid,'%f %f\n',points(p,1),points(p,2)); end fprintf(fid...
r1 = 0.5; r2 = 1; b = 2; m = 1e-6; y0 = [1,1,1,1]; [t,y] = ode45(@(t,y) f(t,y,r1,r2,b,m),[0 10^4],y0); prop = (y(:,1)+y(:,2))./(y(:,1)+y(:,2)+y(:,3)+y(:,4)); prop2 = (y(:,3)+y(:,4))./(y(:,1)+y(:,2)+y(:,3)+y(:,4)); plot(t,prop) hold on; plot(t,prop2) legend("Trait 1, r_{1} = 0.5","Trait 2, r_{2} = 1"...
%CREATE_MS_FIGURES % % Syntax % ------ % % Details % ------- % % Examples % -------- % % See also: % Copyright 2013 % $Revision: 1.0 $ $Date: 2013/09/22 19:40:00 $ function create_MS_figures(ui, whichButton) dlgbox = questdlg('This will replace your existing simulation with the simulat...
function [im_SR] = TLcR_RL(im_l,YH,YL,upscale,patch_size,overlap,stepsize,window,tau,K,c) [imrow, imcol, nTraining] = size(YH); Img_SUM = zeros(imrow,imcol); overlap_FLAG = zeros(imrow,imcol); U = ceil((imrow-overlap)/(patch_size-overlap)); V = ceil((imcol-overlap)/(patch_size-overlap)); for i = 1:U fpr...
function output=mtlrl(filename, line); % MTLLR reads one line across from a file (type 2 or 3) % % [channel]=mtlrl(filename, line); % % filename: string with filename % line: number of channel to select (line > 0 ) % % See also: MTLWCH, MTLWH, MTLRH % Author: Klaus Hartung [Lehrstuhl A...
dir_data = 'D:\MaggiesFarm\2019_04_17_MF_dev_explore\data_analysis\'; file_list = dir(strcat(dir_data,'part_*')); ID_mat = []; for part_n = 1:size(file_list,1) ID_mat(part_n) = str2num(file_list(part_n).name(6:8)); end % ID_mat = [101]; for ID_n = 1:size(ID_mat,2) ID = ID_mat(ID_n); ...
function [Lx] = FuncLx(x,y,Z) Lx = zeros(2,6); Lx(1,1) = -1/Z; Lx(1,2) = 0; Lx(1,3) = x/Z; Lx(1,4) = x*y; Lx(1,5) = -(1+x^2); Lx(1,6) = y; Lx(2,1) = 0; Lx(2,2) = -1/Z; Lx(2,3) = y/Z; Lx(2,4) = 1+y^2; Lx(2,5) = -x*y; Lx(2,6) = -x;
%********************************************************************************************** %**************************** CHAPTER 9: TRAJECTORY GENERATION ****************************** %********************************************************************************************** function traj = ScrewTrajec...
function drawAnchorInfo(nodeID) % % Draw the ranging lines for the specified node. % global VIS; idx = getNodeIdx( nodeID ); nodeX = VIS.node(idx).real_x; nodeY = VIS.node(idx).real_y; x = []; y = []; for i = 1:length(VIS.node(idx).anchor) a = VIS.node(idx).anchor(i).nodeIdx; delta = [VI...
clear clc path = pwd; dirOutput = dir(fullfile(path,'*.xls')); fileName = {dirOutput.name}; filename=fileName{1,1};%%输入数据表格的名称 [excelData,str] = xlsread(filename,1); %读取原始数据表中的数据:str为数据表中的字符,data为数据表中的数据 [excelRow,excelColumn] = size(excelData); ref_noise=randn(1,excelRow); mixed = excelData(:,4); mu=0...
%% Program to estimate parameters for curve fitting close all; clear all; clc; %% INPUT global h c k data h = 6.626068e-34; % Planck's constant - m^2 kg / s c = 299792458; % Speed of light - m/s k = 1.3806e-23; % Boltzmann constant - SI ...
function var=moistadiabat(temp,qstar) phys_constants for j=1:33 num(j) = (1+(latheat.*qstar(j))./(r_dry.*temp(j))); den(j) = (1+(qstar(j)*latheat^2)./(cp*Rv.*temp(j).^2)); var(j) = (grav/cp)*num(j)/den(j); end num den
function [ obj ] = setRootPath( obj, rootPath ) % 设置rootPath, 中间涉及到一些默认值,有优先级 %% if ~exist('rootPath', 'var') % 几个备选rootPath,按优先级排列 p = cell(1,1); p{1} = 'V:\root\'; p{2} = 'D:\work\root\'; p{3} = 'C:\work\root\'; for i = 1:length(p) e(i) = exist(p{i}, 'dir'); end ...
function success = B6T8(encoding) %Function for simulating the entire implementation of 8B6T success = 0; dword = input('Enter the dataword\n','s'); %New Array p = {}; %Findig no of groups to take n = length(dword)/8; for j = 1:n dword1 = dword(8*(j-1)+1:8*j); %Split the dataword in groups of 12 len = len...
disp = 1; e = 0; b = 6; %I1 = imread('ImageData/Caltech_background/0435.jpg','jpg'); %I2 = imread('ImageData/Caltech_background/0475.jpg','jpg'); I1 = double(XX(:,:,1)); I2 = double(XX(:,:,1)); F1 = fft2(I1); F2 = fft2(I2); nx = size(F1, 2); ny = size(F1, 1); cxrange = [0:nx/2, ...
function autoSet(obj1) fwrite(obj1,'AUTOSet EXECute'); end
function Sigma= Clustered_covariance_estimate(g,cluster_index) %given a matrix of moment condition values g, compute a clustering-robust %estimate of the covariance matrix Sigma [cluster_index, I]=sort(cluster_index); g=g(I,:); g=g-repmat(mean(g,1),size(g,1),1); gsum=cumsum(g,1); index_diff=cluster_index(2:end,1)~=clus...
clear all; %train = csvread('newtrain.csv');%read data %test = csvread('newtest.csv'); load data.txt; load test.txt; train = data; test = test; [train_num dim] = size(train);%get number of row or col [te_num dim] = size(test); %?¤@¤Æ¨ì[-1,1]ªº?šV for i=1:dim max_=max(train(:,i)); min_=min(train(:,i)); t...
function r = dprime(hr,far,num_s1,num_s0) if hr==1 hr = hr-1/(2*num_s1); end if far==0 far = 1/(2*num_s0); end if hr==0 hr=1/(2*num_s1); end if far==1 far = far-1/(2*num_s0); end r = norminv(hr,0,1) + norminv(1-far,0,1);
function ret = save_figures(filename) hfigs = get(0, 'children'); %Get list of figures for m = 1:length(hfigs); figure(hfigs(m)); %Bring Figure to foreground if strcmp(filename, '0'); %Skip figure when user types 0 continue; else ...
function trials2mda(filename) S=load(filename); test_pulse_l=35000; for i=1:length(S.T_select) T=load(['Trials_EPSC_auto_accel_' S.T_select(i).FName]); mat_files={T.Trials(S.T_select(i).trials_select).mat_file}; path=['../20' S.T_select(i).FName(3:8) '/' S.T_select(i).FName]; cd...
%% fn_moveobject %% Syntax % dp = fn_moveobject(hobj[,'fast'|('fastcolor',col)][,'latch'][,'point',i]) %% Description % moves objects while mouse button is pressed % % Options % - 'fast' use 'xor' erase mode for faster display updates % - 'fastcolor' color to use in 'xor' mode % - 'latch' when button...
function P=hypr_phantom P = zeros(256); Pcl = lower_circle; Pv = vertical_bars; Ph = horizontal_bars; Pcu = upper_circle; P = Pcl + Pv + Ph + Pcu; implay(P) end function Pcl = lower_circle Pcl = zeros(256,256,1,25); contrast = ones(1,25) .* 0.2; contrast(1) = 1; contrast(2) = 0.9; co...
%微积分例6:刚性微分方程组(ode15s) %需用模型函数quadeg6fun.m clear;close; [t,y]=ode45('quadeg6fun',[0,10],[2,1]'); plot(t,y); text(1,1.1,'y1'); text(1,0.1,'y2'); pause [t,y]=ode45('quadeg6fun',0,400,[2,1]'); tstep=length(t), minh=min(diff(t)), maxh=max(diff(t)) pause [t,y]=ode15s('quadeg6fun',[0,400],[2,1]'); plot(t,...
% author : Ashwin de Silva % iris plot wrapper close all; clear all; % get the excel file path [FileName,PathName] = uigetfile('*.xls','Select the Excel Sheet'); %get the sheet name prompt = {'Enter patient sheet name:','Enter control sheet name:'}; dlg_title = 'Input Sheet Names'; num_lines = 1; defaultans = {'#2096...
function PrintPacket2(packet) % 纵向打印,更容易看清楚 % ---------------------- % 程刚,20151229 import com.hundsun.esb.data.*; %fprintf('总记录数:%d\n',packet.getRecordCount()); %fprintf('列数:%d, 行数:%d\n',packet.getCol(),packet.getRow()); %fprintf('以下是数据:\n'); for i=0: packet.getRow()-1 packet.setCurrRow(i); for j=0: packet...
function [map,lo,hi] = cubehelix(N,start,rots,sat,gamma,irange,domain) % Generate an RGB colormap of Dave Green's Cubehelix colorscheme. With range and domain control. % % (c) 2017 Stephen Cobeldick % % Returns a colormap with colors defined by Dave Green's Cubehelix colorscheme. % The colormap nodes are selected along...
function [ output ] = neuralscore( teams,input,label,iteration,tp,cr) [m,n]=size(teams); for i=1:m selection=zeros(1,n-3); for j=1:n-3 flag=1; for k=1:j-1 if teams(i,k)==teams(i,j) flag=0; break; end end if flag=...
%mycorr_plot %% BV/TV subplot(2,4,1); mycorr_plot(table2array(lr_XCT1(:,1)),table2array(lr_XCT2_2(:,1)),table2array(lt_XCT1(:,1)),table2array(lt_XCT2_2(:,1)),'BV/TV'); %% pBV/TV %subplot(2,4,2); subplot(1,3,2); mycorr_plot(table2array(lr_XCT1(:,2)),table2array(lr_XCT2_2(:,2)),table2array(lt_XCT1(:,2)),table2array(lt...
%% Calculate Total Aircraft Max Lift during Take-Off and Landing function [maxLiftLanding,maxLiftTakeoff,AoA_Stall_Wing,AoA_Stall_Tail,CL_max_Total_Clean]=TotalLift(CL_max_landing,CL_max_takeoff,CL_max_clean,CL_a_Total,CL_ah,CL_max_h,SHoriz,Sref,rho_landing,V_landing,rho_takeoff,V_takeoff,alpha_zero_takeoff,alpha_ze...
function extracted_fp = extract_fp(R,MR,secretKey,sensitivity,epsilon1) K = floor(log2(sensitivity))+1; p = 1/( exp(epsilon1/K)+1 ); bits_required = floor( log2( max( MR.Variables,[],1) ) )+1; bits_required = bits_required(2:end); [row_num,col_num] = size(MR); L = 128; fp_count0 = zeros(1,L); fp_count1 = ...
function [rpath, dpath, mytestflag] = psinsenvi() rpath = 'E:\00Program\PSIN\psins210522'; dpath = 'E:\00Program\PSIN\psins210522\data\'; mytestflag = 0;
% --------------------------------------------- % Finite-element-based global DIC (FE-Global-DIC) % Author: Jin Yang, Postdoc @UW-Madison; PhD @Caltech 19'; % Contact: aldicdvc@gmail.com; jyang526@wisc.edu % 2015.04,06,07; 2016.03,04; 2020.11 % --------------------------------------------- %% Section 1: Clear MATLAB...
classdef binaryNumberUtil %BINARYNUMBERUTIL A utility to deal with binary numbers % Number to bin and vice versa properties Property1 end methods (Static) function number = binaryNumberToDecimal(varargin) % binaryNumber(100) -> 4 %TODO: c...
%{ Copyright (c) 2017 Raghvendra V. Cowlagi. All rights reserved. Copyright notice: ================= No part of this work may be reproduced without the written permission of the copyright holder, except for non-profit and educational purposes under the provisions of Title 17, USC Section 107 of the United States Cop...
% Main entry function to program function [originalImages, alignedImages, error] = main(dir) % if nargin < 1 % dir = './Dynamic Thermographic Images/T0004/'; % end % Get images and matrices dataset = {readFiles(dir)}; originalImages = dataset; % Align images according to method ...
function freqs = FftShiftedFreqs(n, fs) % freqs = FftShiftedFreqs(n, fs) % % Returns the centered frequencies for an n-point DFT of a signal % sampled at a rate of FS Hz. freqs = (0:n-1)/n*fs; freqs(freqs>=fs/2) = freqs(freqs>=fs/2) - fs; freqs = fftshift(freqs);
f = imread('images/image1.jpg'); s1 = 100; s2 = 170; % 默认处理 g = enhance(f, s1, s2); % 同时增大S1, S2 g1 = enhance(f, s1+30, s2+30); % 同时减小S1,S2 g2 = enhance(f, s1-30, s2-30); % 增大S1,减小S2 g3 = enhance(f, s1+30, s2-30); % 减小S1,增大S2 g4 = enhance(f, s1-30, s2+30); figure; subplot(2, 3, 1); imshow(f); title(...
function Sim= computeSim( data, NoCate, Ci, Cj) %data: data matrix, row wise Nx F %NoCate: number of Categorical feature %Ci, Cj: 2 clusters to compute the similarity [N F] = size( data); %%%%Categorical part SimCate = zeros(NoCate,1); for k=1: NoCate SimCate(k) = ComputeSimCate( data( Ci, k), data(Cj...
function [x, y, z, connections] = paths4mayaviConnectedPoints(paths) % for mayavi, to avoid creating large number of objects, virtually connect all fibers %% here we go % points' connections cumLengths = cumsum([paths(:).length]'); totalPointsNum = cumLengths(end); connections = (1:totalPointsNum)'; selection = true(...
function G = mkGraphSymmetric(G) % Ensure G(i,j) and G(j,i) are both either zero or non zero % If the graph is weighted, the weights can be different in each direction % eg G = [0 2 1; % 1 0 0; % 0 0 0], % mkGraphSymmetric(G) returns % [0 2 1; % 1 0 0; % 1 0 0] % add edge a...
function dst = ZeroRunDec_EoB(src, EoB) % Function Name : ZeroRunDec1.m zero run level decoder % Input : src (zero run encoded sequence 1xM with EoB sign in the end) % EoB (end of block sign) % % Output : dst (reconstructed single zig-zag scanned block 1x64) src_len = length(src);...
function [ diffBook, print_str ] = calc_diff_of_books(book_standard, book_compare, rate, printstyle) % 计算两本Book的差值 standard基准名称 compare对比名称 rate:compare相对于standard比率,输出两本Book之差 % 计算规则: book_standard * rate - book_compare %1,standard内有的资产,compare无,数量:standard * rate 多空同standard %2,standard内有的资产,compare拥有,多空方向相同,计算之差 数量:...
function VariedChanVsDAC(figh,DAC,VariedChan) % When DAC is monaural, it checks if the varied ear is recorded and informs % the user. % By Gowtham 8/9/20 DAC=upper(DAC); VariedChan=upper(VariedChan); if ~strcmp(DAC(1),'B') if ~contains(DAC,VariedChan) % Includes Right/Left and Ipsi/Contra GUImessage(fi...
function plotTimeSeries(signal, fs) % % DESCRIPTION: % A simple function to encapsulate the logic of plotting a time plotTimeSeries % % OUTPUTS: None % % INPUTS: % signal: the time series signal to plot % fs: the sampling rate of the provided time series signal plot( (0 : numel...
function [ps,ix] = dpsimplify (p,tol) %MYDSIMPLIFY Simplify a sequence given the tolerance parameter using the %Ramer–Douglas–Peucker simplification algorithm. % Detailed explanation goes here ixe = size(p,1); ixs = 1; % logical vector for the vertices to be retained I = true(ixe,1); % call re...
A = csvread('STSwoWeight.csv',4,0); AxisAngleA = A(:,1); % local AxisAngleX = A(:,2); % local AxisAngleY = A(:,3); % local AxisAngleZ = A(:,4); % local CH1 = A(:,5); % mVolts CH2 = A(:,7); % mVolts GyroX = A(:,15); % deg/sec* GyroY = A(:,17); % deg/sec* GyroZ = A(:,19); % deg/sec* AccelX = A(:,21); % m/(sec^2)* AccelY ...