text
stringlengths
8
6.12M
function [B,Coef,Res]=PLS(X,Y,k) % this function performs partial least squerres regression % % [B,Coef,Res]=PLS(X,Y,k,option) % % X:predictor % Y:responce % k:the number of components if ~exist('k','var') k=1; end % size [n,p]=size(X); [~,q]=size(Y); % set parameter MaxItr=1000; tol=1e-8; T=zeros(n,k); U=zero...
%Ejercicio4 x= 0; while (x~=10) x = x + 0.5 end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2013 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:/...
cd('C:\shared\eeg_badger\russ') ; ls ; clear all ; close all ; %filenames = {'Retino_angles_2.vhdr','Retino_angles_3.vhdr','Retino_angles_4.vhdr','Retino_angles_5.vhdr','Retino_angles_6.vhdr','Retino_polar_1.vhdr','rest.vhdr'} ; for fname = 1:length(filenames) EEG = pop_loadbv('.',filenames{fname}) ; E...
function getFiles() %pds.eyelink.getFiles transfer from from eyelink to this machine % % jk wrote it 2014 prevDir=cd; p=pldaps; datadir = p.trial.pldaps.dirs.data; cd(datadir) [files, dirs]=uigetfile('*.PDS','Choose PDS files to get EDF files for','MultiSelect','on'); nfiles=length(files); if(~iscell(files)) ...
% Digital Signal Processing Toolbox % Version 0.1 % % Signal flow graph manipulation % sortsfg - Sort SFG in computational order % addoperand - Add operand to SFG % insertoperand - Inserts operand (with one input and one output) into SFG % replacemac - Replace MAC with multiply and add % flat...
function result = mnthetan( u, m) %MNTHN Neville theta function N result = nthetan( u, melnome(m)); end
function [ substitutionMap, clusterAssignmentMap, unseenWords, nns, dist] = substituteUnknownWords(V, query_V, ref_V, ref_F, clusters, clusterWordMap, varargin ) substitutionMap = containers.Map(); clusterAssignmentMap = containers.Map(); nns = []; dist = []; assert(size(clusters,1) == size(ref_V,1)); assert(size(clu...
function placeIntoFolders(targetfolder) %run on Sample# subfolder from Micromanager on M1 or M2 to collate acquisitions by field of view if nargin<1 targetfolder = uigetdir() end cd(targetfolder) separate_samples=1; %place into separate SampleX folders instead of fields in Sample1 filegrouping = 1; %fluo...
clear ;%spatial high pass filters Image=rgb2gray(imread('coins.jpg')); laplaceT=[0 1 0;1 -4 1;0 1 0]; ident=[0 0 0;0 1 0;0 0 0]; Image2=imfilter(Image,laplaceT); subplot(3,2,1); imshow(Image);title('Original image'); subplot(3,2,2); imshow(Image2);title('Image after laplacian masking'); sharp=ident-laplaceT; Image3=imf...
function [output1] = p_LeftRotationJoint(var1) if coder.target('MATLAB') [output1] = p_LeftRotationJoint_mex(var1); else coder.cinclude('p_LeftRotationJoint_src.h'); output1 = zeros(3, 1); coder.ceval('p_LeftRotationJoint_src' ... ,coder.wref(output...
function det_p = p1_lamel(euler_angle) i3=2; for i1=1:1:size(euler_angle,1) neg = (-1)^i3; dummy7=1; for p =-0.5:0.0001:0.5 strain_external = [1 (p*neg) 0;(p*neg) 0 0;0 0 -1]; g_mat = Euler_to_gmat(euler_angle(i1,:)); s_in= g_mat*strain_external*g_mat'; for counter1=1:1:56 % Calculating m ...
function tau = dtauint(z, pp, om, omb, omt, h) % calculates the integrant for integration of the optical length dtau over the redshift z % dtau in Mpc^-1 is extracted from interpolation in a table which has been splined. % pp is the spline of the interpolation for tau values as f of the redshift in this table. % f...
function [M_00,M_10,M_01,M_11,M_20,M_02,Area] = region_properties(height,width,output_connect2) %a. zeroth-, first- and second-order moments and central moments. %b. Area of the region (just count the number of pixels in the region). level=[10 40 70 100 130 160]; %level=[20 60 130 170 210 240]; M_00=[]; M_10=[]; M_0...
function [K,R,t] = getcparams(C) % decompose projection matrix into a intrinsic parameters (K) and extrinsic % parameters (rotation R and translation t) % % © Copyright Phil Tresadern, University of Oxford, 2006 % RQ decomposition of projection matrix [K,R] = rq(C(1:3,1:3)); % ensure that f and alpha*f are both posit...
function [RevPath,count,noway]=DIJKSTRAv3(NodeMap,start,A) Distance=ones(1,64); Distance=Distance*9999; Visit=(1:64); Parent=zeros(1,64); NodePointer=0; %Current Node Flag=1; RevPath=[1:64]*0; c=1; count=1; noway=1; Distance(start)=0; NodePointer=start; while (noway==1) ...
close all; clear all; %[filename, permission, machineformat, encoding] = fopen('cfg_alex.cfg','w+'); fileID = fopen('.\MAC_CITY\cfg_alex88.cfg','w+'); for iij = 1:70 fprintf(fileID, '-'); end fprintf(fileID, '\n'); fprintf(fileID, 'This is the header with the name of the structure \n'); fprintf(fi...
function popstats(ntrials) clf rand('state',0) maxpop = 40; pfinal = zeros(maxpop,1); m = 1; for k = 1:ntrials, p = pop(2); finalp = p(end); if (finalp < maxpop) pfinal(p(end)+1) = pfinal(p(end)+1)+1; end if (mod(k,m) == 0) bar(0:maxpop-1,100*pfinal/k,.6) set(gca,'XLim',[-1 ...
% Script which plots various results from fall2015Data % % Transform wavespeed to inverse wavespeed % for i =1:9 % fall2015Data(i).FishParameters(4,:) = 1./fall2015Data(i).FishParameters(4,:); % end % % %% Transform amplitude to the correct units % fps = 5; % micronsPerPixel = 0.325; % for i =1:9 % fall2015Da...
function [cells, rpts] = groupPoints(pts, cellSize) % Groups points into cubes in 3D space. % Parameters: % pts - matrix of points [x y z] % cellSize - cube edge length % Returns: % cells - describes cells allocation; vector: % xstart ystart zstart xend yend zend firstPointIx lastPointIx % where: xstart ...
function call_price=american_call_baw(S, X, r, b, sigma, time, accuracy) %-------------------------------------------------------------------------- % % DESCRIPTION: % % Barone-Adesi and Whaley (1987) quadratic approximation to the price % of a call option. % % % Reference: % % Giovanni Barone-Adesi...
function [omega, Phi] = ... RBME(K_free, M_free, X, R, kappaPts, varargin) % THIS FUNCTION NEEDS TO BE TESTED (recently updated to simplify input and % code itself, but it probably doesn't run yet) % Reduced Bloch Mode Expansion dispersion computation code % Dimitri Krattiger % 1-27-2014 % input...
close all; clear all; % Choose Images to run the code on img1 = imread('brain1.png'); img2 = imread('brain2.png'); % img1 = imresize(img1,0.3); % img2 = imresize(img2,0.3); % Storing the original images for reference im1 = img1; im2 = img2; %Calculate the Grayscale values of the image if size(img1,3)==3 img1 ...
function [t,y] = euler_implicit_linear_khan(fun,jacob,tstop,dt,y0,u) nsteps=round(tstop/dt)+1; npar=length(y0); y=zeros(nsteps,npar); t=zeros(nsteps,1); y(1,:)=y0; t(1)=0; atol=1e-8; rtol=1e-4; for i=1:nsteps-1 fofy=fun(t(i),y(i,:),u); yi=y(i,:)'; Xj=yi+fofy'*dt; t(i+1)=t(i)+dt; % netwo...
function model = MFA_train(trainfilename, conf) % ******************************************************** % Input: % % trainfilename: the file which contains the name of training trials. % % conf: configure parameters. conf is a struct with following fields. % % conf.datapath: the path to the folder that saves kinema...
function [qwip, abs_qwip] = qwip_score(rrs,rrs_wave) % ------------ % qwip_score.m % ------------ % Written by K. J. Turner, Tzortziou Bio-Optics Lab, City College of New % York % Last updated: June 8, 2022 % ------------------------------------------------------------------------- % This function calculates the Qualit...
function axs = tile_area(N, varargin) % Tile the area with N tiles. % Arguments: % N - number of tiles, if a scalar, optimal ratio between rows and columns % is calculated from screen dimensions. % % Name/Value Arguments: % area - a rectangle with (blx, bly, width, height). (blx/y = bottom left % x/y). d...
%% Commercial Motor Model % Brad MacNeil 01/04/2015 % This document details all the parameters that were measured to model the % motor that was built of EECE 380. The tests used to measure the given % parameters are detailed in MotorTesting.m The parameters measured include: % Armature Resistance, Armature Inductance...
function cancel_test() % Save nothing display('Current Test Discarded'); end
function pcomb = stouffer(p) % Stouffer et al's (1949) unweighted method for combination of % independent p-values via z's if isempty(p) pcomb = 1; elseif(numel(p) ==1) pcomb = p; else pcomb = 1-normpdf(sum(norminv(1-p)) / sqrt(numel(p))); % pcomb = (1-erf(s...
% % f(i,j)=x(i,j)*sin(.5*x(i,j))-y(i,j)*sin(.5*y(i,j)) % for x in [-3,3] and y in [-4,4]. % %CLEARING %clears all the previous data %clears all previously made functions clear; clf; % DECLARATIONS % create an array from 0-50 of zeros to populate, for x,y,and f % m=51; n=51; x=zeros(m,n); y=zeros(m,n); f=zeros(m,n); dx...
% Name: Nikki Wines % Wustlkey: catherinewines % Assignment: Homework 2 % Due Date: September 21st, 2015 %The answers to all problems should be placed in this file. If you are %asked to write a function, put the commands testing your function in this %file. Use comments to describe each Problem in one or two sente...
function interface( fileName, scale ) au = cell(1,length(fileName)); maxLength = 0; disp('Processing ...') noInclude = []; for i = 1 : length(fileName) disp([num2str(i) ' / ' num2str(length(fileName))]) wObj = waveFile2obj(['../media/' fileName{i}]); wObj.signal = mean(wObj.signal,2); if strcmp(scale{i...
%% MyMainScript tic; % Training N = 32*6; d = 112*92; X = zeros(d, N); % Matrix of all the images d x N x_bar = zeros(d, 1); % Average image d x 1 cd ../../..; % This is the location where we placed the Image Dataset for i=1:32 D = strcat('./ORL/s',int2str(i)); S = dir(fullfile(D,'*.pgm')); for j=1:6 ...
clc clear all close all %Section 4.3: Problem 6 %a.) %Rx=Q'b A = [3 -1 2; 4 1 0; -3 2 1; 1 1 5; -2 0 3]; b = [10; 10; -5; 15; 0]; [Q,R] = qr(A); t0 = Q'*b; t0 = t0(1:3,:); R = R(1:3,1:3); xbar = R\t0; r = b - A*xbar; error = sqrt(sum(r.^2)); disp('The least squares solution is'); xbar disp('The two-norm error is'); e...
function F = obj_actuator_freq_resp_param(x,amplitude_40, frequency_40, amplitude_100, frequency_100) % Computes objective function for determination of basic parameters of % the proportional valve actuator that match the required frequency % response. The frequency response of a nonlinear system is obtained by % usi...
function result = u(time) %u %Inputs: %time: The vector which contains the time-points of the simulation. % %return: %result: The given function *here 5sin(t)+10.5* evaluates at the % time-points, specified at vector time % result = 5 * sin(2 * time) + 10.5;
function [ d ] = edist( x , y ) %edist euclidean distance between two vectors d = sqrt( sum( (x-y).^2,2 ) );
function [x,functionParams,params,l,u] = gen_case_1(N,T) %Generate data to be used for optimization %Input: N - number of wells, T - number of time steps %Output: x - vector of variables to be optimized % functionParams - mu and lambda for AL method % params - array of values for constants % l - lo...
% proccesing raw data % find (ctrl+F) NOTICE before proccessing % Not used clear; addpath F:\IEEE_SENSORS_J\GestureCode\dataset\train addpath f:\IEEE_SENSORS_J\GestureCode\dataset\test %% load raw data % NOTICE: data format: % [time ax ay az gx gy gz] load CWV.txt; test=CWV; len=size(test,2); %% coordin...
function [ combined, newblue ] = process( input_name ) %UNTITLED Summary of this function goes here % Detailed explanation goes here close all; imin = normalize(input_name); mask = imread('mask.jpg'); red = imin(:,:,1); red(mask < 255) = 0; green = imin(:,:,2); green(mask < 255) = 0; ...
%Temperature Distribution this will be temperature Distribution function function [maxDie,tempDist]= TempSolver(Uinf,Tamb,delx,eGenAverage,meshSize) %CPU parameters W = 55; L = 75; R = W/L; k = 173; H = 1; %this should come from main TdieMax = 68; %degrees celcius %Properties of H20 mu = 8.5288e-4; %Dynamic Viscoc...
function [H,pL,pU, Cohens_d, theta_CI] = my_TOST(ref,test,vars) %[H] = my_TOST(ref,test,vars) % Input % ref is vector of reference observations % test is a vector of test observations % vars contains all the side settings % vars.alpha is the confidence level. Default: 0.05 % vars.theta is t...
function varargout = bash(input) output = dos(['"C:\Program Files\Git\bin\sh.exe" --login -i -c',' "',input,'"']); if nargout > 0 varargout{1} = output; end
function yp = periodogram(y,frameSize) for k=1 : frameSize yp(k)= (abs(y(k))**2)/frameSize; end yp;
% --------------------------------------------------------------------- % Book: SFS % --------------------------------------------------------------------- % Quantlet: SFStailGPareto % --------------------------------------------------------------------- % Description: SFStailGPareto estimates the paramete...
% load training load dummy_train_data % load query load dummy_test_data [X_train,y_train] = data_transform_regression(train_data,'query'); [X_test,y_test] = data_transform_regression(test_data,'query'); [y_pred,beta] = linear_regression(X_train,y_train,X_test,1); fprintf('RMSE: %f\n',rms(y_pred-y_test));
% read in uncombined magnitude and phase images path_mag = '/gpfs/M2Scratch/NCIgb5/hongfu/SPECIMAN/1.10.1/1.10.1.344/1.10.1.344.1.2/1.10.1.344.1.2.7/dicom_series'; path_ph = '/gpfs/M2Scratch/NCIgb5/hongfu/SPECIMAN/1.10.1/1.10.1.344/1.10.1.344.1.2/1.10.1.344.1.2.8/dicom_series'; path_out = '/home/hongfu/NCIgb5_scratch/h...
% clc; % clear all; % close all; % % load Target138.mat; % load Breast138_morph11_auto_new.mat; % load PC_LBPV138_8ori_6scale_r2p16.mat % load ./BUS 138/GAresult_gen30_fun1_4; %GA_mRMR结果 % load ./BUS 138/GAresult_gen30_fun0_1; %GA结果 function [AUC,ACC,SENS,SPEC,PPV,NPV,MCC] = libsvm_LOOCV(feature_input, label_target,g...
function predData = msd_calc_pred_data(pars,nTarg,nLure,output) % usage: % predData = msd_calc_pred_data(pars,nTarg,nLure,output) % % MSD_CALC_PREDICTED_DATA returns the predicted frequencies, proportions, % cumulative proportions, and z-values for the MSD model with a % given set of parameters and criterion locati...
function Cons = generate_rand_triplets(label, nbCons) fprintf('Creating %d random triplets\n',nbCons); n = length(label); Cons = zeros(3,nbCons); for i=1:nbCons idx1 = randi(n); idxPos = find(label == label(idx1)); idx2 = randsample(idxPos,1); idxNeg = find(label ~= label(idx1)); idx3 = randsampl...
function MCplotStimRasterPlot(experiment,stimulusType,StimArea,channels) parameters=get_parameters; Path=get_path; if strcmp(StimArea, 'HP') chan=1:16; elseif strcmp(StimArea, 'PFCL2') chan=17:24; elseif strcmp(StimArea, 'PFCL5') chan=25:32; end if isnumeric(channels) csc=channels; else [csc,~,~]...
%% Extracts timecourses from vertices within an ROI mask image, whole brain or virtual electrodes % Alex C (10/2012) % Modifications Ece K (10/2015) % General variable setup %addpath('/work/imaging8/MEG/bananas_2015_EK/scripts/NIfTI_20140122/'); addpath /imaging/local/meg_misc/ addpath /hpc-software/matlab/cbu/; clea...
function dut=cmsEnvelope(fcn,din) % Creates an envelope from a cell array of distributions % % distut=cmsEnvelope(fcn,distin) % % Input % fcn - handle of envelop function, eg @max, @min % distin - cell array of input distributions % % Output % distout - cell array of output distributions % % Example: % cms...
mesh = HalfEdgeMesh.importOBJ('flower-pot/flower-pot.obj'); x_offset = 1.e-3; for i=1:mesh.nv mesh.v_traits(i).position = mesh.v_traits(i).position + x_offset; end v = mesh.allVertices().position(); e = mesh.allEdges().halfedge(); e = [e.from().ind; e.to().ind]; % % figure(10); % clf; % patch('Vertices',v','Faces...
function infostr = infoload(filename, varargin) %<<<1 % input possibilities: % filename % filename, autoextension % check inputs %<<<2 if ~(nargin==1 || nargin==2) print_usage() endif if nargin == 1 autoextension = 1; ...
function printMonth(numDays, startDay) fprintf(' SUN MON TUE WED THR FRI SAT\n') for n = 1:numDays+startDay if (n < startDay) fprintf('%4s', ' ') end if (n >= startDay) fprintf('%3d ', n - startDay + 1) end if (mod(n, 7) == 0) fprintf('\n') end end end
function [ ] = plot_2d_field(turbines, turbLoc, flowField, YawAngles) % Select the flowfield at hub height and accompanying x and y index if ndims(flowField.U) == 3 [~, ix] = min(abs(flowField.Z(1,1,:)-mean(turbLoc(:,3)))); UatHub = squeeze(flowField.U(:,:,ix)); xVec = squeeze(flowField....
function R = roty(theta) % ROTY Rotation matrix around y-axis. % % Other m-files required: none % Subfunctions: none % MAT-files required: none % % Author: Gabriel Moreira % email: gmoreira (at) isr.tecnico.ulisboa.pt % Website: https://www.github.com/gabmoreira/maks % Last revision: 14-July-2021 ...
function [] = algoritmo3(X,Nmax,e,lam,A,B) A1=A'*A; [n,m]=size(A1); for k=1:n suma1=0; for p=1:k-1 suma1=suma1+L(k,p)*u(p,k); end L(k,k)=sqrt(A1(k,k)-suma1); u(k,k)=L(k,k); for i=k+1:n suma2=0; for q=1:k-1 ...
% global INSTR; INSTR = {}; % INSTR.DAQ_V_P_Montana = {'Dev4', 1}; %% addpath(genpath('Z:\rishipat\InstrumentControl\InstrumentControl\')); addpath(genpath('Z:\rishipat\matlab_experiment_scripts')); addpath(genpath('Z:\rishipat\matlab_analysis_scripts')); addpath(genpath('Z:\wtjiang\measurements\helpers\...
clear all; close all; clc; N=1000; x=rand(1000,1); x=sort(x); hist(x,30); maxS=0; for k=1:N maxS=max(maxS, abs(k/N-x(k))); end maxS
%% VR -> Matlab clear; close all; w1 = vrworld('Layout_simple1.wrl'); open(w1); vrfig1 = vrfigure(w1, ... 'Name', 'Virtual world containing source IndexedFaceSet node', ... 'CameraBound', 'off', ... 'CameraPosition',[0 40 0], ... 'CameraDirection',[0 -1 0], ......
function viz_trajectory(P) K = length(P); %N = length(P{1}); %n = ceil(sqrt(T)); load('Warped_Sequences.mat'); tmp = seqs_warp{1}{1}; del_true = max(tmp(:,1))-min(tmp(:,1)); count = 0; for m = 1:K %s_short = sample_sequence(P(m),1); s_short = P(m); s = s_short{1}; N = length(s); for i...
function [ res ] = w_ni_u_v_integral( params, paramsP, grid,... tria_index, local_vertex_index, qdeg ) %W_NI_U_V_INTEGRAL Summary of this function goes here % Detailed explanation goes here f = @(llcoord) w_ni_u_v_local( llcoord, params, paramsP, grid,... tria_index, local_vertex_index ); res = 1/2 * interv...
function [file_ITPCA1,file_ITPCA2,file_PC1,file_PC2] = ITPCALine( varargin ) % ITPCA (Iterated Principal Component Analysis) : % It performs a calibration of the images based on the linear relation between them. The linear relation % is related to the first principal component. The use of a initial change mask can imp...
function Data = removeCrashesFromData(Data) % Remove crashes trialToRemove.ID = [3164, 3311, 662, 843, 1365, 1563, 2166, 2466, 2944 ,3011]; trialToRemove.task = [9, 35, 29, 22, 35 ,32 , 14, 35 ,35, 30]; Data = arrayfun(@(a)removeTrial(a, trialToRemove), Data, 'UniformOutput', false); Data = [Data{:}]; end function a...
function O = map(Z, D, R) %MAP maps the Z from domain "D" to range "R". % % O=map(Z): rearange Z from domain unique(Z) to range 1:length(unique(Z)) % O=map(Z, D, R): rearanges Z from domain D to range R. % % Example % ------- % Z = [1 3 3 7] % O = map(Z) % returns [1 2 2...
close all clear all subject = 'RGcomb' switch subject case 'RG1' pa_datadir JR-RG2-2012-02-22 load JR-RG2-2012-02-22-0001 SupSac = pa_supersac(Sac,Stim,2,1); case 'RG2' ...
% Copyright (c) 2017 Zi Wang % This function is partially adapted from the code for the paper % Hernández-Lobato J. M., Hoffman M. W. and Ghahramani Z. % Predictive Entropy Search for Efficient Global Optimization of Black-box % Functions, In NIPS, 2014. % https://bitbucket.org/jmh233/codepesnips2014 function results =...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2010 - 2015 Moon Express, Inc. % All Rights Reserved. % % PROPRIETARY DATA NOTICE: % The data herein include Proprietary Data and are restricted under the % Data Rights provisions of Lunar CATALYST Space Act Agreement % No. SAAM ID#...
% Program to solve the integral equation. clear all close all format long % Declaring symbolic variables syms y t % Parameters in the problem. a = 2; L = 1; M = 1; n = 2; O = 1; N = 2; %Degree of approximation h = (2*a/N); x = -a:h:a; % Collocation points x1 = -a:0.01:a; % To plot the profile T = sym(zeros(N+2,1)); % C...
function [arruu, arrvv, arrhu, arrhv] = newarrow3(x,y,u,v) %ive stolen all this coded from quiver.m - AJ % essentially it does the same but just doesnt plot the results % this then gets passed out for replotting in the main code % Arrow head parameters % arrow length and arrow head can be altered here % arrow thickne...
function [template_corr] = calc_stimulus_corr(session_dir,runs,hemi,template,src_area,trg_area,cluster) % Calculates the correlation between stimulus cross-correlation matrix, and % a predicted cross-correlation matrix % % Usage: % [template_corr] = calc_stimulus_corr(session_dir,runs,hemi,template,src_area,trg_ar...
function b = sineSeries(f, L, n) % Computes n coefficents of the cosine expansion of f over [0, L]. x=L*(0:n)/n; h=f(x); h(1)=(h(1)+h(end))/2; b=2/n*dst(h(1:end-1)); end
clear all;clc; input_features = 26; %input feats for particular epoch min_input_features = 5 ; %min input feats pin = 0.80; penalty_factor1 = 1 - ((input_features-min_input_features)*pin); chide = 150; %total hidden nodes mhide = 50; %min hidden nodes phide = 0.4; penalty_factor2 = 1 - ((chide - mhide)*phide); i...
clear;clc;close all; empty_slots = 0; used_slots = 0; collision_slots = 0; counter = 0; for round=1:25 num_tag = 20; num_slot = 26; slot = zeros(1,num_slot); tmp = randi(num_slot,1,num_tag); for idx = 1:num_slot if sum(tmp==idx)==0 empty_slots = empty_slots+1; el...
function str = StrrepLikeRegexprep(str,tokens,replace) % STRREPLIKEREGEXPREP Replace string with another. % This function uses STRREP, but uses the input and output format of % REGEXPREP so it can be easily substituted. % % S = STRREPLIKEREGEXPREP(STRING,SEARCH,REPLACE) replaces all occurrences of % the t...
% Testing sigshift function disp(sigshift([1 2 3 4 5], 2));
function [hd] = function_hamming_distance(V1, V2) %% Hamming Distance as power model dist = bitxor(V1,V2); hd = reshape(sum(de2bi(dist),2), size(dist)); end
% set globals (used by ODE solver) global tspan; global Vv; global RR; global L; % set signal parameters endtime = 8*pi; fsteps = [1/80,1/60,1/40,1/20,1/10,1/5]; % stepsize = (1/10)*pi; % preallocate some storage g_stored = nan(length(fsteps),5); % TE_stored = struct(); % GC_stored = struct(); % PAI_stored = struct(...
function extractCoords(fileName) %EXTRACTCOORDS Run the perl script to extract a virus's xyz coordinates % %Syntax: % % ejovo.fn.extractCoords(fileName) % %Inputs: % % fileName - a .pdb file in the form of either xyz.full_'pdbid'.pdb (for % a full virus) or xyz.'pdbid'.pdb (for the au). % %Ex: % % ...
clear all ; close all ; subs = {'alex','dina','genevieve','jeremie','russell','tegan','valerie'}; scans = {'mc_retino_allstims_01','mc_retino_allstims_02','mc_retino_gamma_01','mc_retino_gamma_02','mc_retino_movie','mc_retino_rest'}; eegscans = {'retino*allstim*01*set','retino*allstim*02*set','retino*gamma*01*s...
function [ NN ] = backPropLearn( init, train,... n_epochs, alpha ) %BACKPROPLEARN Summary of this function goes here % Back propagation learning % init = initial struct % train = train struct % alpha = learning rate W = init.W; L = numel(W)+1; % Should be 3 for 1 hidden layer b = -1; % dat bias % Ac...
function [G, w, output] = GRBF_fix(input, target, sigma, mi) center = input(randperm(length(input)),:); center = center(1:mi,:); [G, w, output] = RBF_calculate(input, target, center, sigma);
function y = custom_fcn(x) y = 1./(1+exp(-x)); end
clear all; close all; %% Aircraft roll and course controller %% Constants % Transformations deg2rad = pi/180; rad2deg = 180/pi; % Aileron a1 = 2.87; a2 = -0.65; %% Controller design % PID for phi k_p_phi = -5/3; k_i_phi = 0; % Calculating K_d_phi: wp = sqrt(a2*k_p_phi); zp = 1; f_kd = @(zeta, wn) (2*zeta*wn - a...
function [GammaAngle,zAngle]=finalStep(phi,delta,H,tem,pre) %函数调用格式:[GammaAngle,zAngle]=FinalStep(phi,delta,H,tem,pre) %输出参数[方位角GammaAngle(°),天顶角zAngle(°)] %输入参数(纬度phi,赤纬delta,时角H,温度tem,压强pre) e0 = asin(sin(phi).*sin(delta)+cos(phi).*cos(delta).*cos(H)); %计算升角e0=arcsin(sinφsinδ+cosφcosδcosH),计算都要弧度 %计算Δpe应该是修...
function [bool] = IsIn_AntPoint(Arr_1,Arr_2,i,m) n = size(Arr_2,1); for j =1:m if i==j continue; end for k = 1:n if Arr_1(1,:) == Arr_2(k,:,j) bool = 1; return; end end end bool = 0; end
function Akaike_analysis3 % AKAIKE_ANALYSIS % % 2013 %% Cleansing clc; close all; clear all; %% Data stored @ cd('E:\DATA\Cortex\top-down paper data'); thorfiles = dir('thor*'); joefiles = dir('joe*'); files = [thorfiles' joefiles']; dspFlag = true; % dspFlag = false; %% Initialization...
clear clc close all path = 'sst.nc' %% lon = ncread(path, 'longitude') lat = ncread(path, 'latitude') sst = ncread(path, 'sst') %% lon_area = (lon >= -17 & lon <= 3) lat_area = (lat >= 48.5 & lat <= 63) lon = lon(lon_area) lat = lat(lat_area) sst = sst(lon_area, lat_area, length(sst)-50*12+1 : length(sst)) %% [X...
function [lost assignment femtoquota cascade chains candidate_num]=college_mobi(dis,radius,quota,assign_topo,in_thre,out_thre,o_femtoquota,speed) %dis,( femto * user ) disind=(dis<=radius); dis=dis.*disind+1000.*(1-disind); numuser=size(dis,2); numfemto=size(dis,1); %size的参数,1是行数,2是列数 assignment=assign_topo; ol...
function [mask_reg_labeled, P_color]=as_reg_mask(mask,img) % For a given mask & an image, the function finds the registration between % the two. The outputs are the registered & labeled mask (each region of % the mask has a different label according to the labeling done by the % user. The second output is the color vec...
function analyse_harm( directory, F0, wid, thr, len, nf ) % %function analyse_harm( directory [, F0, wid, thr, len, nf ] ) % % Le repertoire 'directory' doit contenir les fichiers %au format wav a analyser. Dans un premier temps, le %repertoire sera prepare grace a PREPARE_DIR, sauf si le %sous-repertoire '...
close all finalIndex = 100; deltaT = 0.05; Q = eye(3); F = 1000*eye(3); R = eye(2); %what you measure is just x and y C = [1 0 0; 0 1 0; 0 0 0]; %standard deviation for the two covariance matrices sigmaV = .01; sigmaW = .1; %Initial x and xhat x = cell(finalIndex,1); %The values are the difference between x and the ...
function [M,S,mean_value] = factorize(measurement_matrix_sub, width_S) %INPUT % portion of the measurement matrix % %OUTPUT % an image showing the points in their estimated 3-dimensional position, % where the yellow dots are the ground truth and the pink dots the tracked % points from the LKtracker %- M: The tr...
function [v,k] = kalmanBest(Aw,Mw,fs) % % [v,k] = kalmanBest(Aw,Mw,fs) % Estimate a smooth depth and depth rate to fit the observed depth, p, in m. % sampled at rate fs, Hz. Process is a 2-state Kalman % filter estimating vertical rate and depth, followed by a Rauch smoother. % Output: % v ...
function [ output_args ] = fullsearch(params, lb, up, step, kernel_type) trn = dlmread('data/rs_train5_no_headers_mini.txt'); tst = dlmread('data/rs_test5_no_headers_mini.txt'); min = Inf; switch kernel_type case 'hiperbolic' min_fun = @(p) svmsa(trn(:, 1:trn_c - 1), trn(:...
function neighbors=getneighborsU(X,K); ne=getneighbors(X,K); [D N]=size(X); for i=1:N neighbors{i}=[]; end; for i=1:N neighbors{i}=merge(sort(neighbors{i}),sort(ne(:,i))); for j=1:K neighbors{ne(j,i)}=merge(neighbors{ne(j,i)}, i); end; end;
function [surround_idx] = getKxKRegionMask(data, idx, k) % data: whole matrix % idx, idx of center pixel % k: kxk region % return index of kxk region EXCEPT center %maskdata at first data(idx) = -inf; padded = padarray(data, [size(data, 1) size(data, 2)], inf); s = size(padded); N = length(s); [c1{1:N}] = ndgrid(1:...