text
stringlengths
8
6.12M
function [SOIT,SSOIT,FOSIT,FOSPT,FODPT,FOAT1,FOAT2,SONT,SONTsqrt] = rmtens(struhyp,ntens) % Tensorial operators (en notaci๓n de Voight) %global SOIT SSOIT FOSIT FOSPT FODPT FOAT1 FOAT2 SONT struhyp ntens % Second order identity tensor % จจจจจจจจจจจจจจจจจจจจจจจจจจจจ SOIT = [1 1 1 0 0 0]';...
clear all close all clc %data input GM=398600.44; w_earth=2*pi()/86164; data=load('data.txt'); data(1,3:5)= data(1,3:5)*pi()/180; M = 64.0942*pi/180; Eo = M; E(1)=M+data(1,2)*sin(Eo); for k=1:50 E(k+1)=M+data(1,2)*sin(E(k)); if abs(E(k+1)-E(k))<10e-8 break end end Ec_rad = E(:,end); K=[cos(data...
function [DATA, params, FN, nSpikes, Vstr, Zscores,Vstr_list,Zscores_list] = read_data3_minus_spont(dataFN,dataPATH, frame, pflag, flag1, repflag) % function [DATA, params, FN, nSpikes, Vstr, Zscores,Vstr_list,Zscores_list] = read_data3_minus_spont(dataFN,dataPATH,frame,pflag,flag1,repflag); % % to read data creat...
function analyse_links_file % Creates the file "links-simple-sorted.txt", using the file % "links-simple-matlab.txt" created by convert_links_file.m % % Henry Haselgrove, January 2009. load params num_pages load link_param num_links global titles_sorted if ~exist('titles_sorted','var') load sorted_...
function [dados] = extrai_haralick(img,mask,janela) % Projeto CINAPCE % % Calcula os paramentros de textura da imagem de hipocampo % %janela = 9; indices = find(mask ~= 0); len = length(indices); nErros = 0; struct = incializa_ed(len); for t=1:len try w = getwindow(indices(t),img,janela); catch ...
function d = getInfo(filename) %GETINFO Loads all the fields for a single Amdar file, prints info. % This method to provide a means for exploring available data fields, % identifying units, and reading other metadata associated with the file. % %SYNTAX: % d = Amdar.getInfo(filename) % %INPUT: % filenames - Cell ar...
function [Pl] = PL_PM_to_PPM(P, mode) % compute the Plucker projection matrix from a standard projection matrix % as in Bartoli, Sturm. Only mode == 0 is supported currently. if (~exist('mode', 'var')) mode = 0; end if (mode==0) % bartoli-sturm Pbar = P(1:3,1:3); p = P(1:3, 4); Pl = [det(Pbar)*inv(Pbar)' skew(p)*...
function c=movie_maker2(g) m=length(g(1,1,:)); b=uint8(zeros(144,435,m)); c=struct('cdata', b,'colormap',[]); for i=1:m pcolor(g(:,:,i)); shading flat colormap(gray) c(i)=getframe; end
mex mexTest.cpp numbers = mexTest(15);
%% combine all final models for face system analysis clear; % combine them into one file! finalModel{1} = load('finalModels_wholeBrain.mat'); finalModel{2} = load('finalModels_noFace.mat'); finalModel{3} = load('finalModels_faceOnly.mat');
% Es 7 % Generate g(n) as a set of 10000 realizations of random variables distrubted as ~ N(0, 1). % Compute the mean and the variance % Create h(n) = a * g(n) + b, with a = 0.5; b = 4. % Is h(n) still a Gaussian random variable? % Compute the mean and the variance of h(n). close all clearvars clc %% parameters N =...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Technische Universität Berlin % Fakultät Verkehrs- und Maschinensystem % Fachgbiet Kraffahrzeuge % M.Sc. Osama Al-Saidi % % Fahrzeugregelung: Projekt - ESP WS16/17 % File: Parameter Sinusfahrt % Datum: 28.12.2016 % %%%%%%%%%%%%...
%2020.7.30-- %子函数,输出前提项Item和结论项<Item,s>的支持度 %输入:Class_set-1*M cell,类标签集合, s--对应Class_set中的哪一个类别 % Label_mass--N*2cell, 每个训练样本的软标签以及对应的Mass值 function [Sup_item,Sup_ruleitem]=Support_Ruleitem(itemset,Data,Class_set,s,Label_mass) N=length(Data); %表示的是训练样本的个数 Matching_degree=zeros(1,N); Sup_item=0; Sup_ru...
% CMPU250 - Professor Eric Aaron % HW2 - Kyle Patterson % April 2018 % #################################################################### % ### ### % # ...
% This script draws the theta-direction EXB and electron diamagnetic velocities % versus time % Copy this script to the folder of the data and then run it clear; close all; global den Te pe vi jz ve phi vEx vEy vdex vdey dt inv_nustar calc ddx %% load('parameters.mat'); addpath(code_path) last_file = get_last_fil...
function [frequences_triees,indices_frequences_triees] = tri(selection_frequences) %TRI Summary of this function goes here % Detailed explanation goes here [frequences_triees indices_frequences_triees]=sort(selection_frequences, 'descend'); end
function [ vals ] = gen_small_peaks ( len, n_peaks, sigma_mod ) % can be negative vals = zeros(1, len); for i = 1:n_peaks peak = sign(randn()) * normpdf((1:len), randi(len), sigma_mod * (1 + abs(randn()))); % multiply random by s.d. vals = vals + peak; end %standarize vals = vals / m...
function link_next_versus = enfrentar_marcadores_multiples(N1,N2,N3,marker_versus,link_prev_versus,d3) marker_versus = marker_versus(link_prev_versus>0); link_prev_versus = link_prev_versus(link_prev_versus>0); trayectorias_versus = []; for i=1:length(marker_versus) if nargin>5 ...
%Titus John %Leventhal Lab, University of Michigan %2/8/2016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %This script will shoot out the plots for a given rat and produce %comparison for the fine reaching analysis after the trajectory analys %ihaws been completed %Will compoare the traje...
function evaluateConfig(config) disp("--Config--") disp(["Sampling Count: ", config.samplingCount]); % 0 - Import all images disp(["Balance Data: ", config.balanceData]); disp(["Pre-processing?: ", config.prepro]); if config.prepro == 1 disp(["Pre-processing method: ",config.preproMethod]); end disp(["Feature Extra...
clear all close all % Specify data subdir dataDir = 'data/'; LabelFiles; fprintf('Loading dataset...'); % Label data according to spoken digit data = audioDatastore(dataDir, 'IncludeSubfolder', true, 'LabelSource','foldernames'); % Split data into train and test data ( 80/20 - train/test split ) [trainData, testD...
% DEMOSCEN は、 Wavelet Toolbox で、ウェーブレットの代表的な1次元ウェー % ブレットのシナリオのデモを行います。 % DEMOSCEN は、Short 1次元 シナリオのデモを行います。 % % DEMOSCEN('auto') は、Short 1次元 シナリオのデモを自動実行モードで行い % ます。 % % DEMOSCEN('loop') は、Short 1次元 シナリオのデモをループモードで行いま % す。 % Copyright 1995-2003 The MathWorks, Inc.
%% Plot Script % Plots Graphs of Demand and Production on ceratain days format compact format bank % Script is meant to be run after LoadData % Demand and totalProd will be defined demand=Demand; production=totalProd; % Input time frame to analyze % Calculates time interval Domain for February 2, 2014 startInd...
function f = GP_LCB(x, da) %calculate the lower confidence bound function with given data set in da %x is a vector for a new point %da contains all evaluated data % Xmat, all points in its columns % invKmat, = inv(Kmat+sig^2*I) % %created by X. Huang, 1/18/2019 %this is for minimization problem % if 0 nu=1; del...
function [ct] = how_many ( prefix, x, ct_f ) % init ctr ct = zeros ( 1, numel ( ct_f ) ); % for all frames to count for i = 1:numel(ct_f) % read image and convert to gray fileName = sprintf('%s%05d.png', prefix, ct_f(i)); input_im = rgb2gray ( imread(fileName) ); input_im = imadjust(input_im); ...
% test EVB (Enhanced Variational Bayes) clear all; clc; %% Generate data from linear model % param are the natural parameters N = 100; % Number of observations M = 10; % Number of parameters [y param] = generateDataLinear(M, N); param.post = {}; %% configuration conf.MaxIter = 500; conf.alpha = 0.01; % learning...
function population = InsertBestIndividual(population, best, copies) for i = 1:copies population(i,:) = best; end end
function Store(dataObject, varargin) %STORE - Saves a data object to the hard drive. % This function creates two standard MAT files (.mat) representing a human data object on the hard drive. Both files % are stored either at the user-specified location or, by default, wherever the current working path is. % % ...
%% Load the data matrices %main; load('gamma10.mat'); load('normal10.mat'); load('lognormal10.mat'); %% Which is a better distribution for each gene? %we answer that by calculating the median of scores in each column(struct %field) and comparing the three distributions. %also, when we answer that question, we might ...
function J = computeCost(X, y, theta) %COMPUTECOST Compute cost for linear regression % J = COMPUTECOST(X, y, theta) computes the cost of using theta as the % parameter for linear regression to fit the data points in X and y % Initialize some useful values m = length(y); % number of training examples % You need to...
function arch = PACK_sats2arch(sats) % PACK_sats2arch.m % Example: % sats{1} = [1,2,3,7]; % sats{2} = [4,5,6,8]; % sats{3} = [9]; % arch = PACK_sats2arch(sats) % arch = [1,1,1,2,2,2,1,2,3] nsats = length(sats); ninstr = sum(cellfun(@length,sats)); arch = zeros(1,ninstr); for i = 1:nsats sat = sats{i}; arch(sa...
function [xc,d,MTX,para] = InvM(MTX,para,x0) % [xc,d,MTX] = InvMainN(MTX,para,x0) % %% Approximate Unconstrained Gauss-Newton with Armijo rule line search % % Input: MTX = Structure of global (see generateMTX) % para = parameter structure % x0 = initial iterate % % Output: xc = solution % ...
function [sol, z]=MyCost(model,q) %% NFE global NFE; if isempty(NFE) NFE=0; end NFE=NFE+1; %% Run Topsis sol=TOPSIS(model, q); pause(0.05); %% Run Simio and get the results %z=[rand*1000 rand*20 rand]'; F=RunSimio(); z=[F(1).z ,F(2).z, F(4).z]'; end
function [ matConf, txCat ] = multiClassprediction( predictionclassifieurs, yGtest, imCatTest ) %MULTICLASSPREDICTION Summary of this function goes here % Detailed explanation goes here % for i=1:size(imCatTest) % for j=imCatTest(i):size(yGtest,2) % yGtest(i,j)=0; % end % end txCat=zeros(size(...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This learns the discriminative patch svm in the method from "Unsupervised % Discovery of Discriminative Patches" Singh et al. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % the inputs should all be structs w...
function mutatedChromosome = Mutate(chromosome, mutationProbability) chromosomeLength = length(chromosome); mutatedChromosome = chromosome; creepRate = 0.1; for iGene = 1:chromosomeLength r = rand; if (r < mutationProbability) %q = rand; mutatedChromosome(iGene) = rand; %mutatedChro...
function FrzData=FindFreezing2(VelData,FPS,ThreshC) % ThreshC=Thresh; FragThresh=FPS*0; AllBouts=cell(size(VelData,1),1); for k=1:size(VelData,1) Input=VelData{k}; dInput=(sign(Input(:,:,1)-ThreshC)); % sign of Input - ThreshC ... will be 2 at + crossings, -2 at - crossings, 0 otherwise for i=1:size(dInput...
xx = x'; zz = z'; plot(xx,zz,'.') len = length(xx); xx(len+1) = xx(1); zz(len+1) = zz(1); k = boundary(xx,zz);% generate boundary of data points. %this is index of all point located in the boundary hold on; plot(xx(k),zz(k)); X=xx(k);Y=zz(k);%return the original x,y coordinate corresponding to each index k ...
%clear all hold on polytype = load("../data/EPAPolytypeEdges.m"); nCol = size(polytype,2); nRow = size(polytype,1); div = find(polytype(:,1) < 0); border = 0.4; camup([0 1 0]) grid on pbaspect([1 1 1]) rotate3d on xlabel('X') ylabel('Y') zlabel('Z') triangle = 1; for (idx = 1:3:nRow) hold on triangle triangl...
function opt = SE0P_parse_params(opt) % opt = SE0P_parse_params(opt) % % Parse parameters and set up free-space Ewald grid sizes: % inner = domain containing all sources and targets % extended = FGG grid (to cancel wrap effects) % padded = 2x FFT grid (for aperiodic convolution) % oversampled = FFT grid for truncated G...
clc clear all close all %% P1 - Specifying Parametors % Put all data in one time table with the following headers - dateTime, pm1 %, pm2.5 pm10 dataFolder = "/media/teamlary/Team_Lary_1/gitGubRepos/data/mintsData"; dotMatsFolder = dataFolder + "/dotMats"; grimmDataFolder = dataFolder + "/Spectro...
function file = save(obj, export_path, varargin) % Save the symbolic expression of a wolframe MX file % % % Parameters: % export_path: the path to export the file @type char % varargin: variable input parameters @type varargin % ForceExport: force the export @type logical % % Ret...
function [net, info] = dcti(varargin) %Traning DCTI %Loading Networks net = dcti_init(); net = vl_simplenn_tidy(net); %Configuaration opts.dataDir = fullfile('Data', 'Dataset'); opts.imdbPath = fullfile('Data', 'Experiment', 'imdb.mat'); opts.train.gpus = []; opts.train.expDir = fullfile('Data', 'E...
%% This will calculate the hessian of the object function and nonlinear constraint clear; modelName='human_3'; warning on verbose %add share functions addpath dyn/ addpath obj/ addpath gaitCon/ addpath plotRobot/ dbstop if error addpath hessian addpath (['../',modelName,'/robotGen/']) addpath (['../',modelName,'/robot...
%% Génération de plusieurs map pour des resonateurs différents % Donc pour des longueurs de tubes différents %% Init close all; clear; % Liste de longueurs tels que la fréquence fondamentale est a peu pres in tune load in_tune_lengths.mat lengths_list; N_init_samples = 25; N_edsd = 75; x1_min = 0; x1_max = 1; x2_mi...
%load Cactus_cfp8_3d_transB_5lev; %load ParkScene_cfp8_3d_transB_5lev; %load Kimono_cfp8_3d_transB_5lev; %load CrowdRun_cfp8_3d_transB_5lev; %load BQTerrace_cfp8_3d_transB_5lev; %load OldTownCross_cfp8_3d_transB_5lev; Ldc=coef(:,:,2); L5=coef(:,:,5); L4=coef(:,:,9:10); L3=coef(:,:,17:20); L2c=coef(:,:,33:40); L2b...
function [ F_diag ] = computeFDiag( theta, training_data,training_target,layer_size) %UNTITLED Summary of this function goes here % Detailed explanation goes here %% Initialize the parameter [W,b] = dnnParamToStack(theta,layer_size); m = length(W); y = cell(m,1); dydx = cell(m,1); F_w = cell(m,1); F_b = cell(m,1); %...
function y=unitVec(pointA,pointB) vectorAB=pointB-pointA; y = vectorAB/norm(vectorAB);
%% Prep_ImportData Function % Goal: % Read in csv files with the first rowing being variable names. % Save data,label, and map in a struct DATASET_VAR. % Save data in a matrix. % Input: % Input 1: Dataset name. %% function Prep_ImportData(Dataset) DATAS...
clear all load digit % convert train data set % M=1, N=300 [M,N] = size(train); for i=1:N img = train{i}; data(i,:) = reshape(img,1,size(img,1)*size(img,2)); % training data set end data = data.'; [PC,V] = pca2(data); lamda = sum(V); tmp = 0; for j = 1:size(V) tmp = tmp + V(j)/lamda; POV(j) = tmp; ...
%***********************************************************% % INPUT: % DB: price data series %***********************************************************% % OUTPUT: % Asset: the evolution of the trading account %***********************************************************% function Asset = TradingAccount_Evolution(...
function [C, sigma] = dataset3Params(X, y, Xval, yval) C = 1; sigma = 0.3; % ----- % values = [0.01, 0.05, 0.1, 0.25, 0.5, 0.75, 1, 2, 5, 10, 25, 50, 100]; results = []; l = length(values); for c=1:l, for sigma=1:l, testC = values(c); testSigma = values(sigma); model= svmTrain(X...
clc; close all; clear; format short e; headers; generateNet; generateTrainTestData; createEmptyFigs; learnAndTest; % continueRun;
function [cc_add, c_add_mye, c_add_unmye, pct_mye, xvals] = predict_cc_add(brwt, bvol, xvals, pct_mye, fit_distn, frac) %function [cc_add, c_add_mye, c_add_unmye, pct_mye, xvals] = predict_cc_add(brwt, bvol, xvals, fit_distn, frac, regress_type) % % Fit Wang et al. (2008) data (myelinated & unmyelinated ADD), % using...
clc clear all fprintf('The False Postion method\n'); Xl = input('lower bound = ? '); Xu = input('Upper bound = ? '); tol_x = input('tolerance x = ? '); tol_y = input('tolerance y = ? '); while(1) if(fun(Xl) * fun(Xu) > 0) fprintf('There is no answer'); else Xr = (Xl * fun(Xu) - Xu * fun(Xl)) / ...
close all; clear all; clc [N,T] = xlsread('../data/dox_231_time.xls'); tvec = linspace (0,34,5); colorsets = varycolor(5); N(2:end,2:end) = N(2:end,2:end); for i = 1:length(N)-1 barcode(i).cellnum = N(:,1); barcode(i).time = N(:,i+1); barcode(i).well = T(i+1); barcode(i).color = colorsets(i, ...
function MAC_sendPacket(radio, txType, txData, txSeqNo, txEop, maxCapacity) %% Packet Header Structure % First 12 bits for length in Byte % 4 bits for packet type DATA, DATA_ACK, CTRL, CTRL_ACL % 8 bits sequence number % 8 Bits = First bit for EOP, 7 bits reserved % 32 bits data CRC % 8 CRC for Packet packet...
clear;clc; load data2015 %load data2016 [n,p]=size(score); D=score; t1=clock; for K=1:40 %set different K-values. %tic; for i=1:n for j=1:p D(i,j)=0; D(i,j)=(sum(D(:,j)))/(n-1); dis=pdist(D); dis=squareform(dis); %calculate the distances based on the other sujects. dis_n=dis(...
function [xf,vf] = move(xi,vi,T,u) % this function computes dynamics of second order linear system with no damping % along one direction when input u is applied for T second % xi - initial position % vi - initial velocity % xf - final position % vf - final velocity % Copyright by Luca Schenato and UC Berkeley...
clear all close all %% prueba gong %load gong; %refsig = y; %delay1 = 0.1; %segs %sig1 = delayseq(refsig,delay1,Fs); %soundsc(sig1,Fs) %tau_est = gccphat(sig1,refsig,Fs); %tau1 = utils.tau_correlacion_cruzada(sig1,refsig,Fs); %tau2 = utils.tau_gcc_phat(sig1,refsig,Fs,@rectwin); %window_size = Fs; %tau3 = utils.tau_...
function [X,Z] = randnlatin(P,N) % randnlatin Latin hypercube sample from standard normal distribution. X = randn(P,N); if nargout > 1 Z = X; end for i = 1 : P X(i,:) = xxRank(X(i,:)); end X = X - rand(size(X)); X = X / N; X = xxNormInv(X); end % Subfunctions. %************************...
function B=sa_act(A,C,tol) %SA_ACT Structural Assignment via Actuator Selection % % B = sa_act(A,C) % % For a given unsensed system: % . % x = A x, y = C x % % the function finds an input matrix B such that the resulting system % characterize...
%Toy Data set for Q1a and Q1b X =[1,2;2,4;3,6]; Y = [1;2;3]; disp('Dataset..'); disp('X ='); disp(X); disp('Y = '); disp(Y); disp('Q1a. linear regression MLE'); w = linreg_mle(X,Y) disp('Q1b. linear regression posterior correctness'); disp('N (0, big)'); priormean = [0;0]; [PosteriorMean,PosteriorCovar] = linreg_pos...
function os = itermsg(itermeth,tol,~,i,flag,iter,relres) %ITERMSG Displays the final message for iterative methods. % ITERMSG(ITERMETH,TOL,MAXIT,I,FLAG,ITER,RELRES) % % See also BICG, BICGSTAB, BICGSTABL, CGS, GMRES, LSQR, MINRES, PCG, QMR, % SYMMLQ, TFQMR. % Copyright 1984-2013 The MathWorks, Inc. if flag...
function [sys,x0,str,ts] = wahadlo_fun(t,x,u,flag,l1,l2,m1,m2,fi1,fi2,t0) switch flag, case 0 [sys,x0,str,ts] = mdlInitialzeSizes(l1,l2,m1,m2,fi1,fi2,t0); case 2, sys = mdlUpdate(t,x,u,l1,l2,m1); case {1,3,4,9} sys = []; otherwise error(['Un...
classdef ResidualObliqueSplit < Split % ResidualObliqueSplit fits a polynomial model and splits the points into % two classes based on which side of the line they lie properties %(Access = protected) split_degree % degree for fitted polynomial end methods function obj = ResidualObliqueSplit(options)...
% function [msg_block] = linear_block_encode(n,k,msg_orig) clc; clear all; close all; n=7; k=4; msg_orig = [1 0 1 0]; [h1,g]=hammgen(n-k); msg_block1 = msg_orig*g; msg_block = mod(msg_block1,2) % function [r] = linear_block_decode(n,k,r) n=7 k=4 r= [ 1 0 1 1 0 1 0]; [h1,g]=hammgen(n-k); p = [g(...
mex -v qld_interface.cpp qld.f
%% use this script to fix / modify trials if exceptions are discovered after processing. % Patient PSL003: % Problem: % Triggers did not register properly for 2 trials in this patient's data. % The trials are 2 and 62 (indexed to the behavioral data, which captured all % trials). % Solution: % Add empty (nan) ...
function varargout = MetricTensGUI(varargin) % MetricTens (Version: 1.0)-Created by Giovanni Esteves % Department of Materials Science and Engineering % North Carolina State University, Nov. 29th, 2015 % Email: gesteve@ncsu.edu % Anytime this GUI is updated the version info at the very bottom that % correlates to the ...
function [tl,br]=xu_selectTiles(bwHimg,top_left,bottom_right,slidePtr,levelforRead,magHigh,magCoarse,magToUseAbove) Para.thetaStep=pi/9; Para.largeSigma=7; Para.smallSigma=4; Para.sigmaStep=-1; Para.kerSize=Para.largeSigma*4; Para.bandwidth=5; Para.dis=10; % if the seeds is close to image borders less than 10 pixels, ...
function relres=multigrid_2d_test N=10; nc=[4,3]; % the coarsest grid points a=[1,3]; % domain size % solve Dirichlet problem with vertex nodes % homogeneous boundary conditions % mesh is 0:n1+1 times 0:n2+1 but the boundary is not stored % refinement: % 0 1 ... n1 n1+1 level l...
function [ dt ] = sphere_line_intersection( sphere_center, sphere_radius, line_point, line_direction ) separation = line_point - sphere_center; ld_dot_ld = dot(line_direction, line_direction); ld_dot_separation = dot(line_direction, separation); sep_dot_sep = dot(separation, separation); p = 2...
function output = Mutate(point, vector, input, R_angle) %To Rotate some angle along a given axis, relative to a reference point r = input-point; vector = vector/norm(vector); %normalized vector mu = cross(vector, [0 0 1]); mu = -mu/norm(mu); angle = acos(dot([0 0 1],vector)/norm(vector)); %the angle between targ...
% Subroutine for boundary layer calculation % using Approximation method: Karman-Pohlhausen % NOTE: *BL calculation only for laminar region % *transition checked using Cebeci and Smith (1974) method % which is an improvement of Michel's method % *turbulent region is neglected function [del...
function [RMS, ZCR] = normalizeFeats(RMS, ZCR) RMS = RMS/max(RMS); ZCR = ZCR/max(ZCR); end
function [P] = softmax(z) numerator = exp(z); denominator = sum(numerator); P = bsxfun(@rdivide, numerator, denominator); end
function [Anew,Wi,Wb,TSnew] = cleanOutput(A,Wi,Wb,TS,P,N,S,T) % Re-order and normalize the output % Order elements by the occurence of the maximal element Anew=zeros(size(A)); % Column-wise for Wi iP=zeros(1,P); sP=zeros(1,P); % re-order normalization for i=1:P [~,iP(i)]=max(Wi(:,i)); sP(i)=norm(Wi...
function [ mz,x ] = combCompNeighbours3(mz,x,ppmTol,flag) %combCompNeighbours2 - this is a new version which is supposed to be better %than the first version. It does this by merging the most likely ones %before others; i.e. work on highly populated m/z bins first, and ignore %ones which look most like noise. percThr...
clear all close all maxTime = 3810; %just a test number at the moment, to be amended %% setup figure fig = figure('name','Physical Environment','numbertitle','off'); %plot(bounds(:,1),bounds(:,2)); hold on; grid on; axis equal; %Axes set to equal for aestheic purposes. %This sets the labels for the axes and title -...
load("stack.mat") a=eval(['frame',sprintf('%.3d',19)]) img = eval(['frame',sprintf('%.3d',6)])
function x = subsref(this, s) % subsref Subscripted reference for model and systemfit objects. % % Syntax for retrieving object with subset of parameterisations % ============================================================== % % M(Inx) % % % Syntax for retrieving parameters or steady-state values % ====...
function plotAllNrnsAcrossTrials(outputPath, generalProperty, imagingData, BehaveData) % extract behavioral data stats [labels, examinedInds, eventsStr, labelsLUT] = getLabels4clusteringFromEventslist(... BehaveData, generalProperty.labels2cluster, generalProperty.includeOmissions); % 1. grab counts per trial % grabCo...
function [eltime] = GVL_1_1_7(m, n, r) A = round(100*rand(m,r)); B = round(100*rand(r,n)); C = round(100*rand(m,n)); % [m, r] = size(A); % [~, n] = size(C); tic for j = 1:n for k = 1:r C(:,j) = C(:,j) + A(:,k)*B(k,j); end end eltime = toc; end
function features = img_to_features(dataset) n_img = length(dataset); width = 448; img_block_sizes = [224 112 56 28]; %img_block_sizes = [224]; thm_block_sizes = [8 4 2 1]; n_bins = 8; dir_edges = -pi:(2*pi/n_bins):pi; gd_filter = conv([-1 1],fspecial('gaussian',[1 4],1)); tap_filter = [-1 0 1]; hog...
function y = avener( x ) %avener Average energy of a signal % avener(x) finds average energy of a signal x % if x is a matrix, avener calculates average energy of each column y=zeros(1,size(x,2)); for k=1:size(x,2) y(1,k)=sum(x(:,k).*x(:,k))/size(x,1); end end
function tests = makeInputHandlerFcn_tests tests = functiontests(localfunctions); end function test_input_equals_output(testCase) % must start with test handler = makeInputHandlerFcn('free_response_robot'); input = 'hello world'; output = ''; while true key_pressed = handler([], input); ...
classdef NearestNeighbor < sbfsem.analysis.NeuronAnalysis properties (Constant = true, Hidden = true) DisplayName = 'NearestNeighbor'; end methods function obj = NearestNeighbor(neurons) obj@sbfsem.analysis.NeuronAnalysis(neurons); obj.doAnalysis(); end function doAnalysis(obj, k) if nargin < 2 ...
%种群初始化函数 %输入: %NIND 种群规模大小 %N 个体染色体长度(这里为城市个数) %输出: %初始种群 function Chrom=InitPop(NIND,N) Chrom=zeros(NIND,N); %用于存储种群 for i=1:NIND Chrom(i,:)=randperm(N);%随机生成初始种群 end
function [hit FA miss CR performance] = go_nogo_performance(path) % Hit = 2 % FA = 3 % Miss = 6 % CR = 5 [session] = loadVoyeurH5_result(path); result = [session{:,1}]'; hit = sum(result==2); FA = sum(result==3); miss = sum(result==6); CR = sum(result==5); performance = (hit+CR)/length(result); end
% IQdata_CloudLocations and Strct_Metadata should be loaded from the *.mat % files for each of the smart manufacturing measurements. Run this after % loading the *.mat file. % After this script is run, the positions for each record will be held in % the 'xpos' and 'ypos' variables. For example, IQdata(:,1) correspond...
% %Temporal Poincare section algorithm % %Parameters: % input - The dataset (x, y, time) (array) % n - Number of time step iterations (int) % T - Time step (float) function output = temporalPoincare(input, n, T) output(1:2, :) = 0; length = size(input); curr = 1; for i = 1:n ...
%% Neural Networks Class Guide %Objective: Analyze the change in the output of a single neuron when changing the weight, the %bias and the transfer function. %% 1)Run demo nnd2n1 nnd2n1; %undo comment to see the output %% 2) Study how the different values of weight, bias, transfer function and input p modify %the o...
%subroutine to compute, plot, and save histograms function histogram(data,xrange,filename) global figurepath clf h=axes; hist(data,xrange); set(h,'FontSize',25) print('-deps',[figurepath,filename,'.eps']);
function divF = div3dFS(Fx,Fy,Fz) % Subroutine for taking divergence of a vector field in 3D in fourier space % Chiyu Jiang, Oct 9th, 2015. global M N P Lx Ly Lz divFx = Fx.*(1i*M).*(2*pi/Lx); divFy = Fy.*(1i*N).*(2*pi/Ly); divFz = Fz.*(1i*P).*(2*pi/Lz); divF = divFx+divFy+divFz;
% Matt McDade % ANM 2 % HW 2 Problem #2 function hw_2 f = @(x) log(x^2 + 1); fprintf('x = 1.3 h = 0.01:\n') fprintf('\tCD2: %.8f \tFD2: %.8f\n', CD2(f, 1.3, 0.01), FD2(f, 1.3, 0.01)) fprintf('x = 1.3 h = 0.001:\n') fprintf('\tCD2: %.8f \tFD2: %.8f\n', CD2(f, 1.3, 0.001), FD2(f, 1.3, 0.001...
%-------------------------------------------------------------------------- %------------ Metody Systemowe i Decyzyjne w Informatyce ---------------- %-------------------------------------------------------------------------- % Zadanie 2: KNN i Naiwny Bayes % autorzy: M. Zięba, A. Gonczarek, J.M. Tomczak, S. Zaręba %...
function root_id = get_root_id(G, child_id) isRootId = G.RootIds(1,child_id); root_id = child_id; while ( ~isRootId ) root_id = get_parent_node(G, root_id); isRootId = G.RootIds(1,root_id); end
function [Xpred, sigma_xx, sigma_yy, sigma_tt, NEES, t] = q1_ekf_nonlinear_obs(mu,sigma, xtrue, ztrue, t, g, T, rho_0, k_rho, Q, R) NEES = []; sigma_xx = [sigma(1, 1)]; sigma_yy = [sigma(2, 2)]; sigma_tt = [sigma(3, 3)]; Xpred =[mu]; mu_posterior = mu; for i = 1:length(t) sigma_xx = [sigma_xx, sigma(1, 1)]; ...
Fs=50; T=1; N=T*Fs; t=(0:1/Fs:N)-N/2; f=linspace(-Fs/N,Fs/N,length(t)); x=cos(pi/4*t); X=fft(x); figure() subplot(3,1,1); plot(t,x); xlabel('t'); ylabel('cos(pi/4*t)'); subplot(3,1,2); plot(f,abs(X)); xlabel('w'); ylabel('magnitude'); subplot(3,1,3); plot(f,angle(X)); xlabel('w'); ylabel('phase');