text
stringlengths
8
6.12M
function bw2=adaptivethreshold(im,ws,C,m) % threshold mean-C or median-C to the image im. % ws is the local window size. % m is 0 or 1, m=0 mean(default)m=1 median. if (nargin<3) error('You must provide the image im, the window size ws, and C.'); elseif (nargin==3) m=0; elseif (m~=0 && m~=1) error('m ...
%% Use before the algorithm starts to run in loops function [bAddLegend, hPrev, prevLegendNames, curLegendName] = updateLegend(curLegendName) allLegendNames = getAllalgosNames(); arg = cell(0); sz = size(allLegendNames,2); i = 1; for nm = allLegendNames arg(end+1) = {'DisplayName'}; ...
function varargout = dple_n_in(varargin) %DPLE_N_IN Get the number of QP solver inputs. % % int = DPLE_N_IN() % % % % [varargout{1:nargout}] = casadiMEX(844, varargin{:}); end
function [bestc , bestg , bestcv] = gridSearch(filepath) addpath([ pwd '\..\Libs\libsvm\matlab']); [label_vector, instance_matrix] = libsvmread(filepath); fprintf('grid search for : %s \n', filepath); bestcv = 0; for log2c = -1:5, for log2g = -4:4, fprintf('starting %g %g \n', log2c, log2g); cmd = ['-v 5 -c...
function er = one_vs_one_svm( train_x, train_y, test_x, test_y, c ) % 1对1的方法实现多分类svm % 作者:王鹏举 % 日期:2017年6月3日 [~, d] = size( train_x ); [test_num, n] = size( test_y ); weight = zeros( d, n-1, n ); bias = zeros( 1, n-1, n ); yy = zeros( test_num, n-1, n ); %% 构造n*(n-1)/2个svm分类器 for i = 1 : n...
function [y_est, var_est] = my_gmr(Priors, Mu, Sigma, X, in, out) %MY_GMR This function performs Gaussian Mixture Regression (GMR), using the % parameters of a Gaussian Mixture Model (GMM) for a D-dimensional dataset, % for D= N+P, where N is the dimensionality of the inputs and P the % dimensionality of the outputs....
function test = adddashes(string, lengthseq) % Adds required dashes to a sequence where there are only white spaces. % lengthseq = length(sequence); % Usefull when concatenating multiple short sequences in specific % positions. c = [find(string == 'A')'; find(string == 'C')'; find(string == 'G')'; find(st...
% load chet baker % clear all workspaces clear all; % clear command window clc; I = imread('ChetBaker.png'); imshow(I); hold on; % plot(36, 36, 'g+'); %TL % plot(280, 65, 'g+'); %TR % plot(280, 290, 'g+'); %BR % plot(36, 300, 'g+'); % BL % 430 853 p1 = [36, 36]; p2 = [380, 65]; p3 = [280, 290]; q1 = [1, 1]; q2 = ...
function p = predict(Theta1, Theta2, X) m = size(X, 1); num_labels = size(Theta2, 1); p = zeros(size(X, 1), 1); p1=sigmoid([ones(m,1) X]*Theta1'); p2=sigmoid([ones(m,1) p1]*Theta2'); [a,p]=max(p2,[],2); end
function[distance] = dist(x1,y1,x2,y2) distance=sqrt((x1-x2)^2 + (y1-y2)^2);
function deglazed_imgs = deGlaze() glaze_images = 'data/list/test_split/test2_hlight_selected.txt'; fileId = fopen(glaze_images, 'r'); files = {}; tline = fgetl(fileId); files{end + 1} = tline; while ischar(tline) tline = fgetl(fileId); files{end + 1} = tline; end fi...
function Score = GD_cal(PopObj,PF) % <metric> <min> % Generational distance %-------------------------------------------------------------------------- % The copyright of the PlatEMO belongs to the BIMK Group. You are free to % use the PlatEMO for research purposes. All publications which use this % platform or any co...
%%% Script to load, epoch data that's events has been renamed clear; clc; %open and load eeglab in matlab [ALLEEG EEG CURRENTSET ALLCOM] = eeglab; % this tracks which version of EEGLAB is being used, you may ignore it EEG.etc.eeglabvers = '14.1.2'; % EEG data directory datadir = '/home/ildiko/Desktop/kurvaanya...
%% draw_rollout_uav.m % *Summary:* Script to draw a rollout of the uav % % Copyright (C) 2008-2013 by % Marc Deisenroth, Andrew McHutchon, Joe Hall, and Carl Edward Rasmussen. % %% High-Level Steps % # For each time step, plot the observed trajectory, the applied torques, % and the incurred cost %% Code if j > 0 ...
% Script for Example 3.3 format long g [x,n] = bisect('fex3',-10,10,fex3(-10),fex3(10),1.e-10)
%function [sens_predict, spes_predict, accuracy,sensitivity,specificity,PPV,NPV,MCC ] = myclassifysvmROC_LOOCV_new_pro( X_train,X_test,T,C_value,g_value) function [sens_predict, spes_predict,mean_accu,mean_sens,mean_spes,mean_ppv,mean_npv,mean_mcc]= myclassifysvmROC_LOOCV_new_pro( X_train,X_test,T,C_value,g_value) % Le...
function name = tName(varStr,varVal,headStr) N = length(varStr); name = headStr; for i = 1:N name_add = [varStr{i}, ' = ', num2str(varVal{i},3)]; name = [name name_add ', ']; end name = name(1:end-2); end
classdef Particle %PARTICLE Represents a particle % Particle has different methods to assign and retrieve values and % handle the right behaviour. There are weight functions and sensor % data for every particle. properties Weight; X; Y; Phi; SensorL...
function [R,P_EQ,A]=hummer_szabo_clustering_A(K,INV_K, P_eq, A) % Variable names in upper case correspond to the reduced system. Variable % names in lower case correspond to the full system. [n, ~] = size(K); num_of_clusters=size(A,2); P_EQ=zeros(size(A,2),1); for i=1:size(A,1) for j=1:size(A,2) ...
function PlotPareto(rep, func_name, true_pf, target_region) Cost = [rep.Cost]; plot(Cost(1, :), Cost(2, :), 'r*'); hold on if strcmp(func_name, 'zdt3') if length(true_pf) == 100 sec = [19 24 20 19 18]; else ...
%MIT License %Copyright (c) 2019 Sherman Lo clearvars; close all; this = DefectDetectAbsFilterDeg120(); this.run(); this.printResults(); close all; this = DefectDetectSubRoiAbsFilterDeg120(); this.run(); this.printResults(); close all; this = DefectDetectSubRoiAbsFilterDeg30(); this.run(); this.printResults(); clos...
[ret,warn] = loadlibrary('../lib/liblinear_solvers','../include/linear_solvers.h'); A = sprand(n,n,1); n = 300; tests = 1000; lpX = libpointer('doublePtr',zeros(n,1)); rhs1 = ones(n/2,1); rhs2 = zeros(n/2,1); rhs = [rhs1;rhs2]; ret = calllib('liblinear_solvers','loop',lpX,rhs,n); err ...
function [x, b] = phistalign(x0, b0) % % function [x, b] = phistalign(x0, b0) % % histogram values in x0, with bin *edges* as per b0 % % and represents counts as percentege of total values if nargout [x, b] = phistm(x0, b0, [1, 1, 0]); else phistm(x0, b0, [1, 1, 0]); end;
function [res] = ispresentinset(x,y,z,sepset) %this function tests if z is present in the separating set of x and y %usage % ispresentinset(x,y,z,sepset) sepsetxy = sepset{x,y}; % size(sepsetxy,2) % size(z,2) if size(sepsetxy,2) < size(z,2) res = 0; elseif size(sepsetxy,2) > size(z,2) for i = 1:size(seps...
function loop_ET_blank S = load('ET4_starts_subset'); %3 seconds of blankness... blank_trace = zeros(1, 30); blank_sr = 10; nICS = size(S.gL,1); data = struct('spikes', cell(1,nICS), 'which', cell(1,nICS), 'gL', cell(1,nICS), 'vL', cell(1,nICS)); total_start = ...
function optical_resources_arr = wrTransportUnitInOptChannel(counter_transport_unit, optical_resources_arr, this_node, i, max_num_tr_units_iteration) %%% determination the number of transport unit per this iteration for this node %%% local_counter = size(counter_transport_unit, 1); %%% we start writing transport unit f...
function [X, err] = solveSistLUP(A, b) [P, L, U, ~] = factLUPivotaje(A); n = length(A); aux = size(b); if aux(1) > aux(2) %Comprobando si b es un vector fila o columna y = b; elseif aux(2) > aux(1) y = b'; else error('b es una matriz cuadrada, no un vector'); ...
%------------------------------------- % function yp = LoscarDif10(t,y) % provides difequations % % file: LoscarDif10.m % % LOSCAR Model: Long-term Ocean-atmosphere-Sediment % CArbon cycle Reservoir Model % % ocean box model (+1 for atmosphere) % % % updates: % % 07/06/08 A few comments added % % 02/06/08...
classdef Filters % FILTER creates four filters and contains the class function to plot % the filter response and filtered signals properties LPF HPF BPF BSF end methods(Static) % design_filters() creates a structure that conta...
%@(#) getcycles.m 1.4 98/01/13 07:55:00 % function [cycles,efph]=getcycles(unit) if nargin <1, unit=findreakdir; end if length(find(unit=='/'))==0, unit=['/cm/',unit,'/']; end reakdir=unit; opyear=[reakdir,'fil/op-year.txt']; fid=fopen(opyear,'r'); efph(1)=fscanf(fid,'%f',1); ord=fscanf(fid,'%s',1); cycles(1...
n = [ 4, 8, 16, 32, 64, 128]; abs_err = zeros(size(n)); I = exp(0) - exp(-0.8); for i = 1:length(n) abs_err(i) = abs(trapezoid('exp_neg', 0.0, 0.8, n(i)) - I); end loglog(n, abs_err, 'x') grid on title('Trapezoidal Error change by n') % commeent % As the n value doubles, the error is reduced to a quarter.
function [ypred_withGround, ypred_noPL] = mophological(ypred, wsl, las, medianFilterSize, bwareaopenSize) % MORPHOLOGICAL PROCESSING FOR FOREST TYPE IMAGE % apply median filter to reduce noise, display output ypred_medFilter = medfilt2(ypred,[medianFilterSize,medianFilterSize]); % use BWareaopen to remove areas sm...
%%% Code for meshing function feaout=init(feain) feaout=feain; disp('Generating initial mesh...'); [m,n]=size(feaout.object); p=[]; for i=1:n p=[p;feaout.object(i).bx feaout.object(i).by]; end %sort points [m,n]=size(p); r=[]; err=1e-12; for i=1:m for j=i+1:m if(abs(p(i,:)-p(j,:))<err) ...
function s= checkerboard(n,m) if mod(n,2)==0 s = zeros(m,n); s(1:2:end)=1; s=s'; if mod(m,2)==0 for i=2:2:n s(i,1:end)= [0,s(i,1:end-1)] end end else s = zeros(n,m); s(1:2:end)=1; end
function m4_week2_task2() %CONFIG PARAMETERS param.gaussianColor = false; param.alpha = 0.25; param.maxAlpha = 5; param.minAlpha = 0; param.minP = 0; param.maxP = 1; param.pStep = 0.1; %Get the Datasets datasets = dir('Dataset/'); datasets = datasets(find(vertcat(d...
function dp = backprop(dz,w,p,z,param) %CONVWF.BACKPROP Backpropagate derivatives from outputs to inputs % Copyright 2012-2015 The MathWorks, Inc. dp = convn(dz,w,'full'); end
function Mt = freePrecession(M0,t,delw0) R = [exp(1i*delw0*t) 0 0; 0 exp(-1i*delw0*t) 0; 0 0 1]; Mt = R*M0; end
function HadCRUT = s1a1preparehadcrutmonthly(filePath) %% Import data from text file. % Script for importing data from the following text file: % % /Users/teda/Drive/Research/Data/HadCrut/HadCRUT.4.6.0.0.monthly_ns_avg.txt % % To extend the code to different selected data or a different text file, % generate a funct...
clc,clear; f = @(x)sin(x); x0 = pi*rand(21,1); x1 = pi*rand(21,1); x1 = sort(x1); x0 = sort(x0); f0 = feval(f,x0); f1 = feval(f,x1); figure; hold on; subplot(1,2,1); hold on; scatter(x0,f0); y = cubicspline3(f,x0,x0); title("周期边界情况"); xlabel("x"); hold off; subplot(1,2,2); hold on; pp = csape(x0...
function PV = ProbabilityVector(Data,States) N = length(Data); % iter = 0; PV = zeros(length(States),1); for istate = States' iter = iter + 1; PV(iter) = sum(Data == istate)/N; end end
function plot_fast_marching_3d(W,S,path,start_points,end_points, options) % plot_fast_marching_3d - plot the result of the fast marching. % % plot_fast_marching_3d(W,S,path [,start_points,end_points, options] ); % % If you provide W, path is assumed to lie in [1,n]^3 where n=length(W). % Path can be a cel...
function [target, stimulus] = generate_frame(image, p) global w global params %create a random array of grayscale values stimulus = 255*rand(size(image)); %create an array with p ones and the rest zeros p_mask = p*ones(size(image)); take_image_value = binornd(1,p_mask)>0; %change these pixels to target pixels stimu...
% same as part a .Only changes in the amount of data and calculation of % precision,recall and F-score words = importdata('vocabulary.txt'); stoplist = importdata('stoplist.txt'); train =importdata('train.data'); train_label = importdata('train.label'); valid = find(~ismember(words,stoplist)); valid_train = fi...
function result = directionsc(image,i,j,angle,scale) if(angle==0) result = image(i,j) - image(i,j+scale); end if(angle==45) result = image(i,j) - image(i-scale,j+scale); end if(angle==90) result = image(i,j) - image(i-scale,j); end if(angle==135) result = image(i,j) - image(i-scale,j-scale); end
function [q0] = decorrelationMethod(alpha,beta) %DECORRELATIONMETHOD Decorrelation method after Dralle et al., 2015 % % INPUT % a: recession power law scale parameter (biased) % b: recession power law exponent % % OUTPUT % q0: rescaled discharge q0 = exp(-sum((beta-mean(beta)).*(log(alpha)-mean(log(alpha)))...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Author: Trinh, Khanh V <khanh.v.trinh@nasa.gov> % Notices: % % Copyright @ 2020 United States Government as represented by the % Administrator of the National Aeronautics and Space Administration. All % Rights Reserved. % % Disclaimers % % No Warranty: ...
#include "userclasses_StateMachine_35.h" const struct clazz *base_interfaces_for_userclasses_StateMachine_35[] = {}; struct clazz class__userclasses_StateMachine_35 = { DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_userclasses_StateMachine_35 ,0 , &__GC_MARK_userclasses_StateMachine_35, 0, ...
function core = inductor() % Author: Ravi Saripalli (1st Aug. 2021) % Estimate inductance from physical construct % of inductor. Then use experimental data of % damped oscillator frequency of LC tank circuit % with different known capacitors. function L = L_measure() % Calculate inductor va...
function [PeakSpec,PeakwL]=findpeak(wL,Spec,c) %function w=cutdc(A,dc0); %dc0:threshold [a,b]=size(wL); if a>1 wL=wL'; end [a2,b2]=size(Spec); if a2>1 Spec=Spec'; end [Spect_sort,IS]=sort(Spec,2,'descend'); index=round(mean(IS(1:5))); indexL=index-c; indexR=index+c; if indexR>b indexR = b; end if indexL < ...
[X1,Y1,X2,Y2] = split_db('iris'); %[mcml_model] = train_mcml(Xtrain,Ytrain); %[mcml_model] = train_just_norm(Xtrain,Ytrain); [proj1,proj2] = train_test_mcml(X1,Y1,X2); nn = 4; err(1) = knn_classify(proj1,Y1,proj2,Y2,nn); %[mcml_model] = train_mcml(Xtest,Ytest); %[mcml_model] = train_just_norm(Xtest,Ytest); [proj2,p...
function sig = getSig(fileName) CHAR_START = '='; %Starting of signal CHAR_PARSE = ','; %Parsing of each signal CHAR_DIVID = ':'; %Parsing between mac and rssi CHAR_DIVID_SUB = '|'; fid = fopen(fileName); if(fid<0) fprintf(['Signal file' fileName 'not found.\n']); sig = {}; flose(fid); return; end cn...
function calc_times = core_calcCoeffs(S_coredata,pstep,issave_e,issave_p,issave_d) %Get first group from tvec to begin saving tvec = S_coredata.tvec; len_tvec = length(tvec); %Initialize [t_last,Y_last] = core_loadCheckpoints(core_getCheckpointFn(pstep,S_coredata.cp_dir)); noise_vec ...
function [S] = im2segment(im) % [S] = im2segment(im) nrofsegments = 5; m = size(im,1); n = size(im,2); threshold = 200; segmentationIndex = 1; pixelsFoundInSegment = 0; for kk = 1:nrofsegments temp = zeros(m,n); for i = segmentationIndex:n sumOfColumn = 0; for j = 1:m if(neighbourHo...
% Problem Set 4 % ============= % Do Yoon Kim, Chris Poliquin, David Zhang % May 15, 2015 rng(8675309); dir = mfilename('fullpath'); cd(dir(1:end-4)); options = optimset('Display', 'final', 'TolFun', 10e-10, ... 'MaxIter', 1000, 'MaxFunEvals', 1000); %% Section 2, Question 3 % --------------------...
% Approximate the solution at the next time step using the FEM function u = forward_euler_step_4(y, dx, dt, m) A = zeros(m, m); for i = 2:m A(i,i) = 1; A(i,i-1) = -1; end time_deriv = -1/dx * A * y; u = y + dt*time_deriv; end
col = 321; row = 481; %load data fin=fopen('Man.raw','r'); input = fread(fin, (row * col * 3), '*uint8'); fclose(fin); R = reshape(input(1:3:end), [col, row]); G = reshape(input(2:3:end), [col, row]); B = reshape(input(3:3:end), [col, row]); input = cat(3, R, G, B); I = permute(input, [2, 1, 3]); imshow(I);
% The advected quantity for alpha equation is Alpha % Alllocation Alphag0=alphag; % Value setting Alphag0.internal=alphag0.internal.*rhog./rhom0.internal; Alphag0=setBC(Alphag0,rhom,xC,xF,g); % Face maximum for spectral radius specially tailored for this problem if 1 % U-alphag block [a_j_...
function[desc1,desc2] = two_point_crossover_float_Ackley(pred1,pred2) temp = zeros(1,8); nir = randi([12,33],1,1); for i = 1:8 temp(i) = pred1(nir+i); pred1(nir+i) = pred2(nir+i); pred2(nir+i) = temp(i); end desc1 = pred1; desc2 = pred2; end
% Function "dgauss.m"(first order derivative of gauss function): function y = dgauss(x,std) y = -x * gauss(x,std) / std^2; end
classdef U properties Stacja=''; NapiecieZnamionowe=0; NumerPomiaru=0; Napiecia3f=[0 0 0]; Napiecie=0; end methods function pomiar=U(stacja,Un,nrpom,nap3f) if nargin~=4 error('blad argumentow konstruktora U'); end ...
function [trainPerf,valPerf,testPerf,gWB,trainN,valN,testN] = perfsGrad(net,data,hints) % Copyright 2012 The MathWorks, Inc. trainPerf = 0; valPerf = 0; testPerf = 0; gWB = zeros(hints.numWeightElements,1); trainN = 0; valN = 0; testN = 0; for i=1:hints.numSlices % Slice Data qq = hints.sliceIndices{i}; dataS...
function [P,Q,R] = linearize_quadtwopar(A,B,C,D,E,F,t) %LINEARIZE_QUADTWOPAR Linearize quadratic to linear two-parameter pencil % % [P,Q,R] = LINEARIZE_QUADTWOPAR(A,B,C,D,E,F,t) % linearizes quadratic two-parameter pencil with matrices n x n % A + l*B + m*C + l^2*D + l*m*E + m^2*F % as a linear two-parameter pencil...
clear all close all clc preprare_raw_data; prepare_data_cnn_filterbank; gen_datalist_dnn_filterbank; gen_datalist_cnn_filterbank; gen_datalist_dnn_filterbank; preprare_cnnbaseline_data_raw; gen_datalist_cnnbaseline;
%******************************************************************************* %* Program: exact_mhd_main.m %* Description: Exact nonlinear Riemann sovler for 1D Magnetohydrodynamic %* equations. %* Author: Andrew Kercher %* References: %* [1] Dai, W. and Woodward, P. R., "An Approximate Riema...
function [ scribbles ] = freehand_scribble( scan, mask_gt, mask_scribble, current_slice, varargin) %% AUTHOR: Basil Mustafa (BasilAMustafa@gmail.com) % % freehand_scribble allows a user to quickly scribble on weak supervision data based off % a provided ground truth and image % %% USAGE: % % inputs: % scan -...
function [neighNoMean neighNoStd radiusMean radiusStd refDirDevMean refDirDevStd refDirDevMax currDirMinRadCorrect] = testPCAInfluence(file, fractionOfSeedPoints, neighRadiusRange, referenceRadiusIx) %Funkcja testuje wyniki obliczania wektorow normalnych do powierzchni %wzgledem roznych wartosci promienia sasiedztwa....
%% Dynamic Matrix Control Tutorial % Dynamic Matrix Control (DMC) was the first Model Predictive Control (MPC) % algorithm introduced in early 1980s. Nowadays, DMC is available in almost % all commercial industrial distributed control systems and process % simulation software packages. This tutorial intends to expl...
function value = CalculateChiSquared(data, fit) % Returns the chi squared value of a data set and the fit value = sum((data - fit).^2); end
% This is material illustrating the methods from the book % Financial Modelling - Theory, Implementation and Practice with Matlab % source % Wiley Finance Series % ISBN 978-0-470-74489-5 % % Date: 02.05.2012 % % Authors: Joerg Kienitz % Daniel Wetterau % % Please send comments, suggestions, bugs,...
// // PowerBar.m // MoonHerder // // Created by Roger Engelbert on 10/9/12. // Copyright Done With Computers 2012. All rights reserved. // #import "PowerBar.h" // PowerBar implementation @implementation PowerBar @synthesize boostCnt = _boostCnt; - (void) dealloc { [super dealloc]; } -(id) initWithGame:(Ga...
#include "java_util_HashMap.h" const struct clazz *base_interfaces_for_java_util_HashMap[] = {&class__java_util_Map}; struct clazz class__java_util_HashMap = { DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_java_util_HashMap ,0 , &__GC_MARK_java_util_HashMap, 0, cn1_class_id_java_util_HashMa...
% Usage: % out = rbc_benchmark_ff(params, y) % where % out is a (9,9) matrix of the first order % derivatives of the static system residuals % columns correspond to endo variables in % the ordering as declared % params is a (12,1) vector of parameter ...
function [F,V,C]=ind2patch(IND,M,ptype) % function [F,V,C]=ind2patch(IND,M,ptype) % ------------------------------------------------------------------------ % % This function generates patch data (faces “F”, vertices “V” and color % data “C”) for 3D images. The patches are only generated for the voxels % speci...
function lightstart(cs) % turn all off writeDigitalPin(cs.a, cs.bulb.green, 0); % turn green on writeDigitalPin(cs.a, cs.bulb.green, 1); pause(0.1); % turn all off writeDigitalPin(cs.a, cs.bulb.green, 0); end
% ------------------------------------------------------------------------- % Measurements collected during an outdoor campaign. % DL traffic was generated by iPerf3. Signal indicators were reported by Android OS. % Strong positive correlation between throughput and RSRQ. % (RSRQ was measured properly, i.e., in interva...
function plot_ws_areas(layer,i,j,tmax) % Produces side by side raster plots of workspace areas i and j subplot(1,2,1) plot_ws_firings(layer,i,tmax); subplot(1,2,2) plot_ws_firings(layer,j,tmax); set(gcf,'Position',[50,100,1200,400]);
function Patch %This function analyzes and processes data from a new patch. It looks for %two JSON files: 'champion.json' and 'Items.json'. It converts them to %structures itemdat and champdat and runs filefix functions among other %modifiers to process all data. %% Decoding JSON files clear champdat = jsondecode(filer...
% evaluating the test suite for problem 1 - 2 variable problem clc; clear all; fulldata = importdata('SP_test_5.dat'); V = fulldata(1:2:end, :)'; V1 = fulldata(2:2:end, :)'; %load net_prob1_case2; load snet3; V1correct = snet3(V1); sampleno = 282; temp(:, 1) = 1:1:17; temp(:, 2) = V(:, sampleno); temp(:, 3)= V1(:, sa...
function deconv_trs = deconvolve(trs,samplingrate,tau) %DECONVOLVE Deconvolves an exponential from the given trace % Trace should be divided by the resting light (RLI) prior to calling this function. % Example usage: % tr = o.trials(1).rois.traces(glom_num,:) ./ o.trials(1).rois.RLIs(glom_num); ...
function [person_boxes_frames] = find_top_n_people(boxes_frames, x_flow_paths, y_flow_paths,... class_id, frame_interval, top_n, score_thres, img_width, img_height) % FIND_TOP_N_PEOPLE finds the top-n relevant person tracks in a video % requires extracted optical flow % - boxes_frames: cell array saved from faster_...
function [P]=segment_MI(x,fs) % utlizes MLSP 2017 segmentation paper...added here addpath('/home/d14003/Desktop/mlsp/MLSP2017_Seg/'); %% calculate spectrogram [t,f,ps]=calculateSpectrogram(x,fs); %% load SVD dictionary (left singular vectors) load Dict; Dict=U(:,1:5); %% choosing top 5 left singular vectors %% comput...
function output = function_name(input1,input2,varargin) % The "function_name" function ... TODO: Add description % % SYNTAX: TODO: Add syntax % output = function_name(input1) % output = function_name(input1,input2) % output = function_name(input1,input2,'PropertyName',PropertyValue,...) % % INPUTS: TODO...
A=imread('untag.jpg'); subplot(2,2,1);imshow(A);title('Citra Berwarna(RGB)'); set(gcf,'Position',get(0,'Screensize')); R=A(:,:,1);%memanggil matriks gambar piksel warna merah G=A(:,:,2);%memanggil matriks gambar piksel warna hujai B=A(:,:,3);%memanggil matriks gambar piksel warna biru subplot(2,2,2);imhist(R)...
function [T P NumofEdge_real Comnet max_NumofEdge_rand P_com] = px_gretna_NBS_paired(Mat_Condition1, Mat_Condition2, P_thr, Tail, M, Mask_net, Path_covariate) %========================================================================== % This function is used to perform NBS algorithm to search connected % component...
function [ratemap,topplot,finalcolormap,OccupancyMap,cellspikes,velcoords,nspikes,noccup] = cell_SmoothPlacePlot(Coordinates,Unit,varargin) %FUNCTION [ratemap, rawratemap]= cell_SmoothPlacePlot(session, unit, varargin) % This function creates a smoothed place plot of cell u. There are two % subplots, on top a trajecto...
function dz = forwardprop(dp,w,p,z,param) %DIST.FORWARDPROP Propagate derivative from input to weighted input % Copyright 2012-2015 The MathWorks, Inc. [~,Q,N] = size(dp); S = size(z,1); dz = zeros(S,Q,N,'like',dp); end
function Obj = perform_COMP_measurement() %Perform composition measurement % Obj = COMP_object; % go to directory and extract raw csv file Obj.rawData = csvread('data.csv', 0, 1); % figure; % plot(x(1,:), x(2,:), 'b-'); RNG = 'C3..C55'; temp = csvread('output.csv', 3, 1, RNG); temp = temp(4:55, 2); Obj.processedData...
function stan_process_birds(DIR,varargin) % % % % proc_name='robomulab.mat'; stan_dir='stan'; save_filename='stan_withinbird'; newfs=500; % load in MU calculation, compare across days % this script should be run in the base ephys directory (e.g. ephys_barecarbon) % we're assuming next dir is bird, then rec id, etc. ...
function handles = osc_set_resolution(osc_message,handles) % OSC_SET_RESOLUTION - Set the microtonic resolution of the % orchestra (1/2 tone, 1/4 tone, 1/8 tone or 1/16 tone). % % Usage: handles = osc_set_resolution(osc_message,handles) % % Open a new session if necessary if isempty(handles.session) handles.sessi...
%@(#) fascatch.m 1.1 05/07/13 10:29:30 % % %function j=fastcatch(buid,BUIDNT) % function j=fastcatch(buid,BUIDNT) i=find(buid==' ');buid(i)=''; buid=sprintf('%6s',buid); jj=(10:-2:0)'; jj=10.^jj; x=abs(BUIDNT)*jj; x1=abs(buid)*jj; j=find(x==x1);
%% SPR Xphase input file - Modify me % Multilayer transfer matrix model for thin film reflectance % Rp/Rs: Kretschmann-configuration SPR % % To use, go through each section and specify the values for your % experiment. You should specify the angles, frequency ranges, the % substrate material dielectric function, ...
function B = is_boundary_facet(E,F) % IS_BOUNDARY_FACET Determine for each edge E if it is a boundary edge in F % for tets. Edges are now facets. % % B = is_boundary_facet(E,F) % % Inputs: % E #E by element-size-1 list of facets % F #F by element-size list of elements % Outputs: % B #E list...
video_root = 'thumos15_validation' frame_root = 'thumos15_validation_frames' video_list = dir([video_root filesep '*.mp4']); for i = 1:length(video_list) [~,vname,~] = fileparts(video_list(i).name); avi2jpg([video_root filesep video_list(i).name], frame_root); val_video_list(i).video_name = [video_root fil...
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 optimaleva (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. ...
clear all; close all; P01 = 1; D01 = 1; P02 = 1; D02 = 1; % [Nastawy] = fminsearch(@(x) wskaznikJakosci(x), [P0, D0]); lb = [0.3 0.4]; ub = [1, 1]; % [Nastawy] = fmincon(@(x) wskaznikJakosci2(x), [P01, D01, P02, D02],[],[],[],[], lb, ub); [Nastawy] = fminsearch(@(x) wskaznikJakosci2(x), [P01, D01, P02, D02]); % [Nast...
clc;clear; TrainsampleDCT_BG = importdata('TrainsampleDCT_BG.mat'); TrainsampleDCT_FG = importdata('TrainsampleDCT_FG.mat'); mean_BG = zeros(64,1); mean_FG = zeros(64,1); var_BG = zeros(64,1); var_FG = zeros(64,1); %calculate background covariance %%cov_FG = cov(TrainsampleDCT_FG(:,:)); for i = 1:64 %calculate t...
function [f, stats] = deBleach(f, mode, varargin) % f = deBleach(f, mode) removes bleaching % f = deBleach(f, 'runningAvg', FrameWidth) specifies width of avg window [f_, stats] = getF_(f,mode); f = f-f_+mean(f_); % switch mode % case 'exponential' % % Robustly fit a straight line to log(fluorescence) and...
clear close all rootdir = fileparts(fileparts(fileparts(mfilename('fullpath')))); configfile = fullfile(rootdir,'data','config','_scenario_2009_02_12.xml'); report_config(configfile,'report') disp('done')
function ElemS = L_Elem1_3d25(mateprop,ul,xl,ElemFlag,hr,nh1,nh2,nh3,ndf,ndm,nst,nel,nelS,nen,npstr,PSPS,iprob) PatchE = mateprop(1); PatchE = mateprop(1); Patchv = mateprop(2); thick = mateprop(3); Bcol1 = [1; 3]; Bcol2 = [2; 3]; col1 = [1; 2]; col2 = [2; 1]; ElemS = zeros(nel,npstr+1); ...
function ph = pzplot(H, color, markersize, list) % function pzplot2(H,color='b',markersize=5,list=0) % Plot the poles and zeros of a transfer function. % If list is non-zero, a list of the poles and zeros % is superimposed on the plot. if nargin < 4 list = 0; if nargin < 3 markersize = 5; if nargin <2 ...