text
stringlengths
8
6.12M
function a = fn_maskavg(a,mask) % function a = fn_maskavg(a,mask) %--- % region-wise averaging of a according to a 2-dimensional mask % Thomas Deneux % Copyright 2007-2012 labels = unique(mask(:)); nreg = length(labels); s = size(a); [nx ny nt] = size(a); a = reshape(a,[nx*ny nt]); for ireg=1:nreg ind = find(m...
%% %% Fairly realistic configuration with stiff couplings to the outside, small %% inertia on the clutch plates, and moderately heavy load of 10 tons %% %% Initial conditions are 10 rads per second from the driver. %% %% experiment1 = struct( ... 'omega_in' , 10, ... 'k_coupling_1' , 1e8, ... ...
function [W] = GetWeights(obj,ann) %GetWeights Summary of this function goes here % Detailed explanation goes here T = [ann; zeros(3,2)]; W = obj.invL * T; end
clear all;close all; img = double(imread('cameraman.tif')); bigImg = rgb2gray(double(imread('hires.jpg'))/255); catImg = rgb2gray(double(imread('cat.jpg'))/255); noiseTemplate = (double(imread('templateNoise.png'))/255); waldoNoise = (double(imread('waldoNoise.png'))/255); tempConv1 = imgaussfilt(noiseTemplate,2); te...
% function [replica_t, replica_f] = replica_creator2(threshold_dB_down, f_samp); % creates the non linear replica of a whale call based on current spectrogram figure of the whale call. % last modified Dec 02 '10: for flexibility of f_samp % input : threshold_dB_down : how much below the maximum amplitude you want th...
function [wpt,flag_change] = calculate_postion_xplane(wpt_prev,WPT,HLI_vel,HLI_max_dyaw,dt,chk_range) % WPT :: waypoints solved by using line-line search. in this function, this % point can be considered as the goal point. theta = atan2(WPT(1,2)-wpt_prev(2),WPT(1,1)-wpt_prev(1)); if abs(theta-wpt_prev(3)) > HLI...
function [Xs, Cs]=sortcop(C,X) % generating rank correlated samples using Gaussian copula % Input: % C : correlation matrix of the variables (nvar,nvar) % X : uncorrelated samples % Output: % Xs : Rank correlated samples with C % Cs: Correlatoin matrix of rank-sorted samples of Xs. % Gurkan Sin (2016),...
%Program to get QRS Peaks and Heart Rate from ECG signal [filename,pathname]=uigetfile('*.*','Select the ECG Signal'); %Command for selecting ECG Signal file in the current working directory filewithpath=strcat(pathname,filename);%Variable to store the file name and path Fs=input('Enter Sampling Rate: '); %Inputtin...
function calibpatterntest function y = f(x) y = 0.5 * sin(x); end T = 2*pi; % TODO: what if T is not pi?? function c = colorAt(x,y) c = 1; % white by default if y > f(x) + 0.5*T % upper half if x > (-f(y) + 0.5*T) && x < (f(y) + T) c = 0; end if y > -f(x) + T c = 0; end else if x < -f(y) +...
function a = setState_satVapor(a) % SETSTATE_SATVAPOR Set the fluid to the saturated vapor state at the % current temperature. % thermo_set(a.tp_id,3,0);
function [PP_CFG, PP_DATA] = REC_postprocessing(PP_CFG, PP_DATA, CFG, DATA, test_idx) PP_DATA.tests{test_idx}.test_name = CFG.general.short_names{test_idx}; if ~isfield(DATA.tests{test_idx}, 'num_bursts') PP_DATA.tests{test_idx}.key_factor_name = PP_CFG.tests{test_idx}.key_factor_name; PP_DATA.tests{test_idx}...
clear; clc; load('im_matrix_webcam_adjusted'); for i = 1:64 im = im_matrix(:,:,3*(i-1)+1:3*(i-1)+3); figure; subplot(1,3,1); imshow(im); [BW, maskedRGBImage] = createMaskWhitePiece(im); subplot(1,3,2); imshow(BW); se = strel('disk',8,0); im = imopen(BW, se); subplot(1,3,3...
function [energy,nbper,voltage,harmnumber,U0]=atenergy(ring) %ENERGY=ATENERGY(RING) Gets the RING energy % ATENERGY looks for the machine energy in: % 1) the 1st 'RingParam' element % 2) the 1st 'RFCavity' element % 3) the field "E0" of the global variable "GLOBVAL" % %[ENERGY,PERIODS]=ATENERGY(RING...
function [ret] = jess(varargin) % Example call: % jess printout t (jess-version-string) crlf... % "2 x 3 = " (* 2 3) crlf; j = global_jess_engine(); expr = cat_with_spaces(varargin{:}); ret = jess_value(j.eval(['(' expr ')'])); end
p1=[1 2 -3 7 -8 7]; p2=[1 3 -5 9 11]; p3=[1 -2 -3 9]; p4=[1 -5 13]; p5=[1 5]; disp(polyval(p1,2)); disp(polyval(p2,2)); disp(polyval(p3,2)); disp(polyval(p4,2)); disp(polyval(p5,2));
clear; clc; addpath('./utils/'); %% data path data_path = '../train_data/291'; save_path = '../train_data/vdsr_train.h5'; %% data configuration patch_size = 41; stride = 41; flip_parameter = [0 2]; % [0 1 2]; rotation_parameter = [0 90]; % [0 90 180 270]; scale = [2 3 4]; %% file path file_list = []; file_list = ...
function plot_results(scenfile,savefile,scenonly,stepon,saveplot,plotfile) % Copyright (c) 2003-2004 Songhwai Oh global G if nargin<3, scenonly=0; end if nargin<4, stepon=0; end if nargin<5, saveplot=0; end scen = load(scenfile); result = load(savefile); G = scen.gvs; Tall = scen.gvs.TMAX; figure ...
function cor = J_COR(sinogram) % Returns the center of rotation of the current set of projections % represented by sinogram % Computes from projections at angle 0 and 180 degrees which should be the % same images but mirrored about the center of rotation %Projection at angle 0 vec1 = sinogram(:, 1); %Projection at an...
function [varargout] = Test_generateHyperbolicCurveData(varargin) %Test_generateHyperbolicCurveData Generates a data set of parabolic curve components % % Generates a set of points distibuted over several hyperbolic curve components. % % USAGE: % Sm = Test_generateHyperbolicCurveData(N, K, d, r, p, q) % % IN...
%% fn_fileparts %% Syntax % out = fn_filename(fname,flag) %% Description % % Input: % - fname file name % - flag one of the possible flags below % % 'path' returns the path (fn_filename('a/b/','path') returns 'a') % 'base' removes the path and the extension (fn_filename('a/b.c','base') % ...
function[] = sort_ind_features_according_to_subjects_and_products() % this KNN classifier will compute an accuracy table (in .csv format) for % subject category and product catagory corresponding to Avg EEG power bands, % Spectral energy, peak alpha and hemispheric assymetry features. % constants FEATURE_NO = 4; % ...
function [mrk,i_select] = tl_mrk_assembleTrials(mrk,trial_type,events_must,events_mustnt) global opt mrk = mrk_sortChronologically(mrk); % markers if strcmp(trial_type,'all') mrk = tl_mrk_unifyMarkers(mrk,'start'); ci_ts = find(strcmp(mrk.className,'start')); else ci_ts = find(strcmp(mrk.className,['sta...
eacharm1 = NaN(3,3,11); aall = NaN(3,11); for id = 1:11 % load(d2(id).name,'RP_Arm_Classifier_type1_eacharm','RP_Arm_Classifier_type1_a','RP_Arm_Classifier_type1_s') load(d2(id).name,'RP_Arm_ds_Classifier_type1_eacharm','RP_Arm_ds_Classifier_type1_a','RP_Arm_ds_Classifier_type1_s') eacharm = RP_Ar...
function test_all_so1(gNo, setNo) % Run all test routines that do not require a solved model % -------------------------------------------------- cS = const_so1(gNo, setNo); fprintf('\nTesting everything\n'); %% Grouped % Parameters param_so1.test_all(gNo, setNo); %% Aggregation aggr_so1.aggr_stats_test(gNo, se...
% AUTOSEGMENT Automatic segmentation of breast lesions using texture analysis. % [I,S] = AUTOSEGMENT(I) computes the automatic lesion segmentation (i.e., it % does not require user-dependent parameters) using log-Gabor filtering % and texture analysis, where I is the breast ultrasound image. This method % was ...
function [xyz] = uvd2xyz(u, v, d, fc) % By Yiren Lu at University of Pennsylvania % Mar 21 2016 % ESE 650 Project 4 % Inputs: % uvd: n*3 uvd points % fc: focal parameters % Outputs: % points: n*3 xyz points; % convert UVDepth to 3d points % U-> X, V->Z, Depth->Y % y = Depth/1000; % dept...
function u = RSF(u0,Img,Ksigma,KI,KONE,nu,timestep,mu,lambda1,lambda2,epsilon,numIter) u=u0; for k1=1:numIter u=NeumannBoundCond(u); K=curvature_central(u); DrcU=(epsilon/pi)./(epsilon^2.+u.^2); % eq.(9) [f1, f2] = localBinaryFit(Img, u, KI, KONE, K...
function result = find_corner_points(img, nb_groups) % Loop through grouped image % find MIN_ROW & MIN_COL and MAX_ROW & MAX_COL matrix_size = size(img); MAX_ROW = matrix_size(1); MAX_COLUMN = matrix_size(2); GROUP_MAX_ROW = zeros(1,nb_groups); GROUP_MAX_COL = zeros(1,nb_groups); GROUP_...
function RHS = AssembleRHS( solution_coeffs, L, J ,N) r = solution_coeffs(1:N); v = solution_coeffs(N+1:2*N); r = r + L*(r<0) - L*(r>L); % Calculate electron number density ne = GetDensity( r, L, J ); % Solve Poisson's equation n0 = N/L; rho = ne/n0 - 1; phi = Poisson1D( rho, L ); % Calculate elect...
X=0 :0.001 :2; function R = g(x) R = log(1 + x) + 0.2; end; Y=g(X); vectX1 = suiteVect(0.5, @g, 10.^(-5)); vectY1 = []; for i = 1:length(vectX1), vectY1 = [vectY1 g(vectX1(i))]; end vectX2 = suiteVect(1, @g, 10.^(-5)); vectY2 = []; for i = 1:length(vectX2), vectY2 = [vectY2 g(vectX2(i))]; end plot(X,Y,X,X); ...
function kx = lin_kernel2(x, xKern, theta) % KERNEL Compute the linear kernel q = size(x,2)/2; kx = theta(1)*x(:,1:q)*xKern(:,1:q)' + theta(2)*x(:,q+1:end)*xKern(:,q+1:end)';
% draw the contour diagram clear clc tic; M=importdata('bistabilityphase.txt'); x=M(:,1); y=M(:,2); N=M;%(find(x>=1&x<=20&y<=1e7),:); x=N(:,1); y=N(:,2); z=N(:,3); w=N(:,4); Barrier=[z,w]; minbarrier=min(Barrier,[],2); clear M N [X,Y]=meshgrid(4:0.005:10,0:1e3:2e5); Z=griddata(x,y,z,X,Y); Z(find(Z<1e-3))=0; W=gridd...
% this script runs a solver with increasing # of time steps and outputs the % error. the main purpose is to look for stable-unstable-stable situation % Comparison is with fine solution urk4; % % initial parameters minerr=9.9e-4; n=250; % grid parameters m=1+2*2048; Tf=0.4189; % set fine grid solution (if nece...
function [D, D_size] = min_entropy_predictor(img, chrom_subsample) % raw_image = ictRGB2YCbCr(img); [h, w, d] = size(raw_image); if chrom_subsample S = resample_ycbcr_encoder(raw_image, 0); h_range = h/2; w_range = w/2; D_size = [h, h_range, h_range; w,...
function [R] = dividesex_2way_Godfrey(T) %{ For the table 'Weight' this will create new tables that Male Control, Male Fasted, Female Control, and Female Fasted. Used in the function createLDBstruc_2way_Godfrey.m %} a = {'Male';'Female'}; b = categorical(a); c = {'Control';'Fasted'}; d = categorical(c); % Deleting ...
function Eog = eeglab_extract_eog(EEG, veogChanNames, heogChanNames, varargin) %CTAP_EXTRACT_EOG - Extract veog and heog signals based on channel names % % Inputs: % EEG struct, EEGLAB struct % *ChanNames cellstr, Channel names. Allowed compositions are: % {},{'chname1'},{'chname1','chname2'}...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Inputs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %T: number of stages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %M: number of ...
% traning set s = [1 1 1; 1 2 0; 2 -1 -1; 2 0 0; -1 2 -1; -2 1 1; -1 -1 -1; -2 -2 0]; t = [-1 -1; -1 -1; -1 1; -1 1; 1 -1; 1 -1; 1 1; 1 1]; Q = 8; M = 2; alpha = 1; b = [0 0]; w = [0 0; 0 0; 0 0]; theta = 0.1; function f = bipolar(x,theta) if x > theta f = 1; elseif x < theta * -1 f = -1; else f = 0; end en...
% Plots globe with stations on it grs80 = referenceEllipsoid('grs80','km'); figure('Renderer','opengl') ax = axesm('sinusoid'); axis equal off load topo geoshow(topo,topolegend,'DisplayType','texturemap') demcmap(topo) land = shaperead('landareas','UseGeoCoords',true); plotm([land.Lat],[land.Lon],'Color','black') riv...
function varargout = dataCollectionTool(varargin) % DATACOLLECTIONTOOL MATLAB code for dataCollectionTool.fig % DATACOLLECTIONTOOL, by itself, creates a new DATACOLLECTIONTOOL or raises the existing % singleton*. % % H = DATACOLLECTIONTOOL returns the handle to a new DATACOLLECTIONTOOL or the handle to %...
function isafd = isa_fd(fdstr) % ISA_FD checks a struct object for fields 'coef' and 'basisstr' % last modified 23 May 1998 isafd = 1; if ~strcmp(class(fdstr), 'fd') isafd = 0; return; end
% Classical fourth order Runge-Kutta method % Integrates n first order differential equations % dy(x,y) over interval x to x + dx % Written by Izzi Urieli (http://www.ent.ohiou.edu/~urieli/odes/odes.html) %-------------------------------------------------------------------------- function [x,y,dy] = rk4(deriv,n,x,...
function [physdata,filtphysdata] = MBONphysanalysis(savefigs) cd ../../../../Volumes/'Samsung_T5'/'Electrophysiology data'/'MBONDAN raw data' physatlasloc='/Volumes/Samsung_T5/Electrophysiology/MBON.xlsx'; atlas=readtable(physatlasloc); atlas=rmmissing(atlas); %atlas=table2struct(atlas); atlas.celltype=categorical(a...
function [ output_args ] = mtspCompareOldNew(old,new,recal) %mtspCompareOldNew - compare old and new annoations quantities % There may be disparities in the number of files of each one, so just try % to focus on the new files, where present... numN = size(new.group,1); % Store the old|new|ppm deviation in here match ...
function sps = get_sps(psth, bin) % GET_SPS -- Convert logical psth to sps/s. % % sps = ... get_sps( psth, 50 ) uses 50ms bins to calculate the % spike-rate. % % IN: % - `psth` (Container) -- Object whose data are a logical matrix. % - `bin` (double) -- Bin size, in ms. % OUT: % - `...
% Cultural Algorithm (CA) classdef ypea_ca < ypea_algorithm properties % Acceptance Rate accept_rate = 0.2; % Influence Method Type % Possible Values: % 1 - Using only normative component of culture (for size) % 2 - Using only situational compon...
function CSD_cs = splineCSD(pot, varargin) % calculate inverse current source density with splines import csd.* ip = inputParser(); ip.addParameter('el_pos', (1:size(pot,1))'*.1) % mm ip.addParameter('ex_cond', 0.3)% [S/m] ip.addParameter('top_cond', 0.3) % [S/m] ip.addParameter('diam', 0.5) % mm ip.addPara...
%% Q2-CS 663 Assignment 2 Bilateral filtering %% Code explanation % 3d convolution % we create a 3d space with one more dimension(intensity). % since gaussian is separable the convolution will be separated out into % convolution over x, over y and then over Intensity dimension. % this 3d convolution is done once for ...
%% Save Images in Matlab Structures % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% INPUTS % --------> obj,event: Arguments that need to be defined in the function % for the timer scheduler function to work but do not need to do anything % inside the function % --------> pDIC: Directory were the microscope images are going to be ...
time_vector = linspace(0, num_sim_iters*Ts, num_sim_iters+1); solvers = fieldnames(X); figure(1); clf; for i=1:4 subplot(4, 2, i); hold on; for j=1:numel(solvers) plot(time_vector, X.(solvers{j})(:, i)) end title(['x ' num2str(i)]) end subplot(4, 2, 5); hold on; for j=1:numel(solvers) st...
function phi = segmentation_pairwisePotts_featuremap(param, X, Y) %segmentation_pairwisePotts_featuremap computes the joint feature map phi(X, Y). [param is ignored] % % phi = segmentation_pairwisePotts_featuremap(param, X, Y) % % It is important that the implementation is consistent with the segmentation_pairwisePott...
function [ featureImage, featureVertex ] = ... selectFeaturePoints( I, V, F, cameraPos, cameraLookAt, cameraUp, fov ) % Tao Du % taodu@stanford.edu % Feb 11, 2015 % % Select feature points from both images and 3D shapes. % Input: I: an image. % V, F: vertices and faces. Output from readObj. Assume V has been %...
function rgb = task_purple rgb = [159, 41, 110] / 255; end
function [W, Y] = blockRepresentation(v, betav) % Algorithm computes matrices W, Y in R^{m, n} such that Q = Im - WY' Y = v(:,1); W = betav(1) * v(:,1); [rows, cols] = size(v); for j = 2 : cols M = W * Y'; [r2,c2] = size(M); z = betav(j) * (eye(r2,c2) - M) * v(:,j); W = [W, z]; Y = [Y, v(:,j)]; end en...
function spatialPDR % A FUNCTION TO RUN A SPATIAL PDR EXPERIMENT WITH AN ADAPTOR global PDR TDT HRTF session % DEBUGGING FLAG TO SKIP TDT INSTRUCTIONS DEBUG=PDR.DEBUG; %% INITIATE TDT PARAMETERS HERE TDT.nPlayChannels=2; TDT.playpts = {[PDR.buf_pts PDR.buf_pts],[PDR.buf_pts PDR.buf_pts]}; if(PDR.record>0) TDT.nRe...
% addpath(genpath('/Users/yufei/Documents/2-CMU/PowerIter')) %% Set up clear; close all; clc mat = csvread('so2_15to18.csv', 1, 1); disp(size(mat)) % Take the difference % mat = diff(mat, 1, 2); % disp(size(mat)) % Use the first half as train set. n_train = 291; mat = mat(:, 1:n_train); disp(size(mat)) % Normalize...
function [totalIndWeighting, accLess, accMore, cost_function_names, constThres, maxInd, rmse_report] = ... loadFileAndSegment(matFilesToLoad, currInstName, indTotal, outputPathLocal, masterOverall, masterSaveOverallSeg, comments, thresholdMultiplier, masterFigureSave) plotFig = 0; outputPath = outputPathLocal...
function plotPosition(pos, time) %画出粒子运动的函数 global dt isOutVideo; figure(1) if isOutVideo == true %打开一个视频对象 writerObj = VideoWriter('paticle_trace.avi'); writerObj.FrameRate = floor(1/dt); open(writerObj); end for t = 1:length(time) %画出粒子当前位置,包括粒子位置,之前的轨迹 ...
function [accel_time_0_60,accel_time_0_85,accel_time_40_60,max_accel_ft_s2,feet_5sec]=accel_test() % This runs a maximum acceleration test to find the time % required to reach 0-60 mph, 0-85 mph, and 40-60 mph by applying % a step function of 200 mph as the required speed. % The function also finds the maximum accele...
%------------------------------------------------------------------------------------ % % M-file: CpO.m (Specific heat Oxygen, CpO. [J/(mol*C)]) % % Data from Felder, Rousseau "Elementary Principles of Chemical Processes", % 2nd ed., 1986, John Wiley & Sons, Inc. % Valid in the temperature range [0-1500]degrees C, ...
%------------------------------------------------------------------------------- % USAGE of "demo_pdint". % % A demo that computes the values of the interpolant of a function "f" % in a prescribed set of points, knowing its samples at Padua Points. %---------------------------------------------------------------------...
[bestc_aud bestg_aud grid_audio g_params_aud c_params_aud] = svm_find_libsvm_parameters_v5_2_audio_only %find best audio params string = 'bestc_aud bestg_aud g_params_aud c_params_aud'; string2 = [num2str(bestc_aud), num2str(bestg_aud), num2str(g_params_aud), num2str(c_params_aud)]; string3 = [string, string2]; save(...
% function handles = Vicon_grab(handles) % Get a frame while MyClient.GetFrame().Result.Value ~= Result.Success % disp('got frame') end % Get the frame number Output_GetFrameNumber = MyClient.GetFrameNumber(); % Get the frame rate Output_GetFrameRate = MyClient.GetFrameRate(); % Count the number of subjects...
% set_goal function n_goal=node; x_goal=x; y_goal=y; set(q_goal,'xdata',x_goal,'ydata',y_goal); path_nodes = g.Astar(n_start,n_goal); g.highlight_path(path_nodes,'NodeSize',4,'EdgeColor',[1 0.5 0]);
function centroids = initCentroids(X,K) %CENTROIDS initializes the K centroids and %returns K random indices from X as centroids %randperm method will randomly reorder the indices % of the dataset centroids = zeros(K, size(X,2)); randidx = randperm(size(X,1)); centroids = X(randidx(1:K), :); end
function [X, C, I, signals] = fishery(inp,par) % state update func = (0.02.*(inp.X{1}-inp.X{1}.^2/1000)-inp.U{1}); X{1} = inp.Ts.*func + inp.X{1}; % cost C{1} = -inp.Ts.*inp.U{1}; % infeasibility I = 0; signals.U{1} = inp.U{1};
function [A, err]=RAS(A0, u, v) % исходим из следующих предположений % А0 - базовая матрица % u -- вектор строковых сумм у целевой матрицы % v -- вектор стобцовых сумм у целевой матрицы % A -- целевая матрица % err -- бинарная переменная, отвечающая за ошибку, т.е. если наш метод % не сойдет...
function res = RandomString(min, max) size = randi(max-min,1,1) + min; alpha = ['A':'Z' 'a':'z']; res=''; for i=1:size res(i) = alpha(randi(length(alpha))); end end
%************************************************************************** % % NoiseAndCarrier.M % %************************************************************************** f1=200; %信号1频率为200Hz f2=800; %信号2频率为800Hz Fs=2000; %采样频率为2KHz N=14; %量化位数 %Pn=Pn0*Fs/2; %噪声信号功率 %width=0.5; %函数SAWTOO...
%Reset all: close all; clear, clc; addpath('Data'); %Load general data: load('DataBroadcastGossipGeneral.mat'); load('DataPushSumGeneral.mat'); %Matrix that contains all data: values_gossip = zeros(number_topologies, number_frequencies, number_timers, number_simulations, number_probabilities); values_pu...
% This script calculate the perturbed magnetic field and save to B_pert/ clear; close all; global den Te vi jz ve phi vEx vEy vdex vdey dt inv_nustar calc outside ... ddx if ~exist('B_pert') mkdir('B_pert'); end %% load('parameters.mat'); addpath(code_path); last_file = get_last_file('./'); last_diag = str2num(...
function err=polygonerr(x,y,F) %F stammfunktion von F intp=0; for i=1:length(x)-1 intp = intp + (y(i)+y(i+1))/2 * (x(i+1)-x(i)); end intf=F(x(length(x)))-F(x(1)); err=intf-intp; end
i = int16(0); j = int16(0); RED = int64(0); for i=0:255 for j=0:255 RED =double(RED)+double(abs((i*j-dadda_mul1(i,j)))) end end MED = vpa((RED)/(2^16)) NED = vpa(MED/(2^8-1)^2)
% CEE 530 Final Project % Author: Haitong Wang % 2D FEM Diffusion problem (time-dependent) % modified for testing manufactured solution % element stiffness matrix for 3-nodes triangular element using 2-points % gaussian quadrature function [ke,me,fe] = elementstiff_diffManuSol(node,e,phi,dphixy,detJcob,D_T,GQ,x,y,fm...
%% getML_RLSimAtDifferentLearningRate.m % Simulatie learning at different learning rates %% Monk = 'Cy'; NSEN = 200; NTUNE = 36; eln_ = [2.75]*1e-8; %for correlated response DIRS = [-90 90]; SIMNUM = [81:85]; RECOMPUTE = 1; % 25 7 for kk = 1:length(SIMNUM) for i = 1:length(eln_) ...
function flex_search_150207(dict, parms, raw, msk, searchparms, t1map, betamap, timing_parms) % function flex_search_150207(dict, parms, raw, msk, searchparms, t1map, betamap, timing_parms) % % this function searches over a dictionary % it uses pixel mask to save time (msk) % % like this: % flex_search_15020...
%clear % size of domain sX = [25 44]; % number of pixels to taper over (x,y) tap_width = [10 18]; taperX =exptap(1,sX(1),tap_width(1),[1:sX(1)]); taperY =exptap(1,sX(2),tap_width(2),[1:sX(2)]); taper_2d=repmat(taperX',[1 sX(2)]).*repmat(taperY,[sX(1) 1]); subplot(1,2,1) plot(taperX) hold on plot(taperY) hold off ti...
close all y = load('gm_timecourse.dat'); y = differencer(y,3); y = y-mean(y); y = y/norm(y); for beta=linspace(20,90,10); phys_parms.f = 0.01; phys_parms.mtis0 = 1 ; phys_parms.cbva = 0.03 ; phys_parms.transit= 0.2 ; phys_parms.kfor = 0.002 ; phys_parms.r1tis = 1/1....
function CV=Cross_Val(X,Y,n) %this function performs the cross validation n amounts c=cvpartition(length(X),'kfold',n); MSE=zeros(c.NumTestSets,1); for ii=1:c.NumTestSets train_x=X(training(c,ii),:); train_y=Y(training(c,ii)); test_x=X(test(c,ii),:); test_y=Y(test(c,ii),:); b=(train_x'*...
clear all close all %declare global variables global proposalLB global proposalUB global proposalMean global proposalSD global data global noUnknowns global priorLB global priorUB global expRows global expColumns global noExperiments global likelihoodRecord global proposedParameterRecord global accepted global priorMe...
% Copyright (c) 2015 Reinaldo Astudillo % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associated documentation files (the "Software"), to deal % in the Software without restriction, including without limitation the rights % to use, copy, modify, merge, publ...
function w = window(N,wt) % % w = window(N,wt) % % generate a window function % % N = length of desired window % wt = window type desired % 'rect' = rectangular 'tria' = triangular (Bartlett) % 'hann' = Hanning 'hamm' = Hamming % 'blac' = Blackman % % w = row vector containing ...
function total_sum = total_res(imgs,sig,amps,centers) % input: imgs - all images, sig - calculated sigma values, amps - % calculated amplitude values, centers - determined center coordinates % output: total_sum - sum of error squared [w,h,n] = size(imgs); total_sum = 0; for i =1:n total_sum = total_sum + sum...
function [score,speed] = tdnn_csm_score(ffnet,L,FeaturesBundle,dxyBundle,targetBundle,P) %CSM_SCORE : Cumilitative Success Model Score N = length(targetBundle); score_temp=0; speed = 0; Nsd = 13; all = true; success_count = 0; X=[]; for i=1:N %get features [Xt] = getDataSetx2(FeaturesBundle{i},targetBundle{i},d...
function max_r=semivar_get_max_range(Va); if ischar(Va); Va=deformat_variogram(Va); end max_r=0; for i=1:length(Va); max_r=max([max_r Va(i).par2(1)]); end
%% Normalizer clc clear all %% % mkdir('Data_4_new\','Var2'); WIN = 2; count = 1; ID1 = 't'; % for ID1 = ['qwertyuiopasdfghjklzxcvbnm'] % Keys = 90:93; DIR = 'Data_5_new\TX'; % 'Data_5_new\TX' Test_Data M_DIR = 'TX'; % Data_5_new\meanSub\ for k = Keys for i = 1:2 for j = 1:3 load([DIR num2str...
a=input('a='); b=input('b='); %a,b<0 attracter, a,b>0 reppeler ,a>0 & b<0 or a<0 b>0 saddle [x,y]=meshgrid(-3:0.25:3,-3:0.25:3); dx=a*x; dy=b*y; quiver(x,y,dx,dy), axis tight
function y = f(x) y = log(1 + power(sin(x), 2));
function log_prob = noisy_win_stay_lose_shift(epsilon,args) last_reward = nan; last_action = nan; actions = args(:,1); rewards = args(:,2); log_prob_actions = zeros(length(actions),1); for i = 1:length(actions) if isnan(last_action) p = [0.5, 0.5]; ...
function h=browser(databatch_name, mode, h) %h=browser(databatch_name, mode, h) % Creates a data browser by passing the name of a databatch object as a % string. % Mode is either 'M' or 'K' for regular movie a Kinect depth. % Returns the figure handle. % Isabelle Guyon -- isabelle@clopinet.com -- October 2011 i...
% Complete PATH addpath("../helper_methods", "--begin") addpath("../utils", "--begin") % Set example data useExampleFile = true; fName = "testData" % Get filename from directory if we are not using the example data if ~useExampleFile fNumber = 5; fName = getFilenameFromNumber(fNumber, ['/home/', getenv('LOGNAME')...
% Function to generate the approximate entropy profile of a given time-series function [AEprofile]= apEnProfiling(ts,m) % AEprofile - approximate entropy (ApEn)profile w.r.t parameter r % ts is the input time-series % m is the embedding dimension (normally take values 2 or 3) [b,a,range] = CHMforApEn(ts,m); % Cumuati...
function [hmm,Gamma,Xi,fehist] = hmmtrain(data,T,hmm,Gamma,residuals,fehist) % % Train Hidden Markov Model using using Variational Framework % % INPUTS: % % data observations - a struct with X (time series) and C (classes) % T Number of time points for each time series % hmm hmm structure...
function [ Zin ] = inputImpedanceBig(omega,rho,mu,E,h,r,l,sigma,phi0,k,R,L,C,Rc) %%INPUTIMPEDANCEBIG receives all relevant constants and variables and %%outputs the input impedance of a vessel j = sqrt(-1); phi = wallVisc(phi0,k,omega); C0 = moensKorteweg(E,h,rho,r); Zt = terminalImpedance(Rc,omega,L,R,C); alpha = wom...
function fb1=melfilter(fs1,fsize1,noc1) fmax = fs1/2; % maximum frequency Nmax = fsize1/2; % maximum fft index melmax = freq2mel(fmax); % maximum mel frequency df = fs1/fsize1; %frequency increment on linear scale ie. frequency resolution dmel = melmax / (noc1 + 1); % frequency increment on mel scale %center f...
function data=fly_acthisto(file,n) % Reads through "a" from fly_sleepthresh (which looks like this: % 0;1;1;1;1;1;0;0, where 0s are minutes of non-sleep and 1s are minutes of % sleep. Wherever there is a 0, this code replaces the 0 with a 1, and % continues adding onto that point for however consecutive 0 data poi...
function [delta,epsilon] = deltaeps(z, images, lockout) % [delta,epsilon] = deltaeps(z, images) % Delta-epsilon method % z -- embedded data as from getimage() % images -- as from getimage() % lockout-- don't consider points closer in time than this % -------------- % delta -- distances between pre-images % eps ...
function [frame,gazex,gazey,confidence] = import_Pupil(filename, resolution_X, resolution_Y) dataArray = readtable(filename); frame = dataArray.index; gazex = dataArray.norm_pos_x .* resolution_X; gazey = dataArray.norm_pos_y .* resolution_Y; confidence = dataArray.confidence;
function [tri,V]=triPoly(poly) % Triangulates a single polygon with holes. Self intersection? E=zeros(0,2); V=zeros(0,2); for i=1:length(poly) ind=(1:size(poly(i).xy,1))'+size(V,1); E(ind,:)=[ind ind([2:end 1])];% edges V(ind,:)=poly(i).xy;% vertices end if isempty(V) tri=[]; return end DT=delaunay...
clear all close all %% [A,fs]=audioread('queen.wav'); Audio=A(:,1); for i=20000:10:100000 Audio(i) = Audio(i) + rand*rand; end u= 0.1; % learning rate order=30; % number of filter coefficients figure, w= zeros(1,order); iter=1; for n=order+1:numel(Audio) if rem(n,4000)==0 stem(w) title('Filte...