text
stringlengths
8
6.12M
function [ChiGrid, ksnG] = chi_FD_AP_modified(DEM, FD, varargin) % chi_profiler.m allows for interative river profile analysis via % the integral or chi method (e.g. Perron and Royden, 2013). Users can % regress through channel segments to get ksn and select knickpoints along % river profiles % % Inputs: % 1) DE...
%% mod of tintx to explicit Euler % % [p,t1,ts,nc] = tintx(p,t0,ts,dt,nt,nc,pmod,smod) function [p,t1,ts,nc]=expl_eu_tintx(p,t0,ts,dt,nt,nc,pmod,smod) n=0; t=t0; [L,U,P,Q,R]=lu(p.mat.M); while(n<nt) G=pderesi(p,p.u); du=Q*(U\(L\(P*(R\G)))); p.u(1:p.nu)=p.u(1:p.nu)-dt*du; t=t+dt; n=n+1; if(mod(n,pmod)==0); ...
clc; fprintf('=================================[ ASA_Example.m ]================================\n\n'); fprintf('This script calculates the 3D pressure of a 128-element array of rectangular\n'); fprintf('transducers by using the Angular Spectrum Approach to propagate an initial field\n'); fprintf('calculated with t...
% ADVISOR data file: ACC_SER_HYBRID_BUS.m % % Data source: word of mouth estimates % % Data confirmation: none % % Notes: % Defines standard accessory load data for a series hybrid transit bus--default % values are for A/C off but values with A/C on are given (commented out). % % Created on: 15 August 2001 % By: MPO,...
function [coords] = getCropCoords(thisFrame,varargin) % GUI to allow users to select crop coordinates. % Biafra Ahanonu % started: 2014.01.03 [19:13:01] % inputs % % outputs % [coords] = ciapkg.image.getCropCoords(thisFrame,'passArgs', varargin); end
De eerste output van de standaard functie max() geeft je het index nummer terug.
function features = AnalyzeDominantColors(record, index, save_path) addpath('lib'); for i=1:length(index) i % tic file_path_cell = record.path(index(i)); features{i} = analyze_poster(file_path_cell{1}, save_path); % toc end
% Aaron Ma % 20091536 % March 14th, 2017 % EESM5700 HW 1 - Problem 3.3 % ------------------------------------------------------------------------- % Clear workspace before starting script clc; clear; close all; % ------------------------------------------------------------------------- % Read the target image I = im...
function f_boxPlotPerDay(session, runDir, runThese, dataKey, layerName) % f_boxPlot will create a box and whisker plot for each data session in % runThese. Plots are grouped by dataKey.treatmentGroup. % % Inputs % session: IEEG session including all sessions for which to plot events % runThese: vector of...
%% Electric clear all clc SetAdvisorPath; %Pass the vehicle input.init.saved_veh_file='ev_small_in'; [error_code,resp]=adv_no_gui('initialize',input); % Modify the Vehicle Parameters input.modify.param = {'veh_cargo_mass','veh_glider_mass','veh_FA','veh_CD'}; input.modify.value = {100,756,1.8,0.22}; [error_code,res...
function [mu,esvarm] = karl(A,B,C,D,Yem) mu = Yem(:,1); muu = []; esvarm = zeros(length(Yem(:,1)),length(Yem(:,1))); for l = 1:length(Yem(1,:))-1 mum = A + B*mu; esvarmm = B*esvarm*B' + C; kgain = esvarmm*((D+esvarmm)^(-1)); mu = mum+kgain*(Yem(:,l+1)-mum); esvarm = esvarmm - kgain*esvarmm; muu ...
b=[1]; a=[1,-0.5,0.2,-0.1,0.007,0.14,0.15]; n=1001; [h,w]=freqz(b,a,'whole',n); figure; zplane(b,a); %By geometrical intuition, we can say that the peaks in the magnitude response graph represent poles at that particular %frequency, and the lows in the graph represent the zeros. By comparing the actual location of ...
function x=BackSubstitute(A,p,b,x) %A is U and b=c so Ux=c; [m,n]=size(A); [pn,pm]=size(p); tmp=zeros(1,1); %nargin is inbuilt variable that defines how many variables are passed as arguement to function if nargin==3 x=zeros(n,1); end for i=pn:-1:1 tmp=b(i); for j=n:-1:i+1 tmp=tmp-A(i,j)*x(j); end ...
function [data_both] = process_data_sepFeet(folder) disp('reading data'); myFiles = dir(fullfile(folder,'*.csv')); Fs = 1/(10/1000); start_time = 0; cycle_mat = []; data_fin = []; strides_bool_fin = []; labels = []; keep_inds = []; data_both = []; filter_sig = true; F_lowpass = 8; F_highpass = .5; for i = 1:length(...
%% linux_savefig %% Syntax % linux_savefig(hf[,fname]) %% Description % save figure with handle hf in folder fn_cd('capture'), under the name % figuretitle_date_time.png % % works only under linux, with ImageMagick installed %% Source % Thomas Deneux % % Copyright 2009-2012 %
[x, fs] = wavread('../Audio/Beatles.wav'); x = x(Fs*32.5:Fs*35); Fc = 240; [b,a] = butter(8,2*(Fc/Fs),'low'); x1 = x; input1 = filter(b,a,x1); x2 = input1(1:2:end); input2 = filter(b,a,x2); x3 = input2(1:2:end); input3 = filter(b,a,x3); x4 = input3(1:2:end); input4 = filter(b,a,x4);
function [p] = onaxis_foc(z, f, a, R, c) % [p]= onaxis_foc(z, f, a, R, c) calculates the on-axis pressure,p, at the % locations z(in mm)of a spherically focused transducer of radius a % (in mm) and focal length R(in mm) radiating into a fluid with wave speed % c(in m/sec), using the O'Neil model. If R = inf, the...
% Find seperation distance for a set of different hues % (Blue-white-red style) clear all; close all; %% Parameters use_uplab = false; % CIELab bwr: 296, 40 % UPLab bwr: 309, 54.75 handpicked_hue1 = 309; %[]; % 290; % Blue handpicked_hue2 = 54.75; %[]; % 41; % Red via_black = 0; % Go via near-white (0) or near-bl...
function [ mode ] = MAJORITY_VALUE( binary_targets ) %MAJORITY_VALUE Summary of this function goes here % returns the mode of the binary_targets if sum( binary_targets ) >= length( binary_targets ) / 2 mode = 1; else mode = 0; end end
function gene_table = adjmatrix2edgelist(metric,gene_list) absmetric = abs(metric); L = length(metric); rowind = repmat([1:L]',1,L); rrows = reshape(rowind,L*L,1); rowind = repmat([1:L]',1,L); colind = rowind'; rrows = reshape(rowind,L*L,1); rcols = reshape(colind,L*L,1); rmet = reshape(absmetric,L*L,1); [smets,sind] ...
classdef NeuralArea < handle % 'handle' allows properties to be updated %----------------------------------------------------------------------- %% INITIAL CLASS PROPERTIES %----------------------------------------------------------------------- properties % Numbers of each neuron type ...
function [h_figure, p, settings] = sd_config_figure(layers, settings) % SD_SETUP_FIGURE Configures the figure window % % DESCRIPTION % This function computes the figure dimensions and the layout of the % figure. % If a panel object was provided, optimal layout is computed. % % SYNTAX ...
function [U, R, eflag, it, Jc] = NSOLVE(func, U0, opts) %NSOLVE Uses Newton iterations to solve % % USAGE: % [U, R, eflag, it, jc] = NSOLVE(func, U0, opts); % INPUTS: % func : Function handle [F, dFdU] = func(u); % U0 : Initial Guess % opts : Options structure with, % reletol (float) % etol (float) % utol ...
function hyper_param = find_param(train_samples_output,train_samples_input,covfn,numhyp) %set inputs and outputs %set population size for the DE algorithm; approx 10x number of %hyperparameters is a classic setting; however >40 shows limited improvement population_size = numhyp*10; %number of ite...
function bias = gabias(gbias, abias) % Gyro & Acc constant bias setting. % % Prototype: Gyro & Acc constant bias setting % Inputs: gbias - gyro bias, in deg/h % abias - acc bias, in ug % Output: bias - = [gbias; abias] % % See also imuerrset, avpset, insupdate. % Copyright(c) 2009-2021, by Gongmin Yan, All r...
function [ err ] = fitsingleexp( param, Nmeas, N0, t) %This function returns a cost function to be minimized g = param(1); N_model = singleexp(g, N0,t); err = N_model(2:end) - Nmeas; end
function [im_out] = PWLMT(im,a,b,m,n) %PWLMT is the abbreviation of piece-wise linear mapping transform; % The formula changes the gray value of an image by a piecewise linear % function; [r,c] = size(im); im_out = double(zeros(r,c)); im = double(im); for i=1:r for j=1:c if im(i,j) < m ...
%%% Model of Scranton & Vasseur 2016 (Theor Ecol.) %%% Developped by Picoche & Barraquand 2018 % Graph showing growth rate for SFE poster clear all; close all; clc; global S tau0 mu_tau sigma_tau tau_min tau_max a_r_tau0 E_r k A m thresh_min tspan r afontsize=15; S=60 %number of species (60 for SV) col=jet(60); %Tem...
%Teste les deux séquences et garde la meilleure [seq_a,seq_b] = seq_bonus; %SEQUENCE 1 %code aléatoire permutation = alphabet(randperm(40)); %Nombre d'itérations it = 10000; %Fait des permutations aléatoires dans le code et si meilleure vraisemblance on garde while(it > 0) permutation_next = exchange (permutatio...
function v_fXhat = ApplyViterbiNet(v_fY, net, GMModel, s_nConst, s_nMemSize) % Apply ViterbiNet to observed channel outputs % % Syntax % ------------------------------------------------------- % v_fXhat = ApplyViterbiNet(v_fY, net, GMModel, s_nConst) % % INPUT: % ----------------------------------------------...
% Tests the functionality of frequencyResponse, ampMod and ampDemod Fs=4000; % sampling frequency t=0:1/Fs:2; sig= cos(2*pi*10*t); % massege signal c = cos(2*pi*1000*t); % carrier signal mod_sig = ampMod(sig, c, Fs); deMod_sig = ampDemod(mod_sig, c, Fs);
function trial_mrk = tl_mrk_getTrialMarkers(mrk) % Returns the cell trial_mrk that in each entry contains the marker indices % of single trials, relative to the complete set of markers. %min_ts2emg = 1300; min_ts2emg = 0; mrk = mrk_sortChronologically(mrk); mrk = tl_mrk_unifyMarkers(mrk,'start'); ci_ts = find(strcmp...
function [params,paramsmap] = getSMmap(mainDir,patientname,x,y,z,A,normdecay,b) % A---the size of orginal 3D images % x,y,z---the remembered coordinates of original 3D images % b--- b values; % mainDir and patientname are the dictionary to save IVIM % normdecay&onormdecay---onormdecay is the original decay data wh...
function ksp = mrir_fDFT_phasencode(img, coordinate_str, varargin) %MRIR_FDFT_PHASENCODE forward Discrete Fourier Transform along phase encode % % ksp = mrir_fDFT_phasencode(img, coordinate_str) % jonathan polimeni <jonp@padkeemao.nmr.mgh.harvard.edu>, 2007/jan/24 % $Id$ %*********************************************...
function lx = makeLocationMap( dims , nam , N ) Nmaps = size(dims,1); lx = zeros(N , 2^13 + 3 ); px = {}; for i = 1 : Nmaps px{i}.r = partitionindex( dims(1,1) , dims(i,1) ); px{i}.c = partitionindex( dims(1,2) , dims(i,2) ); end for i = 1 : Nmaps for j = 1 : dims(i,1) for k = 1 : dims(i,2) ...
function init_alloc = initialise_simple(inputData, num_jobs, num_machines) % Pre-allocate for speed init_alloc = zeros(num_jobs,2); input_data_jobs = inputData(1:num_jobs); input_data_jobs_sorted = sort(input_data_jobs ,'descend'); % Pre-allocate for speed init_alloc = zeros(num_jobs,2); % First round allocation (an...
delta = [1 4]; theta = [4 8]; alpha = [8 12]; lowerBeta = [12 18]; higherBeta = [18 30]; %% speech plot load('C:\Users\SMukherjee\Desktop\data\dual_eng\mat\FiieldtripClustering\perfect\prespeech\importent_nobaseline_1sec_nolog_sepcond_oldsettings_5ms_-500-0\speech_tfr.mat',... 'GA_CONV','GA_NOCH'); time = [-0.5:0.5:0...
pkg load symbolic % Funcion que implementa el metodo de descenso coordinado % :param str_funcion: string con la funcion que se debe evaluar % :param variables: lista con las variables de la ecuacion % :param vector: vector inicial de necesita el metodo % :param tol: tolerancia al fallo que debe tener el resultado % :...
function [c_MLE, k_MLE, ERT] = wblmle(n, c, k) % WBLMLE Maximum likelihood estimator for a given Weibull distribution. % The function generates n sample points from the Weibull distribution % with parameters c and k. It then generates 101 candidates for c an k % in a range of [0.7c:1.3c] and [0.7k:1.3k]. % It c...
%% COMPARACION ENTRE LOS DOS PROBLEMAS format long %% Defino la funcion f del primer problema f1=@(t,y,k,m)(k*y*(m-y)); % Inicializo algunos parametros dados. k=2*10^(-6); m=1*10^5; y0=1000; % Introduzco los limites de contorno y el numero de iteraciones. a=0; b=30; n=30; %Utilizo el metodo Runge-Kutta de orden 4 ...
function [bin,rw]=en_zone_new(r,lB,nc) th=[cumprod(2*ones(1,11)); 3*cumprod([1 2*ones(1,10)])]; th=reshape(th,1,22); th=[1 th 4096]; p1=0.7; p2=0.8; Ln=length(nc); %first sep: ============================================================== idx=find_thd_idx(nc,p1,th); thd1=th(idx) %%%%%%%%%%%%%%%%%%%%% bin_idx1=encode...
clear close all; % DESK addpath(genpath('C:\Users\bastien\Documents\internship\biosig4octmat-3.1.0\biosig\t200_FileAccess')) addpath(genpath('C:\Users\bastien\Documents\internship\Miw')) processFolder= 'C:\Users\bastien\Documents\internship\Miw\gtec16'; filename = 'C:\Users\bastien\Documents\internship\data_ONLINE\da...
function [out]=match2gps(gpsPuck,timePuck,imageTime) for i=1:length(imageTime) delta = abs(imageTime(i) - timePuck); loc = find(delta == min(delta)); out(i,:) = [imageTime(i), timePuck(loc(1)), gpsPuck(loc(1),:)]; end end
function motor_init( roro ) %% data from thrustcurve.org % Reads the .eng thrust file of the motors and calculates the reletive % properties of the motor. % Extracting thrust curve R1=4; C1=0; motorname = char(roro.motorname); motordata = dlmread(motorname,'',R1,C1); roro.moto...
function Py = project(y,b,e,s) % Project y onto real(dot(y,b)) - e * norm(y) >= s tol = 1e-12; if (nargin < 4) || isempty(s) s = 1; end if (nargin < 3) || isempty(e) e = 0; end yb = real(dot(y(:),b(:))); yy = dot(y(:),y(:)); bb = dot(b(:),b(:)); nb = realsqrt(bb); if e <= to...
function run_training_grad(config_filename) fprintf('load %s\n', config_filename); eval(config_filename); parameter addpath('../../util'); run ../../util/vlfeat-0.9.20/toolbox/vl_setup; input_dir = fullfile('../../images', parameter.training_dataset); LR_dir = fullfile(sprintf('sf%s', num2str(parameter.sca...
Y=[]; importcsv('bzip2.csv'); Y=ProcPwr; x1 = Ambient_Temp0; x2=Ambient_Temp1; x3=Blower_Fan_0; x4=Blower_Fan_1; x5=CPU_0_Temp; x6=CPU_1_Temp; x7 = HT1Scaled; x8=HT2Scaled; x9=cmiss_core0_scaled; x10=cmiss_core1_scaled; x11=cmiss_core2_scaled; x12=cmiss_core2_scaled; x13=bzip2; x14=cactusadm; x15=h264ref; x16=lbm; x...
function [gradientx,gradienty] = sobelFilter(img) % This performs a Gaussian blur on the image specified from the root % directory. Assuming that we will reduce the image size. % img should be an imread() object, in UINT8 form. img = double(img); s = size(img); Bx = 1/8 * [ [-1 0 1]; [-2 0 2]; [-1 0 1]; ...
function Q = extractQ(QR,d) % test function that creats Q with higher cost: v*v' grows by n^2 [n,m] = size(QR); H = eye(m,m); for j=1:m v = [d(j);QR(j+1:end,j)]; v = v/norm(v); Hj = eye(m,m); Hj(j:end,j:end) = eye(m-j+1,m-j+1) - 2*v*v'; H = Hj'*H; end Q = H; end
function [ H ] = est_homography(video_pts, logo_pts) % est_homography estimates the homography to transform each of the % video_pts into the logo_pts % Inputs: % video_pts: a 4x2 matrix of corner points in the video % logo_pts: a 4x2 matrix of logo points that correspond to video_pts % Outputs: % H: a 3x3 h...
%% resample encoder function downs = resample_encoder(img) [h, w, d] = size(img); nt = 4; fp = 3; downs = zeros(h/2, w/2, d); for ch = 1:d % wrapping img_wrapped = padarray(img(:, :, ch), [nt, nt], 'symmetric'); % resample img_ds = resample( resample(img_wr...
%% Info % Copyright (C) 2017, Navid Haghdadi, n.haghdadi@unsw.edu.au % TDA is open source software for assessing existing and proposed new tariffs. % It offers a range of analyses as described in this document to assist energy % market stakeholders and the wider community to analyse the impact of different % tariffs ...
#! /usr/bin/octave -qf # Sin pivoteo function [A] = cholesky(A) n = size(A)(1); # Limpiamos la parte triangular superior porque la matriz es simetrica for i = 1 : n for j = i + 1 : n A(i,j) = 0; end end A(1,1) = sqrt(A(1,1)); # Llenamos la primera col...
%% RSA-based 'neurometric' mapping %(c) Bernhard Spitzer, 2016 %% clear all; restoredefaultpath; addpath('thirdparty'); datapath='rdmdat\'; selmod=1; % 1: visual; 2: auditory subjects={'01';'02';'03';'04';'05';'06';'07';'08';'09';'10';'11';'12';'13';'14';'15';'16';'17';'18';'19';'20';'21';'22';'23';'24'}; ...
function [P, x_boot, ds, os] = Get_selective_boot(data, dir, n_boot) %data = imgobj.dFF_s_each(:,:,k) rng(6281980) n_data = size(data, 2); x_boot = zeros(n_boot, n_data); %remove NaN and resample data for each direction parfor i = 1:n_data x = rmmissing(data(:,i)); x_b = bootstrp(n_boot, @mean, x); x_boot(...
function [denoisedData] = remove1stPC(data) %REMOVE1STPC reconstructs data without the first PC. % Denoising with principal component analysis % % % author: Elliot H Smith - https://github.com/elliothsmith/seizureCodes % PCA [w,pc,ev] = pca(data); % reconstruction without 1st component denoisedData ...
function [alpha_est, lambda_est, L] = bplcutfit(h, boundaries, varargin) % BPLCUTFIT fits a power-law cutoff model to the data % Source: http://tuvalu.santafe.edu/~aaronc/powerlaws/bins/ % %---------- % Options: %---------- % 1. l = bplcutfit(h, boundaries, 'range', 1.5:0.01:3.5, 0.1:0.01:1) % The 'range' option ca...
function response= bmfundamped(x) x=exp(x); kp=x(1);ks=x(2);mp=x(3);ms=x(4);zp=x(5);zs=x(6);fs=x(7);s0=100; wp=sqrt(kp/mp); ws=sqrt(ks/ms);wa=(wp+ws)/2; za=(zp+zs)/2; gamma=ms/mp; tetta=(wp-ws)/wa; response=-(fs)+3*ks*( ((pi*s0)/(4*zs*ws^3)) * ((za*zs)/(zp*zs*(4*za^2+tetta^2)+gamma*za^2)) * (((zp*wp^3+zs*ws^3)*wp)/(4*z...
recomputeVocab = 0; %change this to 1 to update kMeans addpath('./provided_code/'); framesdir = './frames/'; siftdir = './sift/'; fnames = dir([siftdir '/*.mat']); NUMFRAMES = 300; k = 400; if(recomputeVocab == 1) increment = round(length(fnames)/NUMFRAMES); SIFTdata = []; all_orients = []; all_posit...
wax=[3 15 0.5 1]; xx=[3 6 9 12 15]; LW1=3; nirs='r-'; eeg='g-'; comb='b-'; figure,hold on plot(xx,mean(Cgaverage_nirsAMf),'r-.','Linewidth',LW1) plot(xx,mean(Cgaverage_eegAM),'g-.','Linewidth',LW1) plot(xx,mean(Cgaverage_combAMf),'b-.','Linewidth',LW1) set(gca,'XTick',[3 6 9 12 15]) xlabel('time in seconds'),ylabel('ac...
close all; % Samples column-wise X = [1.0 1.7 2.2 1.4 2.1 2.3 0.7 2.2 2.6 1.9]'; selection = unique(randi(5, 1, 5)); W = k_means(X, X(:, selection)); function W = k_means(X, W0) % Codebook vectors W = W0; % History of codebook vectors W_hist = W(:); minimum_change = 1e-3; ...
function [xhat, error, A] = lmsALE(x, mu, M, delta) N = length(x); A = zeros(M,N); xhat = zeros(size(x)); error = zeros(1,N); for i=delta+M:N xpast = x(i-delta:-1:i-delta-M+1); xhat(i) = A(:,i)'*xpast'; error(i) = x(i)-xhat(i); A(:,i+1) = A(:,i) + mu*error(i)*xpast'; ...
function G = DowndateChol(G0,z) % function G = DowndateChol(G0,z) % Downdating a Cholesky factorization. % G0 is nxn lower triangular and z is nx1. G is nxn lower triangular % such that G*G' = G0*G0'-z*z'. % GVL4: Section 6.5.4 n = length(z); G = [G0 z]; % G is nx(n+1) lower Hessenberg for k=1:n % Ze...
function subfnCalculateLOOCV(InDataFile,NPCs) % Need to calculate the mediation effect in the left out subject % NPCs = str2num(NPCs); [PathName FileName] = fileparts(InDataFile); OutDir = fullfile(PathName,'jobs'); % Find out what subject to leave out based on the job ID [a b] = unix('echo $SGE_TASK_ID'); Subject = st...
function [I] = calcCurrent(connection,powerRating,voltage) if strcmp(connection,"star")==1 I = powerRating ./ ( sqrt(3) .* voltage ); else I = (powerRating) ./ (3 .* voltage ); end end
function varargout = GUI_VSMP2O(varargin) gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @GUI_VSMP2O_OpeningFcn, ... 'gui_OutputFcn', @GUI_VSMP2O_OutputFcn, ... '...
function q = Collate_into_sequence_proc_(p, env) % Collate_into_sequence_proc: creates a chan-mag sequence from an FTM. % % function q = Collate_into_sequence_proc(p, env) % % Inputs: % env: Envelope FTM. % p: Parameter struct, with the following fields: % p.num_bands: Number o...
function [q, dq, ddq, t] = quinticSpline(y, dy, ddy, x, dt) % generates a sequence of quintic splines based on via points. it does so % by using the Vandermonde matrix to generate the spline polynomial % coefficients, then use polyval to fill in the spline % y(viapoints, dof) - this determines the key poses that th...
% surfaceArea.m % v1 Authored by Adam Rauff & Chelsea Heveran % Measures surface area (SA) of each segmented lacunae, and % best fit ellipsoid % Part 1 % SA of ellipsoid % Oblateness of ellipsoid: 2((b-a)/(c-a)) - 1, where radii a, b, c are radii in % increasing order. Oblateness is calculated from ellipsoidal and...
function testlabel3d_turbo(Pfile, Npairs) % function testlabel3d_turbo(Pfile, Npairs) !rm *.nii %sprec1_3d(Pfile,'m'); %sprec1_3d(Pfile,'h','N'); sprec1_3d(Pfile,'N', 'n',64,'fx','fy','l'); vols = dir('vol*.nii'); volname = vols(1).name; hdr = read_hdr(volname); aslsub(volname(1:end-4), Npairs, 1, hdr.tdim, 0, 1...
clear all, close all, clc wattmeter = tcpip('0.0.0.0', 11500, 'NetworkRole', 'server'); % Open a connection. This will not return until a connection is received. fopen(wattmeter); %% REMEMBER TO CLOSE THIS CONNECTION LATER format compact; %% limit = 100; %take reading of 100 values while true voltage = zer...
function th = th % global define % horizonal angle of camera (deg) th = 94.4/180*pi; end
% This file is used to compare the performance of gradient descent close all; clear all; % load the path first addpath('./solvers/'); addpath('tensor_toolbox/'); addpath('tensor_toolbox/met/'); load('tensor_0_7.mat'); U = rand(10,3); V = rand(4,3); W = rand(3,3); t = tensor(reconstruct(U, V, W)); m = size(t, 1); n...
function new_col = skip(img, row, col, MAX_COLUMN) % this function skips the part of the row that is defined to be inside % a shape % it returns the first column number outside a shape good_value = 0; while (good_value ~= 1) && (col < MAX_COLUMN) col = col+ 1; if img(row, col) == -1...
classdef MipTests < matlab.unittest.TestCase properties foo; quux; end methods (Test) function testParseToWorkspace(obj) parser = MipInputParser(); parser.addRequired('foo', @isnumeric); parser.addParameter('quux', '4', @ischar);...
function res_sub_tjc = resample_sub_tjcs(save_dir,tjc_pro,inds_sub_tjcs,varargin) if ~exist(save_dir,'file') mkdir(save_dir); end if save_dir(end)~='\' && save_dir(end)~='/' save_dir = [save_dir '/']; end % clear; % close all; % load('tjc_pro.mat','tjc_pro'); % load('sub_tjc.mat', 'sub_tjc'); % img_bg = imread('ba...
% Utilities to operate on the GUI % % Author : Jonathan EDEN % Created : 2016 % Description : classdef GUIOperations methods (Static) % childNodes is a java type and hence is a handle class (no need to % return the childNodes again) function settings = GetSettings(str) ...
% Run full optimizer suite from draft of frame m=107; n=44; numSims = 10; TargetTS = 1200; % Aim low b/c the simulation shoots high % Global parameters for genetic algorithms maxChange = 3; globalI = 15; globalG = 75; globalS = 5; % Storage vars RatioStorageGeom = zeros(1,numSims); RatioStorageWeight = zeros(1,numSi...
function [uout, tout] = spin3() %SPIN Solve a (t,x,y,z)-PDE with periodicity in space, using a Fourier spectral %method for x, y and z, and an exponential time-diffenrencing scheme for t. % Author: Hadrien Montanelli. %% Set-up: pref = spinpref; tspan = [0 .2]; dom = [0 100]; dom3 = [0 100 0 100 0 100]; N = 40; d...
function [newDB] = readColumbiaDir() BDfolder = char(strcat(pwd, {'\BD2\'})); folders = dir(BDfolder); folders(3) = [];folders(2) = [];folders(1) = []; for i = 1:length(folders) idir = folders(i); dirname = horzcat(idir(i).folder,'\',idir(i).name); d = dir(dirname); ...
clc; clear all; y = zeros(3,1); y(1) = 5; y(2) = deg2rad(5); y(3) = 100; [T,Y] = ode45(@Velocity, [0:0.1:60], y); figure(1) plot(T, Y(:,1)); figure(2); plot(T, rad2deg(Y(:,2))); figure(3); plot(T, Y(:,3))
function syslog(log_statement, varargin) formatOut = 'mm/dd/yy HH:MM'; timestamp = datestr(now,formatOut); warning('off','all') timestamp = datetime(timestamp,'TimeZone','EST'); warning('on','all') timestamp = char(timestamp); if not(isempty(varargin)) log_type = varargin{1}; if isnumeric(log_type) log...
x=0:0.1:4; f=8-4.5.*(x-sin(x)); y=0.*x; plot(x,f) hold on plot(x,y) hold off Fx=@(x) 8-4.5*(x-sin(x)); a=2;b=3; imax=20; tole=0.001; if Fx(a)*Fx(b)>0 disp('Error:The function has the same sign at points a and b'); else disp('iteration a b (xNS) Solution f(xNS) Tolerance'); for i=1:imax ...
%% SENSITIVITY: COMPARISON OF SAMPLING- VS. PCE- and LRA-BASED SOBOL' INDICES % In this example, Sobol' sensitivity indices for the Borehole function % (as described in http://www.sfu.ca/~ssurjano/borehole.html) will be % calculated with standard sampling, as well as with Polynomial Chaos % Expansion (PCE) and Low-Rank...
%% Parse Data clear all close all clc % % fileID = fopen('final_flight_data.txt'); % data_matrix = []; % for i =1:1 % C_temp = fgets(fileID); % end % % i = 1; % while ~feof(fileID) % data_temp = strsplit(fgets(fileID),','); % if isempty(strfind(data_temp{1},'ERROR')) && isempty(strfind(data_temp{1},'Start...
function [total_dist]=cross_distance(view1,N1,view2,N2,nv) total_dist = 0; for i=1:N1 second_view_total = 0; for j=1:N2 Frob_dist=0; for k=1:nv Frob_dist = Frob_dist + norm(view1{k}(:,:,i)-view2{k}(:,:,j),'fro'); end second_view_total = second_view_total + Frob_dist/...
clear load('Sentences_48828.mat') fc = 75; lpf = fir1(round(4/fc * fs),fc/(fs/2)); figure, plot(lpf) for j=1:length(sentences) x = hilbert(sentences{j}); x = filtfilt(lpf,1,abs(x)); envs{j} = x; envs_4096{j} = resample(x,4096,fs); end t = 0:1/fs:length(envs{1})/fs-1/fs; t2 = 0:1/4096:length(envs_4096...
function [pathstr] = get_project_path() pathstr = mfilename('fullpath'); [pathstr, ~, ~] = fileparts([pathstr, '.m']); [pathstr, ~, ~] = fileparts([pathstr, '.m']); end
function [path] = dijkstra(n, netCostMatrix,c_link, single_flow, s, d, wdm_order, tdm_order, token_matrix, small_br) % path: the list of nodes in the path from source to destination; % totalCost: the total cost of the path; equals to inf if there is no path % farthestNode: the farthest node to reach for each node aft...
% DEMO_CA_phantom clc;clear; load CA_phantom.mat % VX_WBDFS=cell(size(VX_FILTERED,1),1); VY_WBDFS=cell(size(VX_FILTERED,1),1); VZ_WBDFS=cell(size(VX_FILTERED,1),1); for timestep = 1:length(VX_FILTERED) tic vx=cell2mat(VX_FILTERED(timestep));vy=cell2mat(VY_FILTERED(timestep));vz=cell2mat(VZ_FILTERED(timeste...
disp('hello world'); disp('tolles neues feature #1'); disp('so, jetzt ist der bug behoben') disp('releasešnderungen in letzter minute beim testen'
function [ otazka_aj, odpoved1_aj, odpoved2_aj, odpoved3_aj, vysledek_aj ] = generovani_mod_otazek( vstup_aj ) %Funkce generovani_mod_otazek %Funkce má jeden vekter na vstupu, který určuje, že funkce proběhne %A pět vektorů na výstupu, ve kterém bude uložena otázka typu 'char' + tři %odpovědi také typu 'char' + kt...
function xi = f_powell_search(optfun,p,varargin) %[f_powell_search] searches using Powell's method. % % Usage: % xi = f_powell_search(optfun,p,varargin) % % Input: % optfun - % Cost function for optimization % p - % Searching parameter % varargin - % {1} img_ref, reference image,...
function itemValue = verifyPreference(groupTag,itemTag,defaultValue) % verifyPreference % checks preference for group and item % groupTag: group parameter char/string for ispref/getpref % itemTag: pref item char/string for ispref/getpref % defaultValue: default if is not a pref or if not a folder % Hope Queener:...
% Sweep over 100 values lambdas = logspace(6, -2, 100); [A,B,W,Q,R,K_mask] = problem_wac(casename); % Start from LQR with one FISTA step K0 = -lqr(A,B,Q,R); clear fparams; fparams.max_iters = 1; fparams.verbose = 1; fparams.max_eig_limit = -1e-1; fparams.beta = 0.5; fparams.sigma = 1e-4; fparams.tol = 1e-5; fparams.m...
function res = opdracht_5_versie_1_CHECK(apStudentSol) %%========== PLACE SOLUTION IN COMMENTS HERE % % % % % % % % % % close all % % % % % % % % % % phi = 30*pi/180:1*pi/180:pi; % % % % % % % % % % % lengte onderbeen: % % % % % % % % % % L1 = 0.4; % % % % % % % % % % % lengte bovenbeen: % % % % % % % % % % L2 = 0.5...
%% Checks whether or not contingency matches reduced state matrix modes % contignum = the contingency to simulate % noise = white noise amount (input as percentage the max amplitude) % window = percentage of full view into power network % implemented by randomly removing subset of voltage readings i = 1;...
function [T, timestamp] = GetMarkerPositions(jTcpObj) jtcp('write',jTcpObj,int8(['GetMarkerPosition'])); pause(0.05) mssg = char(jtcp('read',jTcpObj)); %disp(mssg) mssgSplit = strsplit(mssg,' '); mssgSplitD = str2double(mssgSplit); mssgSplitD2=mssgSplitD(~isnan(mssgSplitD)); T = reshape(mssgSplitD2(3:end),...
function newImage = border(Image, scaleFactor) height = size(Image,1); width = size(Image,2); Image(1:round(height*scaleFactor),:,:) = 0; % Top border is zeroed Image(height-round(height*scaleFactor*6):height,:,:) = 0; % Bottom border is zeroed Image(:,1:round(width*scaleFactor),:) = 0; % Left border i...
%% % Calculates whether fly is backing up % function out = fcnBacking( tA, tAIX) smoothSamples = 5; velThresh = -.5; forwardVel = fcnForwardVel( tA, tAIX); for traceN = 1:size(forwardVel,1) forwardVel(traceN, :) = smooth(forwardVel(traceN,:), smoothSamples); end out = (for...