text
stringlengths
8
6.12M
function [y,e,w]=lms(x,d,Nw,mu) N=length(x); w=zeros(Nw,1); x=[zeros(Nw-1,1);x]; y=zeros(N,1); e=y; i=1; while i<=N y(i)=w'*x(i:i+Nw-1);%filtering, aka, y = x conv w e(i)=d(i)-y(i);%error = desire signal - output error dw=mu*e(i)*x(i:i+Nw-1); w=w+dw;%update filter kernel i=i+1; end end
function [ da, xall_list, lall_list, xv_list, lv_list] = geovoronoi(xyz, esax, psax) %gpath = getenv('GITHUB_PATH'); %addpath(fullfile(gpath, 'geographiclib-code/matlab/geographiclib')); % % % Assumes z-orientation of the symmetry axis % % esax:: equatorial semi axis % psax:: polar semiaxis % % % % % % % chi = esax/p...
clear all; close all; clc; load('filter2.mat'); x = a{1}; z = upsample(a{2},3); for l = 1:3 z = conv(a{2},z); z = upsample(z,3); end z = downsample(z,3);
function number = PorN(number) % return whether a number is positive if number > 0 number = 1; elseif number < 0 number = -1; else number = 0; end end
run(global_var_file); sc_m=all_sc_m(1); sc_n=sc_m-1; koshino_bands_filename = ['TwBLG_tbh-bands_',num2str(sc_m),'_',num2str(sc_n),'_koshino-inter']; dft_bands_filename = ['TwBLG_tbh-bands_',num2str(sc_m),'_',num2str(sc_n),'_dft-inter']; %{ fprintf(['loading file: ' koshino_bands_filename '.mat \n']); load([bands_d...
% This class creates objects for displaying and analyzing fiber scans from % a LUNA optical backscatter reflectomer. LUNA objects are created from a % source file: % >> object=LUNA(filename); % Binary (*.obr) and text files are both accepted. If no file is % specified, the user is prompted to select one. % % LUNA...
% show color features function mk_monkeyInDiffColorSpace clc;clear all;close all; currFrame=imread('C:\zxk\Research\monkeyData\Camera1_extractedVideos\_extracted_100\Temp1-121668.png'); figure;imshow(currFrame);colormap(jet);title('Original'); figure;imshow(currFrame(:,:,1));colormap(jet);title('RGB_R'); figure;im...
clear close all clc folder='R:\Projects\NRI\User_Study\Data\txtFile\'; filenames={'TestRegA.txt' 'TestRegA2.txt' 'TestRegB.txt' 'RegTestSept15.txt' 'OrganRegNewJSept15.txt'}; % 'TestRegA3.txt % Continuous data, not easy enough to parse, ignored labelList=[51,52,50,53]...
clc clear all % pitch=5:10:95; % thita=6:2:24; % pitch=5:10:95; %unit: um lambda=632.8e-3; db=10000; for m=6:10 for n=1:5 clear x y thita=6; type=500; offsetx=42000+(n-1)*8000; offsety=(m-1)*8000; T=lambda/asin(thita/180*pi); pitch=ceil(type/T)*T; ...
function [motilities_out filolengths_out] = motility (drawings, labels, opts) %A DYNAMO ANALYSIS FUNCTION %All Dynamo analysis functions take three arguments: % drawing: a Dynamo saved structure containing the fields 'states' and 'traits' % labels: a structure containing the annotation key used in drawing % ...
%@(#) cycstep.m 1.13 00/10/06 12:38:39 % function cycstep load simfile tx=readtextfile('comp-ref.sim'); stx=size(tx); tx(1,:)=setstr(32*ones(1,stx(2))); tx(1,1:41)=sprintf('%s%5.0f%s%5.0f%s','TITLE Burnup case ',blist(1),' - ',blist(2),' EFPH'); row=bucatch('OPTION',tx(:,1:6)); tx(row,:)=setstr(32*ones(1,st...
run_set_path rng('shuffle'); nVidNodes = 1; nDataNodes = 1; nWebNodes = 1; videoBpsMultiplier = 0.5; dataBpsMultiplier = 0.5; webBpsMultiplier = 0.5; % Load in a real video file to test against vu = video_util(); vu.nFrames = 250; vu.prep(); slotsPerVPacket = 10; qualityThresholdMicrosec = 50000; % 50 miliseconds ...
function [ correct, prob ] = weka_evaluation( classifier, vecTest, gtTest ) %WEKA_EVALUATION Summary of this function goes here % Detailed explanation goes here % add weka path % javaaddpath('/home/evargasv/weka-3-7-11/weka.jar'); if strncmp(computer,'PC',2) javaaddpath('C:\Program Files\Weka-3-7\weka.ja...
function pochodnapar % obliczyc pochodne funkcji y=f(k*sin(k*x)) % deklarowanie zmiennych syms t k %funkcja zdefiniowana parametrycznie x1=k*sin(t)+sin(k*t); x2=k*cos(t)+cos(k*t); %1-sze pochodne dx1dt=diff(x1,t) dx2dt=diff(x2,t) %2-gie pochodne d2x1d2t=diff(x1,t,2) d2x2d2t=diff(x2,t,2) return
clear all; close all; clc figure rndSeed = round(1000*rand); % rng(rndSeed) N = 10; % number of agents X = rand(N,1); % actual performance indices Y = ones(N,1); % initial guess of performance indices k = 1/N; % update gain % do over coalitions for i = 1:500 % create a vector e such that agents corresponding...
% [x,ret] = barvinok(K,P,itn,epsilon,xsdp,rsdp) % % Barvinok's "naive algorithm" based on concentration of measure % (optional) xsdp and rsdp: solution of the SDP (found by sdpnlp) function [xstar,ret] = barvinok(K,P,xsdp,rsdp,itn,epsilon) grads = 0; % use linesearch local NLP solver if (nargin < 6) epsilo...
% figure; % plot(vzlist,rs); % hold on; % plot(vzlist,abs(en)); list=linspace(0,.2,100); rss=zeros(length(list),1); for i=1:length(list) rss(i)=w(list(i)); end
close all clc tic; %% Read image into the workspace. img0 = double(imread('../../middlebury_dataset/Motorcycle/im0.png')); %left POV - shifted to right img0 = imresize(img0,1/5); %% img1 = double(imread('../../middlebury_dataset/Motorcycle/im1.png')); %right POV - shifted to left img1 = imresize(img1,1/5); img0 = img...
%% Mohit Shukla %Informative Prior data=xlsread('C:/Users/caped_crusader/Bayesian Data Analyses/Assignments/HousePrice.xlsx'); %Hyperparameters V_pr=[2.4 0 0 0 0;0 6*10^-7 0 0 0;0 0 0.15 0 0; 0 0 0 0.6 0; 0 0 0 0 0.6]; b_pr=[0;10;5000;10000;10000]; %Prior beta h=4*10^-8; N=546; n_pr=5; %Prior nu ...
fgIndex = csvread('case.csv',1); bgIndex = csvread('control.csv',1); expData = readtable('expression.csv'); annot = readtable('annotations.csv'); annot = annot(:,2); inputNetwork = readtable('network.csv'); platformGene = unique(annot); edgesToKeep = sum(ismember(table2array(inputNetwork(:,[1,2])),table2array(platformG...
function result = ex_CSTask(e) % ex file: ex_CSTask % % Uses codes in the 2000s range to indicate stimulus types % 2001 - visually guided saccade % 2003 - delayed visually guided saccade % % Uses codes in 1500s range to indicate properties of trials % 1500 - target is on the right hemisphere % 1501 - target i...
function [yr,mo,dy,hr,mi,se,data,index] = timeSeriesData(timeData,timeStep,t1,t2,predata) %% This script detects and fills gaps in time series data using autoregressive modeling % [timeData]: timeInput in the format of matlab datetime % [timeStep]: time steps of desired time series e.g. hours(1)-->every 1 hr % he...
%% Only include subs with complete data mod_wrksht = analysis_matrix; count = 0; for i = 1:size(analysis_matrix,1) skip_row = 0; for j = 1:size(mod_wrksht,2) if isnan(mod_wrksht(i,j)) skip_row = 1; end end if ~skip_row count = count + 1; complete_subs(count,:...
function str = CreatePolyFromMatrix(A,C,names,precision,target) persistent BLOM_FunctionCodes if isempty(BLOM_FunctionCodes) BLOM_FunctionCodes = BLOM_FunctionCode('codes_struct'); end if (nargin < 4) precision = 'high'; end if (nargin < 5) target = 'matlab'; end str = ''; idx = find(C...
function x = bisection(Ffun, a, b, maxit, tol) % % Usage: x = bisection(Ffun, a, b, maxit, tol) % % This routine solves the scalar-valued nonlinear equation f(x)=0 % using the bisection method to a residual tolerance of tol. % % inputs: Ffun nonlinear functional % a REAL lower-bound on in...
clear paramsAll; clear params; params.Gridjob.runLocal = false; params.Gridjob.requiremf = 5000; % measured 3400 MB params.Gridjob.wc_host = '!(*saturn*|*c01grid*|*ramsauer*|*kuma*|*taygete*|*helike*|*leda*|*jupiter*)'; params.Gridjob.jobname = 'Connectome'; params.Gridjob.continue = true; params.Gridjob.initRandStre...
% RGB2LAB - RGB to L*a*b* colour space % % Usage: Lab = rgb2lab(im) % % This function wraps up calls to MAKECFORM and APPLYCFORM in a conveenient % form. Note that if the image is of type uint8 this function casts it to % double and divides by 255 so that the transformed image can have the % proper negative values for...
function [spikes] = spikeclient(selfip,selfport,remoteip,remoteport) spikes = []; pnet('closeall'); initt0 = tic; while 1 %Auto reconnect on failure sock=pnet('udpsocket',selfport); if sock == -1 error('Could not open port %d',selfport); end ...
% process FEA results loadName = 'FEA_processed_data'; saveName = 'FEA_processed_data'; renew_data_load = true % renew_data_load = false er = 0.1; circleDistance = 5000; % distance from base to haltere bulbA = [500,500, 500,500, 353.543,353.543, 1000,1000, 500,500, 353.543,353.543, 1000,100...
function [ robot ] = robotInit( robotName, robotType, portNumber ) %ROBOTINIT Initializes the robot % ROBOTINIT initializes the robot for use with other commands. % It is used as follows: robot = robotInit(robotName, robotType) % % robotName is a string, i.e. 'broodwich', 'madonna', 'samir' % robotType is a...
function x = ndgridmat(varargin) %NDGRIDMAT Matrix of grid points. % y = NDGRIDMAT(x1,x2,...) returns one matrix containing all grid points % as rows. It is the same as concatenating the results of NDGRID. % First dimension varies fastest: % y(1,:) = [x1(1) x2(1) ...] % y(2,:) = [x1(2) x2(1) ...] % Written by Tom M...
function [F] = update_F(Z, k) n = size(Z, 1); opts.disp = 0; % [U,~,V] = svds(Z, k, 'largest', opts); % F = (U*V')'; [Ftmp, ~] = eigs(Z+Z', k, 'la', opts); F = Ftmp'; end
set(groot, 'DefaultTextInterpreter','latex', 'DefaultLegendInterpreter','latex'); close all clear % N -- grid size % p -- probability of a neuron starting in the firing state % t -- time steps per simulation % s -- number of simulations % st -- time steps for which to save the state N = 40; P = 0.3; T = 1000; ...
%Creates the graph of a parabola given two points along the directrix and the focus. %The domain is between the two points given along the directrix. ## Author: Luis <Luis@DESKTOP-I49GOFE> ## Created: 2017-06-21 function [ L , R ] = create_parabola( T , P , n ) P1 = P( : , T( 1 ) ); %First point along ...
%--------------------------------------------------------- % % This function draws the OS4 robot. % % % Developed by Marcelo Becker & Samir Bouabdallah % EPFL - October, 2005 % % BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY % FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABL...
function [x,xp,yp] =circle(x,y,r) ang=0:0.01:2*pi; xp=r*cos(ang); yp=r*sin(ang); %plot(x+xp,y+yp); end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2012 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:/...
function [lambdas, Q] = mQRdynaPas(A, k, tol) M=length(A); B=A; i=M; j=1; [Q,A]=hess(A); %La vuelve en forma hessenberg [X,R]=qr(A); %Aplicamos QR una vez A=R*X; Q=Q*X; while (i>1) T=Q'*B*Q; U=eye(M); while (abs(A(i,i-1))>tol) an = T(i,i); %shift din?mico de Wilkinson an1 = T(i-1,i-1); ...
function [ homogeneities ] = homogeneity( parcels, Z ) %HOMOGENEITY Parcel homogeneity. % Homogeneity of a parcel is measured by calculating the average % similarity between every pair of vertices assigned to it. A global % homogeneity value for the entire parcellation can be later obtained by % averaging the...
function [val]=evaluate_objective_noreg(Tr,R,target,configs) val=1/2*(configs.lambda_1*trace(R'*Tr.L_user*R)+... configs.lambda_2*trace(R*Tr.L_poi*R')+... configs.lambda_3*sum(sum((R-target).^2))); end
function y = WhiteNoise( length ) %WHITENOISE Uniform Distributed White Noise Generator % Generate white noise of length long y = unifrnd(-1,1,1,length); end
order = 4; filename = "fivewo.wav"; [X,Fs] = audioread(filename); norm = Fs/2; value = input('Enter the number of bandpass filters \n'); [B_l, A_l] = butter(order*2, 240/norm); noise = rand(1,length(X)); result = zeros(1,length(X)); B = [;]; A = [;]; Y = [;]; Y_e = [;]; Y_el = [;]; r = nthroot(5760/90, va...
function [cellcount,cellsum,cellsize] = mc_CellSummary(map,nets) u = unique(nets); cellsize = []; cellcount = []; cellsum = []; idx = 1; for i = 1:numel(u) for j = i:numel(u) ii = u(i); jj = u(j); mask = zeros(418,418); mask(nets==ii,nets==jj) = 1; mask(nets==jj,nets==ii) =...
function [V,F,I] = capsule(n,a) % [V,F,I] = capsule(n,a) % % Inputs: % n number of faces along latitude of each hemisphere % a length of cylindrical portion % Outputs: % V #V by 3 list of vertex positions % F #F by 3 list of triangle indices into rows of V % I #F list I(f) = 1,2 or 3 in...
% Function to execute CoFE analysis % Anthony Ricciardi % % Inputs % inputFile - [string] name of NASTRAN-formatted bulk data input file % CASE - [1x#subcases case_obj] array of objects containing case control data % % Output % FEM - [1x#subcases fem] Array of finite element model and solution objects % f...
function rm_axes_interactions(ax) for iax=1:numel(ax) disableDefaultInteractivity(ax(iax)); ax(iax).Interactions=[]; end end
function [interpedx,interpedy,interpedz] = nsimplex_3vec(datx,daty,datz,x_comp_int,y_comp_int,z_comp_int) mx = mean(x_comp_int,2); my = mean(y_comp_int,2); mz = mean(z_comp_int,2); x12 = x_comp_int(:,1) - x_comp_int(:,2); x23 = x_comp_int(:,2) - x_comp_int(:,3); x13 = x_...
% FLUID THERMAL CODE FOR COMPARING THEORETICAL AND EXPERIMENTAL PUMP HEADS % Predict Pump System Perfomance % Calculates pump head close all; clear all; clc % set units (uscs or si) units = 'uscs'; % we are going to get the z2 height from an input box z2 = inputdlg('Provide the outlet height (inlet height assumed t...
function [data] = psd_extraction(signal, header) %PSD_EXTRACTION: creates a psd matrix from given data % Spatial filters: Laplacian % % Input arguments: % -signal: EEG raw signal % -header: EEG data header % % Output arguments: % -data % +data.PSD: [windows x freqences x channels] m...
function BWout=as_bwobjectfun(fun,BW) % BWout=as_bwobjectfun(function,BW) % BWout=as_bwobjectfun(@as_smoothcontour,segBW); [BWLabel, numLabel] = bwlabel(BW); BWout = false(size(BW, 1),size(BW, 2)); j_progress('loop over axons...') for currentLabel = 1:numLabel j_progress(currentLabel/numLabel) currentObjBW ...
clear all; clc; load OED_shepp.mat nImg = [64 64]; idk = randperm(size(A,1)); idk = idk(1:1024); A = sparse(A(idk,:)); % A = sprandn(prod(nImg),prod(nImg),9/prod(nImg)); % A = A + 10*speye(size(A)); %% manipualte last image figure(1); clf; xt =reshape(x_true(:,end),nImg); xt(45:50,40:41) = 1; xt(47:48,40:45) = 1; ...
function t = qiege(image) %用途:去掉不用的黑色区域,使得边界与白色点紧密连接 %注:当时设计的是采用模板识别,所以下面会涉及到分割常规字符与‘1’字符,但已用不上了 [m,n]=size(image); top = 1; bottom = m; left = 1; right = n; while 1 while sum(image(top,:))==0 && top<=m top = top + 1; end while sum(image(bottom,:))==0 && bottom>=1 bot...
function foc = merger_foc(P,MC,X,BETA,ALPHA,XI,NU,SIGMA,merger) [shares, sim_DS,sim_XDS]=merger_shr(P,X,BETA,ALPHA,XI,NU,SIGMA); %MERGER_EQUILIBRIUM: coeffmat = [0,1,0;1,0,1;0,0,0]; if merger foc = shares + (P-MC).*sim_DS + coeffmat*(P-MC).*sim_XDS; else foc = shares + (P-MC).*sim_...
function [V,F] = readOBJ_sequence(prefix) % [V,F] = readOBJ_sequence(prefix) % % Inputs: % prefix glob style paths (e.g., 'mymesh.00*.obj') % Outputs: % V #files cell array of mesh vertex positions % F #files cell array of mesh faces indices into corresponding vertex % positions % ** W...
% Sections marked by the green % are notes that describe what each line of % code represents, or explains what step needs to run the simulation % smoothly. The x-axis of the CW-EPR spectra should be in Gauss. If % experimental spectra are in mT, then lines 77 and 84 in the last section % will need to be changed t...
function Iout=affine_transform(Iin,M,mode) % Function affine_transform, is a wrapper of the (mex) functions % affine_transform_2d_double and affine_transform_3d mex functions % % Iout = affine_transform(Iin,M,mode) % % inputs, % Iin : Input image. % M : Transformation matrix % mode: If 0: linear interpo...
function area = physicalBorderArea(borders, scale, cubeSize, minArea) %PHYSICALBORDERAREA Calculate the border area in physical units. % % INPUT borders: [Nx1] cell or [Nx1] struct % Cell array with the linear indices of the pixels for each % border or % borderStruct array cont...
function [ARE_P,RMSE]=cal_rain_error(rain_field_true,rain_field_esti) ARE_P=abs(mean(mean(mean(rain_field_esti)))-mean(mean(mean(rain_field_true))))/... (mean(mean(mean(rain_field_true)))); RMSE=sqrt(mean(mean(mean((rain_field_esti-rain_field_true).^2)))); end
function Pout = getNearbyPolygons(p,P,sensor_region) % Pout = getNearbyPolygons(p,P,distance) % Pout = getNearbyPolygons(p,P,zone) % % Given a point p (x,y), polygons P (2-by-N points separated by NaNs), and % a distance d, return all polygons with at least one point within a % distance d of p. % % If the last argument...
clear clc image_filename = 'SNAKE.jpg '; coe_filename = 'SNAKE.coe'; image_array = imread(image_filename); [height, width, z] = size(image_array); imshow(image_array); red = image_array(:, :, 1); green = image_array(:, :, 2); blue = image_array(:, :, 3); r = uint32(reshape(red', 1, height * width)); g = u...
il = 2; hl = 2; nl = 4; nn = [ 1:18 ] / 10; X = cos([1 2; 3 4; 5 6]); y = [4; 2; 3]; lambda = 4; [J grad] = nnCostFunction(nn, il, hl, nl, X, y, lambda) sigmoidGradient([[-1 -2 -3] ; magic(3)])
function retval = sizeof(HEObj) retval = 0; error('Sizeof is not supported yet.');
load('Removed50.mat') figure imshow(im) title('Original') figure imshow(im2) title('50 Seams Removed') load('Removed100.mat') figure imshow(im2) title('100 Seams Removed') load('Removed150.mat') figure imshow(im2) title('150 Seams Removed') load('Removed200.mat') figure imshow(im2) title('200 Seams Removed') im2 = ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % SIMULATING SHOCKS FOR THE SAMPLE PATHS function [Paths] = Simulator(N_Paths,Time_Steps,Model,Model_Param,r,Seed,Settings) % GBM and GARCH start at S=1 for each path at t_1 (hard coded in Simulator) % GBM and GARCH are segmented into Ten...
function plotDef_aBOOabs(Setup, Results) % Plot absolute defender acceleration c = Setup.PostOptions.c; aBOO = Results.Defender.States.Acc; aBOO_abs = vecnorm(aBOO); Figname = 'Absolute Defender Acceleration'; % Plot acceleration figure('Tag',Figname,'name', Figname,'Position', c.Pos_Groesse_SVGA); plot(Results.Tim...
function theta = newtonAlgorithm(error1,error2,error3,error4,error5,error6,v_error,theta,epsilon,N,y1,y2,y3,y4,sigma,V,y) v(1)=0;v(2)=0; d_theta1=zeros(6,1); d_theta2=zeros(6,1); v_da1(1)=0;v_da2(1)=0;v_db1(1)=0;v_db2(1)=0;v_dd1(1)=0;v_dd2(1)=0; v_da1(2)=0;v_da2(2)=0;v_db1(2)=0;v_db2(2)=0;v_dd1(2)=0;v_dd2(2)=0; j=1; b...
%Loading SPET and Trigger Files load('/Users/shannon1/Documents/F19/neuroResearch/nSTRF/AudiResp_16_24-190326-154559_triggers.mat') load('/Users/shannon1/Documents/F19/neuroResearch/nSTRF/spike_times_ripple_clust_new.mat') % Defining parameters Fs= 24414.0625; %Original sampling rate - ideally use the sampli...
clear all; clc; close all; root_dir='S:\convai\ParlAI-v2\exp-opensub'; folder_name = 'exp-emb300-hs1024-lr0.0001-a_concat-bs128'; %-gc0.5'; filename = fullfile(root_dir, folder_name, sprintf('%s.log', folder_name)); % filename = fullfile(folder_name, sprintf('%s-2.log', folder_name)); fp = fopen(filename,'r'...
classdef decisionTree < handle %UNTITLED Summary of this class goes here % Detailed explanation goes here %class which represents a node in decision tree, along with the %branches and the children properties attributeName; %the attribute being tested at the node. In case of leaf node ...
function fileList=getFileList(path) % fileList=getFileList(path) %输入: %path:所获取的文件列表的路径 %输出: %fileList:path路径下文件列表,cell数组 list=dir(path); n=size(list,1); fileList=cell(n-2,1); k=1; for i=1:n if strcmp(list(i).name,'.') || strcmp(list(i).name, '..') continue; end fileList{k}=list(i).name; k=k+1; ...
function assignval(name,val) % @author M.Moriche (Incredibly hard work) % @date 17-12-2013 by M.Moriche \n % Documented % % @brief function to assign values from a known workspace. % % @warning If someone knows how to assign values of the current % workspace, please send an email to mmoriche@ing.uc3m.es ...
% 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); % Matrix for the quasi-linear system of U-Alpha for i=1:N Aarray(:,:,i)=[2*U0.internal(i)-(alphag.inte...
% Micol Marchetti-Bowick % CMU School of Computer Science % Adapted from Ankur Parikh % This function generates a random undirected graph with a certain number % of vertices and edges, subject to constraints on the degree of each node % and on the minimum and maximum weight of each edge %%%%%%%%%%%%%%%%%%%%...
clc; clear all; close all; I = imread('Image15.jpg'); I = imresize(I, [512 512]); figure, imshow(I) I = rgb2hsv(I); figure, imshow(I(:,:,3)) %I = rgb2gray(I) imsize = size(I) startrow = 1; startcol = 1; finrow = 8; fincol = 8; for l = 1:5 for i = 2:imsize(1)-1 for j = 2:imsize(2)-1 I(i,j,3) = median([I...
% % ... Ejemplo rudimentario del metodo de Newton globalizado para % optimizacion de funciones sin restricciones. El ejemplo ilustra % % 1. como usar AMPL via spamfunc % 2. como usar la busqueda lineal de Overton con spamfunc % % function [x] = newton ( nombre ); path(path,'/Users/jmorales/bin2'); % nombre_ampl = strc...
function supervised_classification_trees = (path1,path2); clc;clear all;close all; % Add the Heatmaps folder and all its subfolders to the search path. addpath(genpath('D:\OneDrive\MATLAB\BEng\Heatmaps')); addpath(genpath('D:\Dropbox\Matlab\Set of Rules method')); addpath(genpath('D:\OneDrive\MATLAB\BEng\Heatm...
function test_svm_struct_learn_ker % TEST_SVM_STRUCT_LEARN % Test function for SVM_STRUCT_LEARN(). It shows how to use % SVM-struct to learn a standard linear SVM while using the generic % kernel interface. randn('state',0) ; rand('state',0) ; % ------------------------------------------------------------...
function [redraw, rekey, undoable] = ConvertAllClusters % [redraw, rekey, undoable] = ConvertAllClusters % % INPUTS % % OUTPUTS % % NONE % TO USE WITH MCLUST, put this in the MClust/ClusterOptions folder % % Changes type of iClust % % ADR 2003 % % Status: PROMOTED (Release version) % See documentation for copyright (...
% Date: 20160428 % Arithmetic asian option S0 = 100; K = 100; sigma = 0.2; r = 0.04; T = 1; m = 1000; %Number of periods of calculation dt = T/m; N = 1000; theta = 1; S = zeros(1,m + 1); S(1) = S0; summation = 0; for i = 1:N for ii = 2:(m+1) S(ii) = exp(log(S(ii-1))+normrnd(0,sigma*sq...
function [avalue]=Aop(M, V) % Gives the A matrix operator used in PISO loop % % [avalue]=Aop(M, V) % % avalue: column vector of A opearator values % M: system matrix % V: column vector of volumes avalue=diag(M)./V; end
function C = hccm(J,res,mode) % % HCCM Heteroscedasticity Consistent Covariance Matrix (HCCM) % % C = HCCM(J,V) % C = HCCM(J,res,mode) % % Computes the heteroscedasticity consistent covariance matrix (HCCM) of % a given LSQ problem given by the Jacobian matrix (J) and the covariance % matrix of the ...
function [Centers, Radii, A] = EasyDetection(Input, HS, Polarity) % EASYDETECTION : Find spots given an array of images 'Input' and if they % must be found on the RHS ('green') or LHS ('red'). If the input is % different from these strings, then it will look through the entire % picture. A negative polarity will loo...
function [min]=minimal(a,b) if a>b min=b; else min=a; end end
% only barely works... lambda = 520e-9; M = 48; % circle with radius r % r = .1; % x1 = linspace(-r,r,M); % y1 = linspace(-r,r,M); % [X1 Y1] = meshgrid(x1,y1); % R1 = sqrt(X1.^2+Y1.^2); % E1 = zeros(size(X1)); % E1(R1 < r) = 1; % % rectangle N0 = 64; h = 0.003949683531626; w = 0.003949683531626; x1 = linspace(-h,h,...
function [amino_acid_scattering_length,scattering_length_of_atoms,MW_amino_acid_with_D2O] = amino_acid_SL_calc_gro(exchangeable_hydrogen,C,H,N,O,S,fraction_D2O_in_solution,deuteration_fraction,fraction_that_exchange) % data from https://www.isis.stfc.ac.uk/Pages/sears---neutron-cross-section-table10655.pdf % http://psl...
function error = rSqrError(X, y,theta) predictions = rHypothesis(X,theta); error = (predictions - y).^2;; endfunction
function A=A_learning_nn(lambda, X, U) A=max(U'*X-lambda, 0); end
%% Senior Projects Position Modeling Take 2 % Created: Anastasia Muszynski 10/7/19 based upon posModel by Emily Webb % Modified: Anastasia Muszynski 10/7/19 % A model for finding position of beacon in 3 directions % based on posModel and information from Ambiguity Resolution in % Interferometry (5 Antenna Direc...
function R = colorList(i) R = [1, 23, 31, 37, 40, 48, 53, 59, 63]; if nargin > 0 R = R(i); end end
function [X, meta] = xifread(filename, debug) %xifread version 0.3 - Reads HDILab/ATL xif ultrasound data files. %Written by Bo Lind - bolind@ikol.dk % %Usage: [X, meta] = xifread('myfile.xif'); %or: [X, meta] = xifread('myfile.xif', 1); for verbose mode % %Where meta is an (optional) struct with the following fiel...
% obsolete, just use % ../NeoPacked12bitToFITS.m % quickly try to read CMOS data (12 bits packed) % inputs % ------- % topdir: directory to scan for spool files function sCMOScreatemovie(topdir) d0 = dir([topdir,filesep, '1103*']); denoise = true; fps = [1 1 5 5 1 50 1 1 2 2 10 10 10 10 10 10 10 ... % 01...
function [ head_loss, hydr_resist1, hydr_resist2 ] = HydroNet_HeadLoss( objects, pipe, valve_fix, ... valve_var, thermostat, pump_turbo, heat_exch_fix, heat_exch_Tout, tank, branches_ind, ... branch_cycle, n_branch, temperature ) % Calculates head loss in every branch of an hydraulic circuit head_loss = zero...
function xi = get_xi(epsr) chi = epsr - 1; xi = - 1 / chi; end
function O_P=MPPT_Icon(deltaP,deltaV,deltaP_old,deltaV_old,step,ee) dP=deltaP-deltaP_old; dV=deltaV-deltaV_old; O_P=0; if abs(dP)>0 if dV/dP>-deltaV/deltaP O_P=step; end if dV/dP<-deltaV/deltaP O_P=-step; end if abs(dV/dP+deltaV/deltaP)<ee O_P=0; end else if dV>0 ...
function varargout = loadcycle(varargin) % LOADCYCLE M-file for loadcycle.fig % LOADCYCLE, by itself, creates a new LOADCYCLE or raises the existing % singleton*. % % H = LOADCYCLE returns the handle to a new LOADCYCLE or the handle to % the existing singleton*. % % LOADCYCLE('CALLBACK'...
function [image] = project(image, backColor, projColor) vSize = size(image, 1); hSize = size(image, 2); for i = 1 : vSize for j = 1 : hSize if similarOrEqualColor(reshape(image(i, j, :), 1, 3), backColor) image(i, j, :) = projColor; end end en...
function output = medfilt1D(vector,window) %% Window size if nargin < 2 window = []; end if isempty(window) % The default window size is three window = 3; end if rem(window, 2) == 1 % step for odd sized windows step = (window -1)/2; else % step for paired window size step = window/2; end %% Search medi...
% Demo of using atfastring for fast tracking % The ESRF lattice is loaded, cavity is set, and then the fast ring is % created. % An electron is tracked through the full lattice and fast ring and % the tracking time and tracking results are compared. clear clc echo on %load esrf ring ring=esrf; % indcav=findcells(ri...
function [varargout] = tp_solve_gpml(w,x,y,k,xt) % TP_SOLVE - Solve TP regression problem using the covariance % functions in the gpml toolbox. % % All the code based on orginal code gp_solve. % % Syntax: % [...] = tp_solve_gpml(w,x,y,k,xt) % % In: % w - Log-parameters (nu, sigma2, theta) % x -...
function res = A1_test % res = zeros(1,7); imc = CS4640_create_im('CS4640_ramp',4,4,4,-2,2,-2,2); truth = [0 1 2 3; 0 1 2 3; 0 1 2 3; 0 1 2 3]; res(1) = 0==sum(sum(truth-imc)); im1 = ones(4,4); im2 = 2*ones(4,4); imd = CS4640_im_dist(im1,im2); res(2) = 0==sum(sum(abs(imd-im1))); im1(:,:,1) = ones(4,4); im1(:,:,2) =...