text
stringlengths
8
6.12M
function [desiredaccel] = calculatedesacceleration(Pose, Twist, Control,ImpactParams) %calculaterefacceleration.m Calculate a_ref for Recovery Controller switch Control.recoveryStage case 1 desiredaccel=Control.accelRef; case 2 % desrdposn=[Impact...
%hvintegrate - issue 1.2 (21/01/10)- HVLab HRV Toolbox %----------------------------------------------------- %[outdata] = hvintegrate (indata, exponent) % Returns the cumulative integral of a function, or the cumulative VDV or % MSDV of an acceleration time history. % % outdata = name of new HVLab data struct...
function hdm05_setup_main (i_exp) % ytc_setup(); opts.dataDir = fullfile('/scratch/dataset/HDM05') ; opts.lite = false ; liedb.lieDir = fullfile(opts.dataDir) ; strFolder1 = ['lie20_half_inter' num2str(i_exp)]; [liedb] = readImdbTrain(liedb, opts, strFolder1,0); mkdir(['../data/hdm05_' num2str(i_exp)]); ...
% OL_ANT_SHS_MACRO_EXACT Open-loop ant stochastic hybrid system, exact population model % % This script performs a poopulation simulation of an SHS of ants. Rather % than proceeding at uniform time intervals, it calculates the exact next % time of an event. Consequently, events can be asynchronous. clear all...
function out = simulation_TA_center3(u) global NUM_UAV NUM_TASK TASK_STATUS cnt if isempty(cnt) cnt =1 ; end num_data = 2*4+NUM_TASK*2+2 ; for iter = 1 : NUM_UAV wpt(1,(iter-1)*4+1:(iter-1)*4+4) = u((iter-1)*num_data+1:(iter-1)*num_data+4) ; wpt(2,(iter-1)*4+1:...
function [ W ] = pca(training_data, alpha) %PCA Returns the principal components in the form of a matrix according to %the second parameter, alpha, which dictates the energy willing to %sacrifice. % W = PCA(training_data, alpha) will return the principal components of % the training data. num_features = size(train...
function[]= DTmain() loadData; disp('Training your model...'); mdl=DTtrain(trainData, trainLabels);% this function trains your model based on the train data and train labels disp('Done training'); disp('Please enter the depth: '); depth=input(' ');% asking the user to enter the desired depth disp('prunning...'); mdl...
%main program %Kevin Phillips clear all, close all, clc %% %load the corrupted data load('ProjectMLKnew.mat'); x = MLK_HighNoise; y = MLK_LowNoise; %% %analyze the audio spechighnoise = create_spectrum(Fs,x); speclownoise = create_spectrum(Fs,y); %plot High figure(); subplot(2,1,1); plot(spechighnoise(:,1),abs(sp...
function [ qmdp ] = solve_qmdp( qmdp_belief_points, pomdp, Q ) % iterate over the states % qmdp_belief_points is the number of different beliefs we will % sample to determine the optimal policy for k=1:pomdp.nrStates % j is a counter to iterate over different % equally ...
addpath('Z:\code\stickman') addpath('Y:\008 Uncertainty Study') % useful plot tools plotMarkers = ['x'; 'o'; '*'; 's'; 'd'; 'v'; '^'; '>'; '<'; 'p'; 'h'];
function Bigtf = EDB2plotstackedTFs(firstirfile,nfiles,offset,nfft,typeofir,startsample,endsample) % EDB2plotstackedTFs - Plots a number of TFs in a stacked way. % % Input parameters: % firstirfile The data file containing the first IR file % nfiles The number of files % offset The numerical...
function output_img = myConv2(input_image, myfilter, padding_method) % input_image : noisy input image (type: double) % myfilter : filter kernel to be used for convolution (type: double) % padding_method : string that specifies the type of padding method to be used % output_img : output image (type: double...
% Generate Paramater maps based on a template of white matter/grey matter % segmentation.a w=lightbox('/home/hernan/matlab/spm8/apriori/white.nii'); g=lightbox('/home/hernan/matlab/spm8/apriori/grey.nii'); c=lightbox('/home/hernan/matlab/spm8/apriori/csf.nii'); t1map = 900 * w + 1400*g + 2800*c; flowmap = 20 * w + ...
basedir = '/Users/tomas789/Desktop/zadani1'; fid_cr = fopen([basedir '/cr.txt']); fid_eu = fopen([basedir '/eu.txt']); read_cr = fscanf(fid_cr, '%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d', [23 inf]); read_eu = fscanf(fid_eu, '%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d...
function Enhancement_Noise_Struct = compute_enhancement_noise_priors_from_background_ROIs(background_ROIs_Struct, largest_slice_ROIs_Struct, varargin) Enhancement_Noise_Struct = []; MRI_dir = '~/Data/Breast_MRI/Oxford/Matlab_Data'; plot_figs = 1; fontsize = 8; num_subplot_rows = 4; num_subplot_cols = 5; if length...
function imgout = pshift(imgin, rshift, bshift, gshift) %#ok<INUSD> %PSHIFT shift red, blue, and green channels in x and y directions % % PSHIFT(image, [rX, rY], [bX, bY], [gX, gY]) shifts the red channel in % image by rX pixels in the x direction (right is +x) and by rY pixels in % the y direction (down is...
function fix_block2_distra_faces % Due to a typo, the position of the target and distractors in all blocks 2 % of the distractor_faces conditions for the first three subjects (S54, S57 % & S65) was misplaced. This scripts 'corrects' this typo by changing the % target position. Note, however, that the error in the cre...
function varargout = detectpoint(varargin) % DETECTPOINT MATLAB code for detectpoint.fig % DETECTPOINT, by itself, creates a new DETECTPOINT or raises the existing % singleton*. % % H = DETECTPOINT returns the handle to a new DETECTPOINT or the handle to % the existing singleton*. % % DETECTPOI...
%translate MS .car file to LAMMPS .data file %atom_type atomic in LAMMPS clc,clear,close all %all the data below shoube be set yourself infile='hBN.car';%name of input .car file outfile='hBN.data';%name of output .data file outfile_dir='D:\mathworks\car2data\'; %saving path N_atom_types=2;%nu...
% given a generic planar polygon computes the % ray-polygon intersection. Polygon is a Nx2 set of samples % with cyclic indexing (no repeated last element) % % WRITTEN 1 March 2010 function ray_t = ray_polygon_intersection( ray_p, ray_n, polygon ) DEBUG_MODE = 0; if DEBUG_MODE clc, clear, close all; load ray_p...
%% comparing intracellular fluxes TestDataM=datasetM.val(2:end,:); nMeas=size(TestDataM,2); tempData=zeros(nMeas,nMod,numDels); nMeasVec=findRxnIDs(model,datasetM.rxns); cnt=1; for i=1: length(Results) if ~isempty(Results{i}) tempData(:,:,cnt)=Results{i}(nMeasVec,:); cnt=cnt+1; end...
function [data, time, abstime, eventinfo, daqinfo] = daqread(filename, varargin) %DAQREAD Frye lab version of the Data Acquisition Toolbox function to read %customized (.daq) files % % This is a function for extracting data from spoof .daq files created on % the Frye lab 2p system. Post-Matlab 2015 )using the session-b...
while 1 try imread('in.png'); run('ocr_pp'); delete('in.png'); fprintf('Restarting...\n') pause(1); catch err %fprintf(getReport(err)); %fprintf('\n'); end end
function spec = calc_spec(HH, dH, f00, bp0, bp1, nub) % B-phase spectrum calculation. % parameters from spec_normal are used % HH - mesh for calculation near the central field % dH - intrinsic line width % f00 if the generator freq % bn_p - texture angle derivative in the center for B-phase spectrum % nu...
function D=featextpartial(root,imgname,T) %load feature from bigger part of color images rgbimg=imread([root filesep imgname]); image=rgb2gray(rgbimg); image=double(image); %compare which is bigger, red or green? edgeimg=loadedge(root,imgname); numred=sum(sum(edgeimg(:,:,1)==200)); numgre=sum(sum(edgeimg(:,:,2)==200)...
function TF =classiferExists(RootDir, varargin) % Examines whether classifier exists on disk % % p = inputParser; % % p = addParamDefaults(p, 'runClassifier'); % % addRequired(p, 'RootDir'); % % parse(p, RootDir, varargin{:}); % % % modelPath = fullfile(p.Results.RootDir, p.Results.DataVersion, p.Resu...
function [out_t,grad_t,grad_t_k] = f_x(x,p,i) %% this inputs has the dimension numJoints*3 X 2 % only the current and delay ones are included % th is the ypos height to have grf % ypos is pre-calculated since it is easy to use gpuarray to achieve % i is the index,less than half the grf is on the toe, more t...
clear all; %% Setup NdtP = 20; % number of steps per period Np = 0.25; % number of periods to compute plotsol = 1; % (=1) plot mesh quality every time step fmt = '-b'; % linetype for plotting mesh quality in time N = 11; % Number of cells in y M = 11; % Number of cells in x absdisp = 1; % (=1) absolute...
%Para ejecutar: % Integracion_punto_Medio([0,1], 0.5, 8, @Ej_punto_medio) %En donde los valores corresponden a: % vector de valores iniciales, valor de h, numero de puntos, funcion function solucion = Integracion_punto_Medio(xini, h, N, f) D = length(xini); x = xini(1); y = xini(2:D); solucion ...
clc clear all close all a=imread('zoneplate.png'); %First level decomposition [p q r s]=dwt2(single(a),'db1'); b=[uint8(p), q; r,s]; %Second level decomposition [p1 q1 r1 s1]=dwt2(p,'db1'); b1=[p1,q1; r1, s1]; b2=[uint8(b1), q; r s]; imshow(b2)
function [rho,f0] = invAbel5(x,F0,N) % 1D Abel inversion algorithm based on direct evaluation of the inversion % integral (see [http://mathworld.wolfram.com/AbelTransform.html] and [http://en.wikipedia.org/wiki/Abel_transform]) % % Input Arguments: % x -- abscissa vector for the input vector F0 (x and F0 ha...
classdef overlap_block % an object that contains the overlapping blocks used by % expanding_block properties pixel % pixel{n} contains the pixels of the nth block avg_gray % avg_gray(n) = mean( elements in pixel{n}) variance % variance(n) = mean( (pixel{n} - avg...
function [vidoutput] = demo( ) vidoutput=''; reqToolboxes = {'Computer Vision System Toolbox', 'Image Processing Toolbox'}; if( ~checkToolboxes(reqToolboxes) ) error('detectFaceParts requires: Computer Vision System Toolbox and Image Processing Toolbox. Please install these toolboxes.'); end s1=evalin('base','z1'); s2...
% Benutzung des Matlab-Programmes: % 1. eine nxn Matrix A definieren. Name muss A sein % 2. Script ausführen. dA = size(A); B=A; [L,U,P] = lu(A); % Testen auf n x n Matrix if dA(1) ~= dA(2), display('A ist keine n x n Matrix!') return; end lower = eye(dA(1)); upper = zeros(dA(1)); % Transformation durchführ...
%#codegen function val = mc_gadget_transmit(pin,pot_value ) val=0; val =coder.ceval('IRTransmit',pin,pot_value); end
% frequency_mathching: Compute the frequency of occurence of a set of outcomes % % Ex: % TI=channels; % O.N=5; % Number of conditional points % [H,Oout]=frequency_matching(TI,O); % % See also mps_template % function [H,O]=frequency_matching(TI,O); if nargin<1; TI=channels; TI=TI(2:2:end,2:2:end); O.N...
function [nr,zr,s21c] = LotsSmallLines_RandomUC_COMSOL_13Feb15... (param,plotFlag,NbLines,freq) ModelUtil.remove('Model'); ModelUtil.clear import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model'); ModelUtil.showProgress(true); model.param.set('L', '0.2[m]'); model.param.set('H'...
function T = import_csvfile2table(filename,formatStr) %% get data fid = fopen(filename,'r'); % formatStr = '%s%s%d%d%f%f%s%[^\n\r]'; dataArray = textscan(fid, formatStr, 'Delimiter', ',', ... 'HeaderLines', 2-1, 'ReturnOnError', false); fclose(fid); % Close the text file. dataArray(end) = []; %% find w...
function [A,Q,G]=tmvar(PyArea,np,pt,s) % computes MVAR parameters from trial data % % PyArea..........: trial data (nd x tr x nb) % np..............: model order % pt..............: quasi-stationary window size % s...............: shift if nargin<3, pt=size(PyArea,3); end if nargin<4, s=floor(.5*pt); else, s=floor(s);...
close all %clear all; %The system k11 = 2; k12 = 1; k21 = 1; k22 = 2; K = [k11, k12 ; k21 , k22]; % case 1 %L1 = 150; o1 = 30; L2 = 80; o2 = 0; % case 2 %L1 = 80; o1 = 50; L2 = 150; o2 = 50; % case 3 L1 = 20; o1 = 0; L2 = 100; o2 = 0; %symmetric costs c1 = 1; c2 = 1; %asymmetric costs %c1 = 1; ...
%% EE6013_A5_P1.m %% Clean Up clear all; close all; clc warning('off','all') warning % id = 'MATLAB:nearlySingularMatrix'; %% Variables eq = 9; initialX = [-4; 1]; soln = [-pi/2; pi]; maxIteration = 35E3; iterations = 1:maxIteration; gradient = [2; 3]; hessian = [3, 0; 0, 4]; dt = zeros(1,eq); val = zeros(1,e...
classdef (InferiorClasses = {?matlab.graphics.axis.Axes}) MPlot4D < handle % this is a more powerful but less polished version of MPlot3D. It can % accept arrays of dimension 5 and make videos that run over the 5th % dimension. The constructor requires an array xData, which is the physical % values ascr...
%% This function groups the TRAINING faces according to their ages. % ret: a KxN matrix with each column contains a 8x1 vector of elements 0, % 1, 2 or 3. 0 means no face at this age group, 1 means train1 has one face % at this group and similarly for 2. While 3 means both train1 and train2 % have faces at this gro...
function [ varargout ] = chg0( nday,varargin ) % chg0 give the change of a sequence % nday 计算n日涨跌幅,nday>0前验,nday<0后验 % varargin time sequence %version 1.0, luhuaibao, 20140603 nseq = length(varargin); for i = 1:nseq if nday>0 seq = varargin{i}; %% 计算diff(seq),前推nday天 ...
function [ gy ] = fetch_expression( y, genes, gene ) gy = y(:, strcmpi(genes, gene) ); end
function [WingPlanformX,WingPlanformY,Chord,Wing_Span,Cr,Ct] = PlanformGenerator(SurfaceArea,Span,gammaLE,gammaTE,RootChord,crank_location,crank_angle) %PLANFORM GENERATOR %OCdt Wells, RF 28125; Aero Class of 2020 %This function generates the planform of the wing, so that it can be used to find the chords at each wing ...
clc; clear; str={'a', 'b', 'c', 'ç', 'd', 'e', 'f', 'g', 'h', 'k', 'l', 'm', 'n', 'o', ... 'r', 's', 'þ', 't', 'u', 'v', 'y', 'z' 'B' 'E' 'F' 'P' 'Y'}; word=[ ]; word2=[]; comp=[]; empty=[]; leng=[]; grtleng=[]; ornek=[]; ornek2=[]; leng=[]; platon=imread('Platon.jpeg'); gray=rgb2gray(platon); thresh=graythresh(...
function [ diag_sum ] = spiral_diag_sum( n ) c=0; if mod(n,2)==0 n=n+1; c=1; end X=zeros(n); for j=1:(n+1)/2 X(j,end-(j-1):-1:j)=(n-2*(j-1))^2:-1:(n-2*(j-1))^2-(n-2*(j-1))+1; X(j+1:end-(j-1),j)=(n-2*(j-1))^2-(n-2*(j-1)):-1:(n-2*(j-1))^2-2*(n-2*(j-1))+2; X(end-(j-1),end-(j...
%% The MNIST dataset of handwritten digits % Demonstrates loading the <http://yann.lecun.com/exdb/mnist/ MNIST dataset>. % % <https://github.com/opencv/opencv_contrib/blob/3.1.0/modules/datasets/samples/or_mnist.cpp> % %% MNIST dataset % download/extract files if needed dirMNIST = fullfile(mexopencv.root(), 'test', 'm...
function test_fft im_dir = '../faces/'; im = imread([im_dir 'c001.jpg']); %% im_fft = fft2(im); nPts = 390; %length(im(:)); % % ridxs = randperm(nPts); R = abs(im_fft(1:nPts, 1:nPts)); theta = angle(im_fft(1:nPts, 1:nPts)); theta = reshape( theta(randperm(nPts * nPts)) , nPts, nPts); Z = R .* exp(1i * theta); i...
function dydx=grad_II(x,y) dydx=nan(size(y)); for i=2:length(y) dydx(i,1)=(y(i)-y(i-1))/(x(i)-x(i-1)); end end
% This is the Two-Resistance Mechanism attribution method for T2 % edited on 4/3/20 function [Diff_T2,... Rn_str_ref, Grnd_ref,ro_ref,ra_ref,rs_ref,f_TRM_ref,... Rn_str_sel, Grnd_sel,ro_sel,ra_sel,rs_sel,f_TRM_sel,... ra_prime_ref,f_2_TRM_ref,... ra_prime_sel,f_2_TRM_...
function res = commutatorSE3(u,v) %This method computes the commutator [u,v] = [(u1,u2),(v1,v2)] = %(u1 x v1, u1 x v2 - v1 x u2). u1 = u(1:3); u2 = u(4:end); v1 = v(1:3); v2 = v(4:end); res = zeros(6,1); res(1:3) = hat(u1)*v1; res(4:end) = hat(u1)*v2 - hat(v1)*u2; ...
function [area] = workingArea(l1,l2,l3,theta1_min,theta1_max,theta2_min,theta2_max,theta3_min,theta3_max) %Working Area using Green Theorem %Inputs: L1, L2, Theta 1 min,Theta 1 max, Theta 2 min, Theta2 max %Return: The working area close all % 1st path: q1 = min, q2 = min, q3 = var -- Done % 2nd path: q1 = min, q2 =...
addpath('~/HELPFUN'); addpath('/mnt/disk1/ImageNet1M'); addpath('/mnt/disk1/ImageNet1M/ImageNettiny'); %load('sample_anchor_graph.mat') %sZ = Z; load('mean.mat'); %load('anchor1000.mat'); load('ILSVRC2012_caffe_CNN.mat') %nbits = 128; %load([num2str(nbits) '.mat']) %sB = Z; traindata = bsxfun(@minus, traindata, m); ...
function [ bitStream ] = LDPC_decoder_hard( bitStream_enc, H ) %LDPC_DECODER_HARD Decode LDPC encoding. % Decode LDPC encoding using a hard decoding scheme. This method should % go fast and be pretty optimized. [c_num,v_num] = size(H); bitstrm_enc_rshp = reshape(bitStream_enc,v_num,[])'; H ...
%%%Data Engine%%% TorqueMax=7700; %[Nm] ThrustMax=23000; %[N] AoAMax=18; %[deg] AoAEffective=12; %[deg] RPMMax=6400; %[RPM] RPMEffective=6400; %[RPM] TorqueCoefficientUP=0.119615; %[Nm/rpm] TorqueCoefficientDOWN...
function [s, range, select] = srf(this, time, varargin) % srf Shock response functions, first-order solution only. % % Syntax % ======= % % S = srf(M,NPer,...) % S = srf(M,Range,...) % % Input arguments % ================ % % * `M` [ model ] - Model object whose shock responses will be simulated. ...
function stm=stm(A); L = eig(A); n=length(A); I=eye(n); o=ones(n); H=zeros(n,n); for i=1:n-1 G(:,i)=L.^i; end H=[o(:,1),G]; for i=1:n-1, if L(i)==L(i+1), for j=1:n, H(i+1,j)=(j-1)/L(i+1)*H(i+1,j); end else end end K=inv(H); m=n*n; for j=1:n for i=1:n:m L1(j,i+j-1)=L((i+n-1)...
function [Wi,Wo] = nc_winit(Ni,Nh,No,range,seed) %NC_WINIT Neural classifier weight initialization % [Wi,Wo] = nc_winit(Ni,Nh,No,range,range,seed) % Uniform weight initialization % Input: % Ni: no. of input neurons % Nh: no. of hidden neurons % No: no. of output neurons % range: weight initia...
function E = feature_energy(window) E = (1/(length(window))) * sum(abs(window.^2));
function output = round2Ndecimals(input, N) output = round(input * 10^N) / 10^N; end
%将处理后的数据进行PCA投射 function[data_new]=Q2_step2(data,T) %T=0.9 % data=data_354;T=0.9; [n,dim]=size(data); std_data=std(data); %标准差 mean_data=mean(data); %平均值 for i = 1:dim data_norm(:,i) = (data(:,i) - mean_data(:,i))/std_data(:,i);%标准化data end Cdata=corrcoef(data_norm); ...
clear clc d1=dlmread('fit.txt'); tam=size (d1) np=tam(1,1) d2(1,1)=0 d2(1,2)=0 d2(2,1)=100 d2(2,2)=0 %figure(1) plot(d1(:,1),d1(:,2),'-k') hold on plot(d1(:,1),d1(:,3),'*b') hold on plot(d2(:,1),d2(:,2),'-r') axis([0 100 -250 250])
input = outvec; % input = [0 64; % .04 40; % .04 44; % .04 47; % .1 59; % .20 64; % .24 40; % .24 44; % .24 47; % .3 59] fileout = 'run_2'; time = input(:,1)*tscale; notes = input(:,2); y_sound = zeros(100,2); M=size(i...
function [ Aout ] = MPO_Reshape( A, dir1, dir2 ) %reshape an MPO in 'dir1' orientation to 'dir2' orientation %dir1, dir2 can be 'left', 'right', 'up', 'down' if strcmp(dir1, 'down') || strcmp(dir1, 'up') [~, N] =size(A); else [N, ~] = size(A); end if strcmp(dir2, 'down') || strcmp...
function w = power(w,p) % w.^p w = tospace(w); % only makes sens in space for i = 1:length(w.coarse) w.coarse{i} = w.coarse{i}.^p; end for i = 1:length(w.wav) for m = 1:length(w.wav{i}) w.wav{i}{m} = w.wav{i}{m}.^p; end end end
%% This function will calculate the Lift Curve Slope for both the horzontal and vertical tails. % The tail aerodynamic analysis is calculated using the same methods as for % wing lift analysis. However the following assumptions are taken into % account: The fuselage spillover factor may be ignored for a horizontal ...
%% Maximizing Expected Prediction Error (MEPE) %Liu, Haitao, Jianfei Cai, and Yew-Soon Ong. "An adaptive sampling approach for kriging metamodeling by maximizing expected prediction error." %Computers & Chemical Engineering 106 (2017): 171-182. function x_new = MEPE_function(obj,A,strategy) % Details: Starting function...
function logchaos clf hold on % each time through the loop we try a different value of r for r=2.4:0.01:4.0 % compute the first 50 values of the sequence V = logmap(r, 0.5, 50); % trim off the first 10 values V = trim(V, 10); % make...
function result = dF_Ffunc( data, T_baseline, fluo_bg_idx ) %DF_RFUNC deltaF/F0 calculation for 5D data of the format CXYZT % datasize=size(data); % reshape data into tRT size data=reshape(data,[datasize(1),prod(datasize(2:4)),datasize(5)]); % f0 has no T dimension, so repmat for - operation f0=repmat(mean(data(:,:...
%% [pxx,f]=pmtm(NC,4,[],1000); PXX{k}=pxx; subplot(1,2,1) px=mean(pxx,2); s=semilogy(f,(px),'Color',myColorMap(k,:),'LineWidth',2); xlim([0 300]) %% Fline=[31 32 33.2 34 66.4 99.6 166.5 232.9]; %Fline=[ 33 ]; % % %[NC] = ft_notch(NC, Fsample,Fline,20,0.5); % [NC] = ft_notch(NC, Fsample,Fline,0.5,0.5); % nu1=50; ...
close all ; % Data from onlyincluded prior2normal % 'D:\MaggiesFarm\2019_04_17_MF_dev_explore\data_thompson_mod12_new.xlsx' tmp = load('datathompsonmod12.mat'); data = tmp.datathompsonmod12; clear tmp; ID = data.ID(2:end); age = data.age(2:end); const_SH = data.ConsistenSH(2:end); const_LH = data.Consi...
% Relative_Strength_Index Strategy %if RSI<30: signal for buy %if RSI>70: signal for sell function [Profit,AccumulatedProfit,NumTransaction]=Relative_Strength_Index(Period,InitialBank,Commission,Equity) % matlab functtion: rsindex %14 periods Price=Equity; DiffPrice=diff(Price); DiffPrice=DiffPrice(:,1); %closing p...
% ========== MCMC implementation for project ========== % % Importing the stock prices prices = xlsread("Price History_Commonwealth bank.xlsx", "Sheet 1", "B12:B2210"); % Converting the prices to returns prices_shifted = [NaN;prices(1:end-1)]; returns_full = log(prices./prices_shifted); returns = returns_full(2:end)...
function [ x_gamma, y_gamma , x_gs, y_gs ] = getGammaProfiles(X, Y, D, xx, yy) % function getCrossProfiles(X, Y, D) % returns cross profiles from dose matrix <D> at location x = <xx> and y % = <yy> % % By Dustin Jacqmin PhD, Medical University of South Carolina x_gamma = interp2(X,Y,D,X,yy); y_gamma = interp2(X,Y,...
% BME313L_Lab7_P3_ShaoPoHuang % This program will calculate the eigenvalues and eigenvectors for a given % system of equations relating Sr-90 concentration to time in five % different lakes and generate a combined plot clear; clc; close all; % clears variables and console, close all figures k = 0.69315/28.8; %...
function generate_images(config, image_type) listAudioFiles = dir([config.dir_audios, '*.wav']); nAudios = length(listAudioFiles); %%%%%%%%%%%%%%%%%% % For each audio % %%%%%%%%%%%%%%%%%% for n=1:nAudios fprintf("\n============================"); fprintf("\nAudio %d / %...
function [K_vec, error] = ... validationCurve(X, max_iters); % K_vec: values of number of centroids. % error: error of the model. % X: X train set. % max_iters: maximum number of iterations K_vec = [2 3 4 5 6 7 8]'; error = zeros(length(K_vec), 1); for i = 1:length(K_vec) K = K_vec(i,1); fprintf...
% using Meakin 2013 formulation for BIR-8 pulses % units are seconds, cm, radians, Gauss % this version is trying to simplify to BIR 4 clear all close all clc Npoints = 250; Tseg = 2e-3; % seconds Tgap = 100e-6; t=linspace(0,Tseg,Npoints); gamma = 2*pi*4.257e3; % rad/s/gauss zeta = 15; kappa = atan(60); % 1.5541; t...
function matUpdateOutputResult( obj, time, fphys2d, fphys3d ) %MATUPDATEOUTPUTRESULT Summary of this function goes here % Detailed explanation goes here for m = obj.Nmesh obj.outputFile2d(m).outputIntervalResult( time, fphys2d{m}(:,:,obj.outputFile2d(m).varIndex) ); obj.outputFile3d(m).outputIntervalResult( ...
function saveImgtoTxt(folder,savefolder , txt_name, test_id_num) % folder % the path where mat files are saved % savefolder % the path save the txt files % txt_name: base name for save the text files if ~exist(savefolder,'file') mkdir(savefolder) end filenames = dir(folder); filenames_new = filenames(3:end); f...
function [W, H, cost] = lnmf(V, num_basis_elems, config) % lnmf Decompose a non-negative matrix V into WH using Local NMF [1] by % minimizing the KL divergence. W is a basis matrix and H is the encoding % matrix that encodes the input V in terms of the basis W. % % Inputs: % V: [non-negative matrix] % m-by-n n...
% small_parallel_hwfet_in.m ADVISOR 2003-00-r0116 input file created: 21-Feb-2014 21:16:19 global vinf vinf.name='small_parallel_hwfet_in'; vinf.drivetrain.name='parallel'; vinf.fuel_converter.name='FC_SI41_emis'; vinf.fuel_converter.ver='ic'; vinf.fuel_converter.type='si'; vinf.torque_coupling.name='TC_DUMMY'; vin...
%2012 12 1 by lichao %产生渐变数据,以便微透镜成像观察 clc clear all close all N=101; d=30; data_grad=zeros(N); for i=1:N data_grad(i,:)=mod(i,d); end figure imshow(data_grad,[]) save data_grad data_grad
%対応点の計算と決定 %点間の距離判定を行い、最近傍点を対応点に決定する %GPAまたはICPの場合 %Initialize---------------------------------------------------------------- clear all clc; tic; %Set parameter------------------------------------------------------------- sample = 200; landNo = 17; %GPAのとき inLand = 'alignLand/alignland%d.xls'; inVec = 'moveData/ali...
%% get_id_orthoptera % gets id of species name in Orthoptera Species File Online %% function id = get_id_orthoptera(my_pet, open) % created 2021/08/13 by Bas Kooijman %% Syntax % id = <../get_id_orthoptera.m *get_id_orthoptera*>(my_pet, open) %% Description % Gets identifier for Orthoptera Species File Online % % In...
function [f,t,YMat] = FFT_sliding_window(y, Fs, windowSize, stepSize) % % y: the signal to compute FFT on. % Fs: sampling rate in Hz. % windowSize: time of window in which to compute FFT in seconds. % stepSize: how far to move in seconds before each successive FFT. % % % DHO, 3/08 % windowSize = windowSize*Fs; stepSi...
function [Xnew, err]= line_linearSolve(Li, Lj, Omega, X) x=zeros(12,1); x(1:3)=X(1,1:3)'; x(4:6)=X(2,1:3)'; x(7:9)=X(3,1:3)'; x(10:12)=X(1:3,4); H=zeros(12,12); b=zeros(12,1); err = 0; for k = 1:size(Li)(2) A=zeros(6,12); li = Li(:,k); lj = Lj(:,k); wi = Li(1:3,k); di = Li(4:6,k); ...
function [y, total, sum_ti, sum_tz] = nnconv( x, f , b, stride, pad, threshold) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here % x = h * w * c * n; % f = fh * fw * fc * k; % y = yh * yw * k * n; % yh = ((h - (fh-1)) + 2*pad) / stride % yw = ((w - (fw-1)) + 2*pad) / stride % global to...
function res = lorenz() [T, M] = ode45(@rate_func, [0 30], [1 2 3]); X = M(:,1); Y = M(:,2); Z = M(:,3); comet3(X,Y,Z); end function res = rate_func(t, V) x = V(1); y = V(2); z = V(3); sigma = 10; b = 8/3; r = 28; dxdt = sigma * (y-x); ...
function sig=noise3(beta, n) %sig=FractRnd(beta, n) %To generate 1/f^betta noise %INPUT % beta is the exponent, a number % n is the number of synthetic data points %OUTPUT % sig is an n-points array % len_beta=length(beta); phi_n=2*pi*rand(1,n); %[B,A] = butter(10, 0.2); %phi_n=filter(B,A,phi_naa); f=[1:n].^(...
function [H,SS,Q] = getPCRegression(Z0,Z1,Z2,X0,X1,X2,ts) %GETPCREGRESSION Returns per-channel regression for lagged samples onto average PC % % [H,SS,Q] = kal.getPCRegression(Z0i,Z1i,Z2i,X0,X1,X2,ts); % % Note: this function is redundant and is just for the sake of explicitly % enumerating how steps are proce...
function rtstruct = getRtStructForPlan(patient, planUid) %GETRTSTRUCTFORPLAN [please add info on me here :<] if ~patient.planReferenceObjects.rtstructsForPlan.isKey(planUid) rtstruct = []; return; end rtstruct = patient.getDicomObject(patient.planReferenceObjects.rtstructsForPlan(planUid)); ...
%If one continuous bond, as identified by watershed segmentation, touches %more than 2 grains, this script identifies which bond voxels belong to %which grains function [GrainPair,CCbonds]=multigrain(bondnum,CCbonds,labelgrn) %Function to separate bond areas in the case of >2 grains per continuous bond. Separated=[0 ...
function S=s_minus(A,B,C,D,dc,tol) %S_MINUS Stable Strongly Controllable Geometric Subspace % % S = s_minus(A,B,C,D[,dc]) % % computes a matrix whose columns span the geometric subspace % S^{-} for a system characterized by (A,B,C,D). % % Note that by default or if dc = 0, the...
fid = fopen('clean.txt'); tline = fgetl(fid); count=1; full=1:25; Adjacency=[]; while ischar(tline) tline = strip(tline); tline_split=split(tline,' '); tline_split=str2double(tline_split); A = ismember(full,tline_split); Adjacency=[Adjacency A']; tline_split=[]; tline = fgetl(fid);...
function this = draw(this, name, type, pos, size, value, cb) import AMF.* control.name = name; control.type = type; control.pos = pos; control.size = size; control.callback = cb; control.value = value; control.selected = ''; this.controls.(name) = control; this.dim(1) = max([control.pos(1) + control.size(1) + 2, th...
function [datamatrix] = generateDataMatrix(num_sensor,num_slot) datamatrix=zeros(num_sensor,num_slot); for i=1:num_sensor start=(num_slot-(num_slot/4))*rand; start=ceil(start); size=(num_slot*4)/rand; size=ceil(size); ending=start+size; for j=1:start datamatrix(i,j)=0; end ...
function [ allS,cm,allP,unq,allL ] = looMMC(sp,grp) %looMMC - leave one pixel out cross validated MMC % % For the spectral data and its groupings, we need to iteratively perform % leave one pixel out MMC and then predict the left out pixel. Perhaps by % default we will use 3-nearest neighbours. Also try to present the ...