text stringlengths 8 6.12M |
|---|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FRE 6251 Numerical and Simulation Techniques in Finance
% Assignment #1
% Name: Surya L Gurung ID: 0449604
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [v, sDev] = AsianOption(So, K, T, r... |
function c = projection_back(Y, ref)
% Parameters:
% Y : T x F x N
% ref : T x F
% c : F x N
num = squeeze(sum(bsxfun(@times, conj(ref), Y), 1));
denom = squeeze(sum(abs(Y).^2, 1));
I = (denom > 0);
c = ones(size(num));
c(I) = num(I) ./ denom(I);
|
clear all; close all;
t = linspace(0,25,1000);
omE = 0.2;
omD = 1.996;
omN = 2;
dR = 0.0625;
uH = exp(-dR*omN.*t).*(-2.5185*cos(omD.*t)-0.211*sin(omD.*t));
uP = 2.5185*cos(omE.*t)+0.5368*sin(omE.*t);
u = uH+uP;
figure;
grid;
plot(t,uH);
hold on;
plot(t,uP);
hold on;
plot(t,u); |
function hdf5export_wrapper(file_out, joints_structure, meta_as_struct)
%% TODO! Maybe there is a way to directly write the structure as HDF5?
% https://uk.mathworks.com/help/matlab/import_export/exporting-to-hierarchical-data-format-hdf5-files.html
if exist(file_out, 'file') == 2
delet... |
function f_cg = F_CoriGrav(s1,phi1,theta,s2,phi2,ds1,dphi1,dtheta,ds2,dphi2,x2,y2,g,k1,k2,L_sp0,L_mB,mB,IB,m1)
%F_CORIGRAV
% F_CG = F_CORIGRAV(S1,PHI1,THETA,S2,PHI2,DS1,DPHI1,DTHETA,DS2,DPHI2,X2,Y2,G,K1,K2,L_SP0,L_MB,MB,IB,M1)
% This function was generated by the Symbolic Math Toolbox version 7.1.
% 14-Jan-20... |
% test factorial
%% Test base case
assert(1 == factorial(0), 'factorial(0) should be 1');
%% Test number
facOfTen = 10*9*8*7*6*5*4*3*2*1;
assert(facOfTen == factorial(10), 'factorial(10) should be 3628800');
|
function dataPrep(inputPath,outputPath)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
[Seconds,Lux,CLA,Activity,x,y] = importfile(inputPath);
matTime = Seconds/3600/24; % convert to MATLAB time
strTime = datestr(matTime,'HH:MM:SS mm/dd/yy');
Time = mat2cell(strTime,ones(size(strTime,1... |
load('testSet.mat');
f = fopen('testLabels.txt', 'w');
for i = 1:10000
fprintf(f, '%d ' , testLabels(i));
end
|
clc;
clear all;
%construct A
A = zeros(4,4);
for i = 1:4
A(i,i) = 4;
end
for i = 1:3
A(i,i+1) = -1;
end
for i = 1:3
A(i+1,i) = -1;
end
n = 3; %12 by 12 matrix
Ar = repmat(A,1,n);
Ac = mat2cell(Ar,size(Ar,1),repmat(size(A,1),1,n));
diag_A = blkdiag(Ac{:});
%construct -1 bond of A
A1 = zeros(4*n,4*n);
for ... |
%----------------------------------------------------------------------------
% NA_options - reads in all input options for NA algorithm.
% Calls no other routines.
%Comments:
% This routine assumes that direct access
% files are opened with the record length specified
% ... |
function ii_image = generate_illinvimg(image, alpha, inv)
%Implement the algorithm proposed by Will Maddern et al. in ICRA2014
%Paper:
% Illumination Invariant Imaging: Applications in Robust Vision-based
% Localisation, Mapping and Classification for Autonomous Vehicles
%
% ii_image = rgb2ii.maddern2014(image, alpha,... |
%% load VOPS and local Q matrices
[Filename,Pathname]=uigetfile('*.mat','Pick the VOP matrices');
load(fullfile(Pathname,Filename));
[Filename,Pathname]=uigetfile('*.mat','Pick the local Q matrices');
load(fullfile(Pathname,Filename));
model ='Implemented';
switch model
case 'Implemented'
%% Reduce dimensions... |
% Homework #3b
% Function rf_newton2d(x0,tol,iter)
% Given an initial guess x0, finds a local
% root.
% input:
% f : inline function
% x0 : starting point
% tol : tolerance (absolute)
% iter : maximum number of iterations.
% output: rootf, the root
% iend, the number of iterations used.
%... |
%Calculates the numbers of stpes required to converge.
%Parameters:
% FM fuzzy markov matrix
% ProbM: probabilistic matrix
% maxIter: max number of iterations.
%Returns:
% iterF: number of iterations to convrge with a fuzzy MArkov chain.
% fConver: true if matrix FM converges, false otherwise
% FMC: final matrix afte... |
function result_sum=peri_sum(M)
result_sum = sum(sum(M)) - sum(sum(M(2:end-1, 2:end-1)));
end
% B = A(2:end-1,2:end-1);
% s = sum(A(:)) - sum(B(:)); |
function elem=atringparam(fname,varargin)
%ATRINGPARAM(FAMNAME,E0,NBPERIODS)
% creates a RingParameter Element which should go at the beginning of the ring
%
%FAMNAME Family name which may be used as name of Ring
%E0 Energy of electrons
%NBPERIODS Periodicity of the ring (1 if ring is already expanded)
%
%See a... |
function varargout = ControlChart(varargin)
% CONTROLCHART MATLAB code for ControlChart.fig
% CONTROLCHART, by itself, creates a new CONTROLCHART or raises the existing
% singleton*.
%
% H = CONTROLCHART returns the handle to a new CONTROLCHART or the handle to
% the existing singleton*.
%
% CO... |
function CondAdLIF_STDPLargeSimWeightAnalysis(ww)
%% Add the approprate folders to the path
%Path of the SOSpikingModel repository
%repopath = '/Users/dlevenstein/Project Repos/SOSpikingModel';
%repopath = '/Users/jonathangornet/Documents/GitHub/SOSpikingModel/';
%repopath = '/scratch/jmg1030/WeightAnalysis/SOSpiking... |
%{
psy.MovieStill (imported) # cached still frames from the movie
-> psy.MovieStillStore
still_id : int # ids of still images from the movie
---
still_frame : longblob # uint8 grayscale movie
%}
classdef MovieStill < dj.Relvar
methods
function makeTu... |
function processColorImages(rgbImageFileName)
% The argument rgbImageFileName is a string
% split the filename up
[~, name, ~] = fileparts(rgbImageFileName);
% Load the image
% result should be saved to <rgbBaseImage>
rgbBaseImage = imread(rgbImageFileName);
% call saveOut... |
clear all;
queryFileName = 'hello.wav';
fileNames = {'guitar.wav', 'hello.wav', 'meow.wav', 'hiss.wav', 'on.wav'};
labels = {'guitar', 'speech', 'cat meow', 'hiss', 'on'};
threshold = 10;
numberOfCentroids = 18;
VRClass.computeAndPrint(queryFileName, fileNames, labels, threshold, numberOfCentroids);
|
function trial_splits = rr_get_splithalves(trials, splitvar)
% function trial_splits = rr_get_splithalves(trials, splitvar)
trial_splits = cell(2,1);
us = unique(splitvar);
for si = 1:length(us)
tsi = find(splitvar == si);
end
end |
function [ans, iter] = Secant(a, x0, x, eps)
MAX = 100;
format long;
if nargin == 0
a = 115;
x0 = 10.0;
x = 11.0;
eps = 10e-6;
elseif nargin == 1
x0 = floor(sqrt(a));
x = ceil(sqrt(a));
eps = 10e-6;
elseif nargin == 2
eps = 10e-6;
end
ans =[];
iter = 1;
while iter < MAX
iter = i... |
%% Load parameters
params;
config;
%% Helping variables
E = [M*L*R - 2*J M*L^2 + Jt;
(2*m+M)*R^2 + 2*Jk + 2*J M*L*R];
F = 2*[-km*ke/r 0;
km*ke/r 0];
G = [0 -M*g*L;
0 0];
H = 2*[-km/r;
km/r];
% State space matrices
A = [0 0 1;
0 0 0;
0 0 0];
A(2... |
function distance=ioiDistance(queryIoi, dbIoi)
% qbtDistance: Compute the distance between query and database IOIs
% Usage: ioiDistance(queryIoi, dbIoi)
if length(queryIoi)<2, distance=inf; return; end
if length(dbIoi)<2, distance=inf; return; end
queryIoi=queryIoi(:);
dbIoi=dbIoi(:);
queryIoi(queryIoi==0)=[];
dbIoi(d... |
function [z, x] = iota_pulse(M,N,alpha,L)
n = -N:N-1;
% definition of the initial gaussian pulse
x = ((2*alpha)^(1/4))*exp(-pi*alpha*(2*n.^2)/(M^2));
% orthogonalization of x
k = 1;
y = zeros(size(x));
I = zeros(size(x));
for n = -N:N-1
for l = -N/2:N/2-1
I(k) = I(k) + (((2*alpha)^(1/4))*ex... |
function [features, validPoints] = siftForBoW(imageFile)
% used original SIFT programme: http://www.cs.ubc.ca/~lowe/keypoints/
% input: image filename
% Image will automatically convert to greyscale in the following line.
[~, features, validPoints] = sift(imageFile);
% image: the image array in double format
% ... |
clear all
% parameters region
numCols = 500;
cliprange = [135 134+numCols];
% define three different regions inside each B-Scan, for which seperate appearance models are trained
bscanregions = [1 200 300]';
% we define 17 regions across the volume, to reduce the amount of ground truth required
% for each region, we ha... |
function xcorralysis
animalid = '140618';
block = 3;
tetrode = 6;
cell1 = 6;
cell2 = 2;
freqbinwidth = 5;
sr = 1000;
supath = ['C:\Users\Julia\work\data\' animalid '\singleunits\'];
basename = [animalid '_block' int2str(block) '_tet' int2str(tetrode)];
files = dir([supath, basename, '*.mat']);
for i = 1:length(fi... |
try
require mimetic incomp diagnostics streamlines
catch
mrstModule add mimetic incomp diagnostics streamlines
end
clear all
%*************************************************************************
%general setup
nx=50; ny=50; %more grid needed to find the time-of-flight accurately
G = cartGrid([nx,n... |
function allevents = DetectEventsInRecording(FileBase)
% Runs a series of scripts to extract basic events from a file - shocks
% via a recording of shocker command, movements from a movement pad, tones
% from a tone command (?recording also?). All outputs should be in
% seconds, not timepoints
%% get the basic file... |
function varargout = ps_LST_update(varargin)
%ps_LST_tlv Check if the newest version of LST is installed.
% Part of the LST toolbox, www.statistical-modeling.de/lst.html
installed = importdata(fullfile(spm('dir'), 'toolbox', 'LST', 'lst-version.txt'));
proceed = 1;
try
online = urlread('https://www.statistical... |
function table2
% This function provides the information of table 2 of the paper
%
% this code, by Felipe Alonso-Atienza
% felipe.alonso@urjc.es
close all; clear all; clc;
data_path = '../data/';
w_length = [4, 8];
k = 1;
% load data and calculate performance: Se, Sp and BER
Se = zeros(30,4);
Sp = zeros(30,4);
BER... |
function[tc] = doubleLogNormal_multi(x,params)
% function[tc] = doubleLogNormal_multi(x,params)
%
% Return lognormal tuning curves (i.e. response to multiple speeds) for
% multiple neurons at once.
%
% x - speeds (single column vector)
% params - 5 column matrix (each row represents a neuron). Columns: 1)
% spee... |
%%% computes Gabor fits to neural activity based on responses to
%%% natimg2800, uses an additive model (simple + complex cell)
% * add divisive normalization fitting * %
function fitGaborRFs(dataroot,matroot,useGPU)
% load images
load(fullfile(dataroot, 'images_natimg2800_all.mat'));
% use left and center screen
im... |
%{
mice.Transfers (manual) # completed transfers
-> mice.Mice
dot : date # date of transfer
---
from_owner="none" :enum('Jake','Manolis','Dimitri','Shan','Keith','Cathryn','Deumani','Matt','Megan','Paul','Shuang','Other','Available','none') # previous owner
to_owner="none" :e... |
function [ Duct ] = TurbDuct( DuctIn, DesignInputs, DesignCriteria )
% Set output equal to input, overwrite and add to throughout
Duct = DuctIn;
% Extract relevant information from DesignCriteria
NDLMax = DesignCriteria.TurbDuct.NDLMax;
NDLMin = DesignCriteria.TurbDuct.NDLMin;
DeltaRMax = DesignCriteria.TurbDuct.Delt... |
function H = hypothesis(i,theta, X)
% i : Index of X(i)
len = length(theta);
H = 0;
for idx = 1:len
H = H + theta(idx,1) * X(i,idx);
end
H = sigmoid(H); |
% xSimulateGrid.m
%
% Generate a grid of normalized simulated ASE data with a range of OEF and DBV
% values, which will then be used for FABBER inference (or for grid search
% inference, one entry at a time). Based on MTC_qASE.m and MTC_surfASE.m
%
% MT Cherukara
% 5 December 2018
%
% Actively used as of 2019-04-08
%
%... |
%% fn_eegdisplay
%% Syntax
% fn_eegdisplay([xidx,yrange,]eeg)
%% Description
% (old) display of 2D data, with possibility to toggle between image or
% multi-curves displays
%
% See also fn_eegplot
%% Source
% Thomas Deneux
%
% Copyright 2005-2012
%
|
classdef detune < sqc.op.physical.gate.Z_z_base
% detune pulse
% Copyright 2016 Yulin Wu, University of Science and Technology of China
% mail4ywu@gmail.com/mail4ywu@icloud.com
properties
ln=0 % length
df=0 % detune amplitude
end
methods
function obj = detune(qubit)
obj = obj@sq... |
function [ R4S,R2D,R2P ] = OXRAT( E )
%OXRAT electron impact branching ratios
%:::::::::::::::::::::::::::::::::::: OXRAT ::::::::::::::::::::::::::::::::
% SUBROUTINE OXRAT(E,R4S,R2D,R2P)
%....... This subroutine returns the electron impact branching ratios
%....... for atomic oxygen from Burnett and Rountree Phy... |
% FUNCTION: createModelFUN
%
% Use compressed data vector and apply vector deformations to template and
% deofrm template contour to represent test contour.
%
% ---------
% Author: Dinithi Bamnuarachchi
% e-mail: mailtodinithi@gmail.com
% created the 02/07/2013.
% ---------
function [] = createModelFUN(... |
function [t,x,days,K_disc,A,Kfun] = lockdown(data, K0_disc, K0_cont, options)
%
% [t,x,days,K_disc,A,Kfun] = lockdown(data, K0_disc, K0_cont, options)
%
% Lockdown è divisa in 3 parti: calcolo i k discreti, fitto i valori
% discreti per ottenere una funzione continua k(t) inserendo i parametri
% del fitting po... |
function [A] = offdb(A,area,n_area)
% Syntax: [A] = offdb(A,area,n_area)
%
% Purpose: Set the diagonal blocks of the matrix A equal to
% 0.
%
% Input: A - a square matrix
% area - a matrix defining the block diagonal
% structure of A.
% n_area - number of indices in diagonal block... |
%% Define Red Pitaya as TCP/IP object
clc
close all
% IP= '192.168.101.108'; % IP of your Red Pitaya...
IP= 'rp-f01b63.local'; % rp-MAC.local MAC are the last 6 characters of your Red Pitaya
port = 5000; % If you are using WiFi then IP is:
RP=tcpip(IP, port,'InputBufferSize',3... |
function [X,Error,contador1QR,contador2QR] = QR(A, b)
X=[];
[m, n] = size(A);
R = zeros(n, n);
V = A;
Q=zeros(m, n);
contador1QR = 0 ;
contador2QR = 0 ;
for i =1:n
R(i,i)= norm(V(:,i));
Q(:,i)= V(:,i)/R(i,i);
for j=i+1:m
R(i,j)= (Q(:,i)')*V(:,j);
V(:,j)=V(:,j) - R(i,j)*Q(:,i);
contador1... |
function [mean_smap] = get_smaps_mean(smaps,part)
if ~exist('part','var') part = size(smaps,3); end
smaps_part = smaps(:,:,part);
if size(smaps,3) > 1
mean_smap = normalize_minmax(mean(smaps_part,3));
else
mean_smap=smaps;
end
end
|
%% Sheel Nidhan
% Date - 13th February 2020
clear; clc; close all;
%% Read in the velocity field at one time instant
x = 40;
% dir_vel = strcat('/home/sheel/Work2/projects_data/spod_re5e4/frinf/data_files_uniform/x_D_', int2str(x), '/');
dir_vel = './';
%% Read the grid file
nr = 354;
ntheta = 256;
numvar = 3;... |
function runme_IPM_mockdata(scenario)
% Run central coast rockfish IPM model on simulated blue rockfish datasets for validation
% Forked from runme_IPM...formats the mockdata to interact with the
% rockfish_fit_pisco code
% Load in the metadata used to create the mockdata
load('SMYS_Pt_Lobos_pre2007_13Dec2013_metadat... |
% regression: loglog
p2 = polyfit(log10(dc{2}), log10(dc{1}),1)
g2 = @(v) 10.^polyval(p2,log10(v));
% reproduce fig7
figure;
semilogx(dc{2},dc{1}, 'o');
hold on;
xvals = 10.^linspace(log10(min(dc{2})),log10(max(dc{2})),100);
semilogx(xvals, g2(xv... |
clear, close all
generateDataWithGivenPiQR
b=y
n=length(b)
for t=2:n
prior=[0.2 0.8]
likelihood=[0.3 0.7; 0.4 0.5]
%how do I incorporate new prior,likelihood as compared to the ones in the
%BayesRule1 function?% Figure this out later
k=b(1)
d=length(prior)
x=BayesRule1(prior,likelihood,k)
end
x |
%==========================================================
%
% levi silvers October 7, 2020
%
% add additional models
% add colors for each model
% plot Circulation intensity (addition of up and down)
%==========================================================
import_RCEMIP... |
ct = 0;
for i = 2:length(ISI)-1
ct = ct+1;
currSpike = spiketimes_thiscell(i);
beforeSpike = spiketimes_thiscell(i-1);
afterSpike = spiketimes_thiscell(i+1);
ISIbefore(ct) = currSpike-beforeSpike;
ISIafter(ct) = afterSpike-currSpike;
end;
%%
X = [(ISIafter);(IS... |
function [ splines ] = compute_trajectory(r0, rf, t0, limits);
%% Returns a set of polynomial coefficients and times for computing the
% optimal trajectory for a refernce step starting with \mathbf{x} = 0
splines = [];
dlim = limits(1);
jlim = limits(2);
alim = limits(3);
vlim = limits(4);
xlim = rf-r0;
j0 = 0;
a0 ... |
%% fn_read_OCT.m reads an OCT/U file and outputs an oct object with a header and body field
% Alex Salmon - Created: 2017.03.10
%
%% extractOctFunction.m
% Editable function file for extracting the contents of a .oct file.
%
% Revision history
% 2010.10.26 Created file.
% 2017.03.10 Functionalized
% 2018... |
function bw = simple_thresholding(im, threshold)
%% variables
% im - input image of size NxM
% threshold - threshold
% bw - output binary image
%% simple thershold
bw = zeros(size(im));
bw(im>=threshold)=1;
end |
function [goOn, notProcessedList] = getFileNumbersForAutomatedProcessing(DataDescriptors, guiMode, descriptor)
% GETFILENUMBERSFORAUTOMATEDPROCESSING: Gui helper used in octsegMain for
% finding out if the user wants to segment the remaining or all files.
%
% First checks, if the segmentation (set by the descriptor) h... |
% Combinaciones de valores para x1 y x2 aleatorias definidas en los
% rangos
[x1, x2] = meshgrid(-5:0.01:5, -5:0.01:5);
% Funciones (f1 y f1)
f1 = x1.^2 - x2.^2 + 3;
f2 = (x1 + 2).^2 - x2;
% Lineas de contorno o lineas de isovalor, combinaciones de x1 y x2 para
% que f1 = 0 y f2 = 0
[c1, h1] = contour(x1, x... |
function [Yout1, Yout2] = subspaceMethod2(X)
%%
%% subspaceMethod: Noise reduction based on subspace method
%%
%% coded by K. Yamaoka (yamaoka@mmlab.cs.tsukuba.ac.jp) on 7 June 2017
%%
%% [syntax]
%% Y = subspaceMethod2(X, NOISE, num)
%%
%% [inputs]
%% X: Obserbed signal
%% size -> (# of channel, # o... |
% samplebootstrap
function [xbs,ybs]=samplebootstrap(x,y)
n=length(x);
index=randi(n,n,1);
xbs=x(index);
ybs=y(index);
|
function [] = PLOTSOLS(Nds,Tri_Els,Quad_Els,Sols, Titles, varargin)
%PLOTSOLS Plots provided functions in provided cell format
% USAGE:
% [] = PLOTSOLS(Nds,Tri_Els,Quad_Els,Sols);
% INPUTS:
% Nds : (Nnx2)
% Tri_Els : (Ntx2)
% Quad_Els : (Nqx2)
% Sols : {rows x cols}
% OUTPUTS:
%
if nargin < 6
... |
% Globals_GUI
% initializes all global structures for system II experiments
% using GUI
global GUI
GUI = struct(...
'paradigm', 1,...
'recordmode', 0,...
'cursormode', 2,...
'spaceres', 'max',...
'hrtf_locations', [],...
'locations1', [],...
'locations2', [],...
'mode', [],...
... |
%% TestBlockDCT.m
%
% Checking the implementation of the BlockDCT class. It mimics the block
% discrete cosine transform matrices thanks to overloaded functions.
%
% Copyright, Matthieu Guerquin-Kern, 2012
disp('Performing the test for the BlockDCT class...');
close all;
mxsize = 256*[1 1];
DefineBrain;
x = RasterizeP... |
function e
% Exist.
exit; |
e# true parameters
load sv.out;
data = sv;
theta1 = data(:,3:11);
theta1(:,2) = 2*slog(theta1(:,2));
theta1(:,5) = 2*slog(theta1(:,5));
theta1(:,8) = 2*slog(theta1(:,8));
printf("Rows: %d\n", rows(data));
dstats(theta1);
theta1 = theta1(:,4:9) - repmat(theta1(:,1:3),1,2);
bias = mean(theta1);
rmse = sqrt(mean(theta1 ... |
function [ azero, a, b ] = r8vec_sftf ( n, r )
%*****************************************************************************80
%
%% R8VEC_SFTF computes a "slow" forward Fourier transform of real data.
%
% Discussion:
%
% SFTF and SFTB are inverses of each other. If we begin with data
% R and apply SFTB to it,... |
function [Frob_dist]=frobenious(view,CBT,nv)
Frob_dist=0;
for k=1:nv
Frob_dist=Frob_dist+FrobMetric(view{k},CBT);
end
Frob_dist=Frob_dist/nv; |
function [hfig] = plotSimple(nav, rfr, period, benchmark)
% 本函数用于画出净值柱状图和收益曲线,并且计算部分指标在图上显示
% function [hfig] = plotSimple(nav, rfr, benchmark)
% nav: 股票净值
% rfr: 无风险利率,默认5%
% period:数据周期,可取如下值: d365, d360, d245, w, m, q, y, 默认为d365
% benchmark: 选取基准净值,默认无
% hfig: 返回图的句柄
% 全部计算都使用默认值,可能有不准
%---------------... |
function [Fit_and_p,FVr_bestmemit, fitMaxVector, Best_otherInfo
] = ...
doubledeepso(deParameters,Select_testbed,caseStudyData,otherParameters,low_habitat_limit,up_habitat_limit)
%Guarantee same initial population
rand('state',otherParameters.iRuns)
I_D= numel(up_habitat_limit); %Number of variables or dimension
... |
function [f_out, d_out] = filterSiftFeaturesByROI(im, f, d, ROICropPct)
%Filters SIFT features (f and d) to only those in the center (1-2*ROICropPct) of the image.
[rows, cols, planes] = size(im);
xmin=fix(cols*ROICropPct);
ymin=fix(rows*ROICropPct);
xmax=fix(cols*(1-ROICropPct));
ymax=fix(rows*(1-ROICropPct));
Ind=fi... |
%% Geometrical parameters
param.NF=9;param.NJ=9;
param.CALtoTT=0.265; % originally CALtoTT (L0)
% Mass Parameters
param.M1=2*(1.2/100)*param.body_weight; % L1: [Dumas2007: CAL to TTII, ie ankle to toe]
param.M2=2*(4.8/100)*param.body_weight; % L3: [Dumas2007: KJC to AJC, knee to ankle ]
param.M3=2*(12.3/100)*param.b... |
function dumproc(id,roc,outfile)
% WBL 25 Sept 2002
% $Revision: 1.1 $ $Date: 2002/09/25 14:51:14 $
for i=1:size(roc,1)
fprintf(outfile,'%3d %f %f\n',id,roc(i,1),roc(i,2));
end
fprintf(outfile,'\n'); |
% [x, y] = textread('D:\Zack\Desktop\visual\NACA0010.txt', '%f %f')
%% define variables
a = 0.051; % amplitude
n = 1.1;
Sp = 1; % Sp is phase velocitya
b = 1.0;
T = 1/(b*Sp);
t = [1/8*T, 2/8*T, 3/8*T, 4/8*T];
ax_low = 0; % x轴左极限
ax_up = 1; % x轴右极限
ay_low = -0.2; % y轴左极限
ay_up = 0.2; % y轴右极限
for t_instant = t
... |
clc;
A = zeros(154,1600);
Files=dir('C:\Users\ROMIT\Desktop\Drexel Study\Quarter 2\CS 613 Machine Learning\Week 1\Assignment 1\yalefaces\subject*');
for k=1:length(Files)
FileNames=Files(k).name;
F = imread(strcat('C:\Users\ROMIT\Desktop\Drexel Study\Quarter 2\CS 613 Machine Learning\Week 1\Assignment 1\ya... |
function [rtrial,tension_efectiva2,theta] = rtrial_damage(MDtype,ce,eps_n1,E,nu,n)
%*************************************************************************
%* Defining damage criterion surface *
%* *
%* M... |
function [f] = fact(n)
%//
%// ARGS
%// f out factorial value: f=n!
%// n in argument
%//
%// DESC
%// This method determines the factorial of n.
%//
%// PRECONDITIONS
%// o This is a recursive algorithm, so heap space for
%// large n might be a problem.
%//
%// POSTCONDITION... |
function Phi = gsm( m,r )
Phi=gsm_mex(m,r,0);
end
|
% This file runs a complete test for the implementation of the NSA.
% The selected inputs in this file are Beta1_m1 & Beta1_m2 measurements.
% For other output measurements, please check the end of the current file.
% A complete detail of each function used in this file is included in a
% % README file in the current ... |
clear all
thr = 0.4;
MINSCANS = 130;
%INPUT_FILE='/home/ALDRECENTRUM/benjamin.garzon/Data/DAD/processed/RS/RealignParameter/FD_Power.csv';
%OUTPUT_FILE='/home/ALDRECENTRUM/benjamin.garzon/Data/DAD/processed/RS/RealignParameter/FD_Power_scrubbed.csv';
thr = 0.4;
MINSCANS = 300;
INPUT_FILE='/home/ALDRECENTRUM/benjamin.g... |
function F1 = ANOVA(CP,C0,C1,NR)
% map the collocation point to model parameter through 1st order Anova
% approximation
% CP: collocation point
% C0: 0th order coefficient
% C1: 1st order coefficient
F1 = C0;
for i=1:NR
t = HermiteP(CP(i));
F1 = F1+C1(:,:,i)*t(2:3);
end |
% generate values for a 2D normal distribution
function z = normal2d(x,y,mu,C)
m = length(x);
n = length(y);
z = zeros(n,m);
c = 1/(2*pi*sqrt(det(C)));
S = inv(C);
for i=1:n
for j=1:m
xvec = [x(j);y(i)];
z(i,j) = c * exp(-0.5 * (xvec-mu)' * S * (xvec-mu));
end
end
|
function obj = Brep_cylinder( N, z1,z2 )
% obj = Brep_cylinder( N, z1,z2 )
% make a B-rep model of an (open) cylinder with N points around
% one rim.
% If z1 and z2 are given, then one rim is at z1 the other at z2.
% otherwise z1 = 0, z2 = 1 is set by default.
if nargin == 1
z1 = 0;
z2 = 1;
end
obj.... |
%Merge student scores.
%ans = mergesub(s,byPR)
%merge by PR equation if byPR = 1, by ranking if byPR = 2; default as byPR = 0.
function ans = mergesub(s,byPR)
if nargin < 2
byPR = 0;
end
v = s.v;
name = s.name;
[m,n] = size(v);
tai = 1;
tai2 = 1;
ta = {};
tb = {};
disjoi... |
function plotBeacon(loc, id)
%PLOTBEACON plot a beacon (and optionally its id)
% loc is the beacon's location [x, y]
% id (optional) is the beacon's id as either an integer or bitstring
%
% >> plotBeacon([1, 1], 57);
% plots a beacon at point (1, 1) as well as the id 57 and it's
% bitstring... |
function varargout = sml1_pcm2(what, varargin);
% SuperMoterLearning PCM modelling
% on real data.
baseDir = '/Volumes/G_Thunderbolt/Yokoi_Research/data/SequenceLearning/sh_eva'; %
addpath('/Users/atsushiyokoi/Dropbox/Matlab/matlab/imaging/mva/pcm_develop/');
figDir = fullfile(baseDir, 'cluster_sess4','figure... |
%max_cut_sdp.m
%petersen graph
n=10; %number of nodes
A=zeros(n,n); %adjacency matrix
edges=[[1,2];[2,3];[3,4];[4,5];[5,1];...
[1,6];[2,7];[3,8];[4,9];[5,10];...
[6,8];[6,9];[7,9];[7,10];[8,10]];
A(sub2ind(size(A),edges(:,1),edges(:,2)))=1;
A=A+A';
%% yalmip
% yalmip('clear');
% X=sdpvar(n);
% constrai... |
% Solve the follownig problem:
A=[10 -7 0; -3 2 6; 5 -1 5];
b=[7;6;4];
det(A)
rank(A)
rank([A b])
% Solution 1: Use left devision.
A\b
% Solution 2: Use matrix inverse.
inv(A)*b
% Solution 3: Use Gaussian elimination (Row reduction) to transform the equation into row-echolon form.
|
% Noise uncertainties in cable space with white gaussian noise
%
% Author : Chen SONG
% Created : 2017
% Description :
% Noise uncertainties to be applied on cable lengths and velocities with white gaussian noise.
classdef NoiseUncertaintyBaseCableWhiteGaussian < NoiseUncertaintyBase
properties
... |
function sTe (f, fi)
% This function advances Te and applies its boundary conditions
global Te Te_aux calc src_Te result init_uniform ve
result = f*Te_aux(2:end-1, 2:end-1, 2:end-1) + fi*Te(2:end-1, 2:end-1, 2:end-1) ...
+ calc .* (-0.6667*Te(2:end-1, 2:end-1, 2:end-1).*ddz(ve) - convect(Te) ...
+ conduct(Te) + reco... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 13.5: Movimiento
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 13.5.2 Imagen de diferencias
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function [R,R_label] = pre(X,Y,X_label,Y_label)
[L_number,~] = size(unique(X_label));
%[m,n_1] = size(X);
%[~,n_2] = size(Y);
%n = n_1 + n_2;
%R = zeros(m,n);
R = [];
R_label = [];
for i = 1:L_number-1
j = 1;
while(X_label(j) == i)
j = j + 1;
end
R = [R;X(1:j-1, :)];
R_label = [R_label;X_label(... |
function [X,Y] = mrotate(X,Y,Theta)
%MROTATE Summary of this function goes here
% Detailed explanation goes here
XTemp = X;
YTemp = Y;
X = XTemp.*cos(Theta)-YTemp.*sin(Theta);
Y = XTemp.*sin(Theta)+YTemp.*cos(Theta);
end
|
%% load normal data sets
% util: raw data to descriptor
% how to process raw data?
% first: normalization
% second: normalized data to binary data
%
%% negerate detectors sets
% util: match
% random data
% needed match method
% did not match with normal data sets
% define a max detector size
%% load with event dat... |
function pathPlotter(x, y, psi, tsamp, dec, tstart, tstop, track, WP)
%PATHPLOTTER draws the path of the ship MS Fartoystyring used in TTK4190
%Guidance and Control Assignment 3, Tasks 2.3 to 2.7, inclusive.
%
%PATHPLOTTER outputs a single xy-plot of the MS Fartoystyring's trajectory
%and, depending upon the input, ... |
function R = rectification(H,Iloc)
% computes the rectification of an image.
% @ H: 3x3 Homography H (e.g. compute it with getH(A,B))
% @ Iloc: location of the transformed image (URL also possible)
% Output: The rectified image R
% edited by Christoph Niemz
im1 = imread(Iloc);
im1size = size(im1);
im_rows = im1size... |
%% Aerodynamic solver setting
kink_perc= 0.25; % Calculated from the drawing
% Wing planform geometry
% x y z chord(m) twist angle (deg)
AC.Wing.Geom = [0 0 0 3.5 0;
1.5071081002055884 ... |
clear all;
clc;
% load 'PDmats/rvelMagnVec.mat';
load 'OHmats/rvelMagnVec.mat';
people=length(rvelMagnVec);
p=zeros(people,1);
for i=1:people
i
rR=rvelMagnVec{i,1};
rL=rvelMagnVec{i,2};
eR=rvelMagnVec{i,3};
eL=rvelMagnVec{i,4};
sumR=rR+eR;
sumL=rL+eL;
% mw(rR, rL, 'rest');
% mw(rR... |
function test
MatlabSpec.run_tests('FftTools', 1e-6)
end
|
function out1 = bb7_rnd(kappa,gamma,T,state)
% function out1 = bb7_rnd(kappa,gamma,T,state)
% This program generates observations from
% a BB7 copula
%
% INPUTS: kappa, a scalar or a Tx1 vector, the first BB7 copula parameter
% gamma, a scalar or a Tx1 vector, the second BB7 copula parameter
% T, a sca... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.