text stringlengths 8 6.12M |
|---|
%% File Location
dataDir ='C:\Users\Abhinav Raj\AppData\Local\Temp\an4\wav\flacData'
ads=audioDatastore(dataDir,'IncludeSubfolders',true,'FileExtensions','.flac','LabelSource','foldernames')
%% Splitting the data into train & test
[trainDatastore,testDatastore]=splitEachLabel(ads,0.80)
%% counting each label
trai... |
function writeCSV_segment(targetFile, segmentInfo)
% make data file for segmentation
% This function expects the targetFile, and 'segmentInfo', which is a
% struct that has 4 fields, each holding an array:
% SegmentCount - An indices for the segment: ie [1 2 3 4 5]
% Use - 0 for 'don't use... |
% This file is a demo of UMUTracker Project.The UMUTracker is currently under active development.
% Related information can be found in the paper :
%
% Hanqing Zhang, Tim Stangner, Krister Wiklund, Alvaro Rodriguez, Magnus Andersson
% UmUTracker: A versatile MATLAB program for automated particle tracking of 2D light ... |
function [best_X, best_corr, best_i, best_j] = select_best_missing(data, true_data, known_idx, rowidx, colidx)
% [best_X, best_corr, best_i, best_j] = select_best_missing(data, true_data, known_idx, rowidx, colidx)
% Selects the best reconstruction among a 2D array of reconstructions based on the correlation coeffici... |
function plotResults(Output,StateData)
global GLB_INVP;
set(0, 'defaultaxesfontsize',16,'defaultaxesfontweight','normal',...
'defaultaxeslinewidth',1.0,...
'defaultlinelinewidth',1.0,'defaultpatchlinewidth',1.0,...
'defaulttextfontsize',16,'defaulttextfontweight','normal');
%%%% Control Goal
show(GLB_IN... |
function abc()
global numstate
numstate = 1;
triggerModel();
ObjectiveFunction = @learnClustering;
X0 = [rand(1,4)];
lb = [zeros(1,4)];
ub = [ones(1,4)];
options = optimoptions(@simulannealbnd, ...
'PlotFcn',{@saplotbestf,@saplottemperature,@saplotf,@saplots... |
% Matt McDade
% ANM 2
% HW 1
function hw_1
f = @(x) x^4 * exp(-0.1*x);
x = 3.2;
for h = 1./10.^[1:8]
approx = fd1(f, x, h)
end
function a = fd1(f, x, h)
a = (f(x+h)-f(x))/h;
end
end |
clear all
tic
deltaL0=365e3; % the path length delay increment
MZ=0:31; % number of MZ interferometers
step=0.0001;
lambda=1549.3250:step:1550.0425;
stdnoise=0.00; % the std of noise in gaussian distribution
loss=0;
faberr=rand(1,length(MZ)... |
J = 0.02;
b = 0.1;
K = 0.005;
R = 1;
L = 1;
s = tf('s');
P_motor = K /((J * s + b)*(L * s + R)+ K ^ 2) %传递函数
X=solve('0.02*X^2+0.12*X+0.1') %求解开环极点
motor_ss = ss(P_motor); |
% test 01/28/2015 min phase:
% preliminary processing -
% interpolate dataset
granularity = 1; % granularity (degrees)
numIRs = 24;
angleOffset = 360 / numIRs;
irPathHead = "/home/joe/Documents/space~/svn_drop/impulses/ircam.16/L_IRC_1002_C_R0195_T";
irPathTail = "_P000.wav";
outIrs = [];
for thetaIndex = ... |
close all; clear; clc;
% find x,y of chosen facilities
%% Read the facility file
origFile = sprintf('outputs/failities2015-07-02.txt');
facilityFile = dlmread(origFile, ' ', 0, 0);
facilityID = facilityFile(:,1);
%% Read centers of bins
origFile = sprintf('centers_of_bins_cbd-2015-07-02.txt');
tripDataOrig = dlmre... |
% From https://www.mathworks.com/help/stats/f-statistic-and-t-statistic.html
x=[7 7 7 7 7 5 5 5 5 5 3 3 3 3 3];
y=[7.12 6.63 6.78 6.83 6.93 6.45 6.33 6.67 6.62 6.73 6.61 6.35 6.80 6.56 6.45];
t=fitlm(pH,wear);
anova(t, 'summary');
|
classdef CompassWalker < Walker
properties
L = 0;
MLeg = 0;
ILeg = 0;
MPelvis = 0;
IPelvis = 0;
controllers = {};
end
methods
function [this] = CompassWalker(input)
this = this@Walker();
if (nargin == 1 && ~isempty(input))
this.L = input.L
this... |
function [peakIndex,peakLoc] = simpledetect(time,data,threshold)
%===============================================================================
%===============================================================================
dt = time(2)-time(1); %Sample interval
tMinSep = 0.0025; %... |
function varargout = guide(varargin)
% GUIDE MATLAB code for guide.fig
% GUIDE, by itself, creates a new GUIDE or raises the existing
% singleton*.
%
% H = GUIDE returns the handle to a new GUIDE or the handle to
% the existing singleton*.
%
% GUIDE('CALLBACK',hObject,eventData,handles,...) cal... |
function[]=T1_Ex3_Iordache_Tudor(x,nr)
%se seteaza nivelurile din enunt unul cate unul
niv = [ -1 1 ];
%ultimul parametru al functiei loop este necesar pentru calcularea
%numarului figurii
T1_Ex3_Iordache_Tudor(x,nr,niv,1);
niv = [ -3 -1 1 3];
T1_Ex3_Iordache_Tudor(x,nr,niv,2);
niv = [ -5 -3 -1 1 3 5];
T... |
function hist=plotDist(cyc, E)
% plots a distribution of velocity and acceleration for a drive cycle
v=interp1(cyc.t,cyc.v,linspace(min(cyc.t),max(cyc.t),length(cyc.t)*10),'linear');
t=linspace(min(cyc.t),max(cyc.t),length(cyc.t)*10);
newCyc=CycleAudit(t,v,[cyc.name,' --subsampled at higher resolution']);
for i=1:(ce... |
function y_prime = ode_fun(t, y, Tj, theta, q, mu, c_x)
y_prime = zeros(5,1);
R_t = [y(1); y(2)];
V_t = [y(3); y(4)];
M_t = y(5);
R = norm(R_t, 2);
V = norm(V_t, 2);
% ----------- Poids (Weight) (N) ------------------- %
W_t = - mu * (R_t / R^3) * M_t; % poid... |
function torque = flbReadTorque(fileName, trialNumber)
data = flb2mat(fileName,'read_case',trialNumber);
data = data.Data;
torque = data(:,2);
end |
%% ENFERMEDAD CON ELIMINACION DE LA POBLACION
format long
% Defino la funcion f, que corresponde al termino independiente
% de la EDO.
f2=@(t,z,k1,k2,m,x0)(k2*(m-z-x0*exp(-(k1/k2).*z)));
% Inicializo algunos parametros dados.
k1=2*10^(-6);
k2=10^(-4);
m=1*10^5;
z0=0;
y0=1000;
x0=m-y0-z0;
% Represento la solucion u... |
function y_mean = trajectories(parameters, known_parameters, Pi, alpha, u)
% number of discretization points within profile
M = length(Pi) - 1;
%% Specify system model
% parameters
kTRANS = parameters(1);
kPL = parameters(2);
R1P = known_parameters(1);
R1L = parameters(3);
B1 = 1;
% compute B1-modified fl... |
function uk = Control(xk,tk,AMODE,uk)
global WPctr
%%%Extract States
x = xk(1);
z = xk(2);
theta = xk(3);
u = xk(4);
w = xk(5);
q = xk(6);
switch AMODE
case 'MANUAL'
dt = uk(1);
de = uk(2);
case 'AUTO'
kp = -10;
uc = 20;
dt = kp*(u-uc);
zc = -100;
... |
%% (Extra credits)
function results = mahalanobis(filter,ground_truth)
% Output format (7D vector) : 1. Mahalanobis distance
% 2-4. difference between groundtruth and filter estimation in x,y,theta
% 5-7. 3*sigma (square root of variance) value of x,y, the... |
function [sensitivity,positive_predictive_value,F_score] = ...
CompareManual2AutoSegmentation(xsongsegment,manual,automatic,Fs);
%function [sensitivity,positive_predictive_value,F_score] = ...
% CompareManual2AutoSegmentation(xsongsegment,manual,automatic,Fs);
%
%[sensitivity,positive_predictive_value,F] ... |
function newPic = drawRect(pic, startX, startY, endX, endY, layer, newValue)
% DRAWRECT draws a filled rectangle of pixels in one rgb layer
% start values are less than end values
newPic = pic;
newPic = ones(newPic, newPic, 3);
newPic = uint8(newPic);
newPic(startX:endX, startY:endY, layer) = newValue;
imsh... |
function histo = radial_lineoutVer3P(pic,center,Nsectors)
%reads in a monochromatic picture, and its center and calculates its
%velocity distribution sorts pixels into sectors
%Ver3 distinguishes between left and right of image
%in other words, the angle goes from 0 to 2*pi
%angle 0 is defined to correspond to the... |
function ImgUp = ChromaUpSampling( Luma, ChromaA, ChromaB, Sampling, Filter)
%ChromaUpSampling - upsample chroma channel to 4:4:4
%
% Syntax: Img = ChromaUpSampling( Luma, ChromaA, ChromaB, Sampling, Filter)
%
% Inputs:
% -Luma: Luma channel
% -ChromaA: Chroma channel 1
% -ChromaB: Chroma channel 2
%... |
% ffmpeg_mvs_x and ffmpeg_mvs_y are the motion vectors for integer block matcher
function MSE_ffmpeg = ffmpeg_mse_calc(previous_pic, current_pic, ffmpeg_mvs_x, ffmpeg_mvs_y)
global rows;
global cols;
% Set-up dimension of the image
[rows, cols, ~] = size(previous_pic);
factor = 0.25;
... |
clc;
clear all;
close all;
load('ex3data1.mat'); % training data stored in arrays X, y
m = size(X, 1);
% Randomly select 100 data points to display
rand_indices = randperm(m);
sel = X(rand_indices(1:100), :);
theta = [-2; -1; 1; 2];
X = [ones(5,1) reshape(1:15,5,3)/10];
m = size(X, 1);
y = ([1;0;1;0;1... |
[layers1] = shallots({{{{{{{{{{'shallot'}}}}}}}}}});
% layers1 => 10
%
[layers2] = shallots({{{'shallots'}}});
% layers2 => 3
%
[layers3] = shallots({{{{{{'sHaLLoTs'}}}}}});
% layers3 => 6 |
function [ D,var ] = csa_phasediag( d, delta_range,rho_range,algo_handle,param_handle,noise,iter )
%csa_phasediag CoSparse Analysis Phase Diagram
% csa_phasediag(d,handle) where handle(y,M,xinit)
% iterates starting from xinit using some specified algorithm
% to approximate some value x such that y = Mx+e
if ... |
function [u, new_noise_sigma, lambda,err] = tikronov_optimal_lambda(f, psf, sigma,lambda)
F = fft2(f);
otf = psf2otf(psf,size(f));
new_noise_sigma = sigma;
[M,N]=size(f);
for k = 0:M-1
for j = 0:N-1
% dev(k+1,j+1) = sin(pi*k/M)^2+sin(pi*j/N)^2;
dev(k+1,j+1) = ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Functia calculeaza limita superioara %
% si infererioara a fiecarei valori %
% proprii. %
% %
% %
% G... |
function param = setup_dyn(param)
% o=ones(1,param.knot_count+1);
o = ones(1, param.NbSample);
switch param.jointChainStart
case 'ankle'
switch param.datasetTag
case 'sim'
Parameters_sim;
otherwise
Parameters_AnkleToHip;
end
... |
function [d, K, T2ML, phi, z, SumEch, log10K, log10T2, log10Porosity, SumEch_3s, SumEch_twm, SumEch_twm_3s] = loadnmrdata2(name)
% this function loads a nmr data file namaed 'name' and defines the
% variables.
if strcmp(name, 'A1') ==0 && strcmp(name, 'C1') == 0 && strcmp(name, 'gems_all') ==0 && ... |
a=0.3;
Tzew=-20:1:40;
TzewN=-20;
TwewN=20;
TpN=10;
qN=1000;
Kcp=(1+a)*a*(TwewN-TpN)*(TwewN-10)/(1000*(10-TzewN));
Kcw=qN / ( (1+a)*TwewN-TzewN-a*TpN);
%Twew1=( q1+(Kcw+Kcp)*Tzew) / Kcw ;
%TWW = (q1+Kcw*Tzew+a*Kcw* (a*q1+(a*Kcw+Kcp*(1+a))*Tzew) / ((a*Kcw)*(1+a)-a*a*Kcw) ) / ((1+a)*Kcw); % postać przed skracaniem (spr... |
clear all; close all; clc;
% load('ss_plants2')
% for k = 1:size(AAA,3)
% delta_T0 = TT0r(:,:,k)-TT0(:,:,k);
% sys_red(:,:,k) = balred(ss(AAA(:,:,k),[BB(:,k) BBv(:,k) delta_T0],[C1;C2],0),40);
% end
% sys_red.u = {'P','V','delta'};
% sys_red.y = {'T1','T2'};
load('plantas')
figure(1); clf; step(sys_red(:,3,... |
function lambda = Sturm(T,k)
% function lambda = Sturm(T,k)
% T is an nxn unreduced symmetric tridiagonal matrix and 1<=k<=n.
% lambda is the kth largest eigenvalue of T.
% GVL4: Section 8.4.2
z = norm(T,1);
y = -z;
n = length(T);
while abs(y-z)> 10*eps*(abs(y)+abs(z))
x = (y+z)/2;
if a(T,x)>n-k
... |
% Add parent folder to path
addpath(fileparts(pwd));
success = 1;
for n=1:10
if sum(sum(p2cg(n)~=switch_basis_mat('full','CG',2,n))) ~= 0
success = 0;
end
if sum(sum(p2co(n)~=switch_basis_mat('full','corr',2,n))) ~= 0
success = 0;
end
if sum(sum(cg2p(n)~=switch_basis_mat('CG','full'... |
function handles = displayLayers(handles)
%DISPLAYLAYERS viser alle billederne i et samlet snit for det nuværende snit
% Det snit der har den værdie slideren står på vises i axen.
% For at vise alle billederne er de samlet i et med montage
%
% INPUT:
% handles til elementer i gui
%
% OUTPUT:
% hand... |
%% FOOOF Matlab Wrapper Example - Single PSD
%
% This example computes an example power spectrum model for a single
% power spectrum, and prints out the results.
%
%% Run Example
% Load data
load('data/ch_dat_one.mat');
% Calculate a power spectrum with Welch's method
[psd, freqs] = pwelch(ch_dat_one, 500, [], [], s... |
% 3D Simulation
% Louis Rosenblum
%% Initialize program
%clear all
close all
%% Load 3D Elevation Map
latlim = [45.25532873 45.30078327];
longlim = [-111.4957325 -111.4048235];
[elevation, refvec] = dted("lone_peak.dt2",1,latlim,longlim);
%% Populate grid with X,Y, and Z coordinates
grid = cell(150,150);
for i... |
function H = SE_fg_extend_fcn(F, opt)
% parameters and constants
opt = parse_params(opt);
% Call MEX
if iscell(F)
H = cell(size(F));
for i=1:numel(F)
H{i} = SE_fg_extend_fcn_mex(F{i}, opt);
end
else
H = SE_fg_extend_fcn_mex(F, opt);
end
|
img = imread('lena512_bin.bmp');
[row,col] = size(img);
one=0;
zero=0;
for i=1:row
for j=1:col
if(img(i,j)==1)
one=one+1;
end
if(img(i,j)==0)
zero=zero+1;
end
end
end
one
zero
|
function myelin_detection(pic,handles)
%semantic segmentation of myelin - Thresholding
%Slider
slmin = round(min(pic(:)));
slmax = round(max(pic(:)));
thr = round(mean(pic(:)));
f = pic;
f(f<=thr)=true;
f(f>thr)=false;
f = logical(f);
f = bwareaopen(f, 500);
fig = figure;
imshow(f)
%set(fig, 'Position', [1000 600 70... |
%% Workspace initialization
% The workspace is cleaned and some parameters are predefined
clear all ; % this removes all variables stored in your current workspace
close all force ; % this closes all previous figures
clc ; % this clears the command window log
% PARAMETERS %%%%%%%%%%%... |
%%
% Definition of variables
k = 5;
nb_chain = 1.5e6;
time = 200;
pi0 = ones(1, k)/k;
realization = chain_2(nb_chain, time, pi0); % change the function for other chain
%% a)
% Plot P values of P over time
count_pij = getPOverTime(realization, k);
plot(2:time, reshape(count_pij(:, :, :), [k*k, time-1]))
%% c)
% After ... |
if vel(j,1) <= 15
Bvj(j,1) = max_brake;
end
if vel(j,1) > 15
Bvj(j,1) = max_brake - (1000*(vel(j,1)-15));
end |
function y=U_thres(y,up,low)
y(y>up) = up;
y(y<low) = low;
|
function g = T(qubit)
% T
% Copyright 2017 Yulin Wu, University of Science and Technology of China
% mail4ywu@gmail.com/mail4ywu@icloud.com
g = sqc.op.physical.gate.Z4p(qubit);
end
|
% move_ct_files.m
% This script takes all of the series in a large CT scan exam and sorts
% them by series (scan number).
clear all
close all
% Path to folder with CT Data
cd('E:\Experiment Data...')% Series number to put in folders
% Scan numbers
series = [1:3];
% Number of images per series
images_per... |
function [ newTestY ] = hmmsmoothing( Ytrain, YtrainLb, Ytest )
%HMMSMOOTHING Puts the output of our SVM through a HMM
%
[~, EMIS_EST] = hmmestimate(YtrainLb, Ytrain);
TRANS_GUESS = eye(6)*.88 + ones(6,6)*.02;
Ytest0 = Ytest(1:(end-4));
Ytest1 = Ytest(2:(end-3));
Ytest2 = Ytest(3:(end-2));
Ytest3 = Ytest(4:(end-1));... |
%% Init Kinematics
%% number of links
n = 6;
%% Physical Dimension ROV %%
% For deriving the mass and inertia for the ROV, the following dimensions
% is used:
x_rov = 2.3;
y_rov = 2;
z_rov = 1;
%% The denavit-hartenberg defines each frame as a homognous transformation
% definded by:
% Ai = Rot_z(theta)Trans_z(d... |
load('building.mat');
sys = ss(A,B,C,D);
h_sv = hsvd(sys);
h_sv_norm = h_sv./sum(h_sv);
r = find(cumsum(h_sv_norm)>0.95,1,'first');
% r = 10;
sys_r = hankelmr(sys,r+1);
[Ar2, Br2, Cr2, Dr2,] = hankelnorm_mr(A,B,C,D,r);
sys_r2 = ss(Ar2,Br2,Cr2,Dr2);
[Ar, Br, Cr, ~] = ssdata(sys_r);
Dr = D - C*inv(A)*B + Cr*inv(Ar)*Br;
s... |
function finalrect = selectrectangle(varargin)
opt.color = 'r';
if ((nargin >= 1) && (numel(varargin{1}) == 1) && ishandle(varargin{1}) && ...
strcmp(get(varargin{1},'Type'), 'axes'))
hax = varargin{1};
p = 2;
else
hax = gca;
p = 1;
end;
initialrect = [];
if ((nargin >= p) && isnumeric(vararg... |
addpath('./Tools');
addpath('./Filters');
create_some_random_channels;
%% Configuration of the Unified modulator (parameters):
configuration_input_test;
num_tests = 1000; resultsOOB = zeros(num_tests,1); resultsUse = zeros(num_tests,1);
for ii =1 : num_tests
%% Create OFDM test signal:
[DataFrame... |
camera = 'red';
v = VideoReader([camera,'.avi']);
squareSize = 3.8; % mm
boardSize = [7,10];
[worldPoints] = generateCheckerboardPoints(boardSize,squareSize);
n_frame = round(v.Duration*v.FrameRate/7)-2;
threshold = 100;
imagePoints_all = [];
laserPoints_all = [];
frame = [];
% obj = VideoWriter('blaser_calib... |
function [dx,Nn,Ne,x,icon,numOC,ntop,nbot,nright,nleft,freeDOFs]=initgrid(nx,xmin,xmax)
dx=[xmax-xmin]./(nx-1);
x1=linspace(xmin(1),xmax(1),nx(1));
y1=linspace(xmin(2),xmax(2),nx(2));
Nn=0;
for j=1:nx(2);
for i=1:nx(1);
Nn=Nn+1;
x(Nn,:)=[x1(i),y1(j)];
end
end
% element connectivity
n... |
function dG = dSO3(p,x,n)
% n-th derivative d^nG/dx^n of a group element in SO3 formed by parameter
% vector p.
theta = norm(p);
p = p(:)./theta;
arg = theta*x + n*pi/2;
dG = theta.^n* ( cos(arg)*(eye(3) - p*p.') + sin(arg)*skew(p) );
end |
function testCFVC(calibrQ)
if nargin < 1
calibrQ = true;
end
initializeSEASnake();
cmd = CommandStruct();
cmd.position = zeros(1,snakeData.num_modules);
cmd.torque = nan(1,snakeData.num_modules);
snake.set(cmd);
pause;
plt = HebiPlotter('frame', 'VC');
dt = pi/160;
% CF setup and calibration
load('offsets.mat')... |
%both A and B are 4th order tensors
function R = doubledotff(A,B)
R(1:3,1:3,1:3,1:3) = 0;
for i = 1:3
for j = 1:3
for m = 1:3
for n = 1:3
% R(i,j,m,n)=0;
for k = 1:3
for l = 1:3
R(i,j,m,n) = R(i,j,m,n) + A(i,j,k,l)*B(... |
function observation = getObservation(bias,sd,N)
observation = zeros(10,10,10);
for s = 1:10
for s_prime = 1:10
for a = 1:10
observation(s,d,a)= N*getP(s+a-1+bias,d,sd);
end
end
end
|
%-------------------------------------------------------------------------------------------------------------------%
%
% IB2d is an Immersed Boundary Code (IB) for solving fully coupled non-linear
% fluid-structure eraction models. This version of the code is based off of
% Peskin's Immersed Boundary Method Paper in... |
function t = wpdec2(x,depth,wname,type_ent,parameter)
%WPDEC2 Wavelet packet decomposition 2-D.
% T = WPDEC2(X,N,'wname',E,P) returns a wptree object T
% corresponding to a wavelet packet decomposition
% of the matrix X, at level N, with a
% particular wavelet ('wname', see WFILTERS).
% E is a string containi... |
function [ q ] = agent_simulation(quan_st, quan_t, dur, prep_t )
% Функция предстваляет собой агентную модель СМО
% Она симулирует проведение экзамена
% на вход берется 3 параметра
% колво студентов
% колво преподавателей
% длительность экзамена
% время на подготовку
% длительность экзамена миниму 3 часа
%... |
function jsonout = jsonBodyFormatRH(username,password,clientID)
%formats RH body string to json
params = {'username'};
params = [params,{username}];
params = [params,{'password'}];
params = [params,{password}];
params = [params,{'grant_type'},{'password'},{'scope'},{'internal'},...
{'expires_in'},{'3600... |
function [a, mutation_counter] = mutar(a)
global pm;
mutation_counter = 0;
i = 1;
l = length(a);
while(i < l)
r = rand();
if(r < pm)
%a(i) = rand * ( abs(max(a)) + abs(min(a)) ) - abs(min(a));
a(i) = rand() - 0.5;
mutation_counter = mutation_counter + 1;
end
i = i + 1;
end
end
|
% MATLAB program for exercise 3 in course 02457
% This program is for part 1 out of 3
%
% "main3a" illustrates the use of a linear model and discriminant
% in a single layer network.
%
% The parameters that should be changed are
% w_t : the true weight-vector used to generate training-set
% noiselevel : th... |
function [ f3 ] = F3( P, T, R, b , v )
tc = 647;
pc = 221;
UD = -450000;
ac = (0.42748 .* R .* R .* tc ) ./ pc;
f = @(t) (b .* UD - 2 .* b .* R .* t) ./ (t .* t .* log((v+b)./v));
term1 = gquad(f, 0,tc, 4);
term2 = gquad(f, tc, T, 4);
f3 = P - ( (R .* T) ./ (v-b) ) + ( 1 ./ (v.*(v+b)) ) .* ...
(ac - term1 +... |
function D = fastEuclideanDist(A, B, batchSize)
%{
A = rand(4754,1024);
B = rand(6800,1024);
tic
D = pdist2(A,B,'euclidean');
toc
tic
DD = sqrt( bsxfun(@plus,sum(A.^2,2),sum(B.^2,2)') - 2*(A*B') );
toc
%}
if nargin < 3
batchSize = -1;
end
if batchSize > 0
nBatches = ceil(size(A, 1) / batchSize);
D ... |
function score = computeEllipseOverlap(f1, f2)
% ELLOVERLAP
%
%
import affineDetectors.*;
S1 = reshape(f1([3 4 4 5]), 2, 2) ;
S2 = reshape(f2([3 4 4 5]), 2, 2) ;
A1 = inv(S1) ;
A2 = inv(S2) ;
T1 = f1(1:2) ;
T2 = f2(1:2) ;
% translate to the origin (more stable)
t = mean([T1 T2],2) ;
T1 = T1 - t ;
T2 = T2 - t ;
% ge... |
function graph_it(leg, lim, xlab, ylab, values, errors)
% This function graphs data with specified error bars
% This function can handle up to 4 separate factors with unlimited
% levels of those factors.
%
% How to form inputs:
%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % ... |
mnist_path = 'mlcv/assignment_3/mnist/';
%% Exercise 1.2: Loading MNIST
%% The data is loaded utilizing the MNIST helper functions from:
%% http://ufldl.stanford.edu/wiki/index.php/Using_the_MNIST_Dataset
images_training = loadMNISTImages(strcat(mnist_path, 'train-images.idx3-ubyte'));
images_training = images_traini... |
function [ X ] = unique_j( X )
%UNTITLED9 Summary of this function goes here
% Detailed explanation goes here
x = X(:,1);
y = X(:,2);
ct = 1;
ctA = [];
for i = 1:length(x)-1
xi = x(i);
yi = y(i);
for j = i+1:length(x)
xj = x(j);
yj = y(j);
if (abs(xj - xi))<1e-2 &... |
classdef NeuronListIterator < Iterator
%NEURONLISTITERATOR
%
% Description:
% Traverse a NeuronList
%
% Constructor:
% obj = NEURONLISTITERATOR(obj)
%
% Properties:
% loc Location of the traversal
% Inherited properties:
% collection Neuro... |
function [ status, message ] = data_show3Dvolume2( obj, selected_data, askforparam, defaultparam )
%data_show3Dvolume plot slice through 3D data to illustrate
%(function incomplete)
%--------------------------------------------------------------------------
% function check for existing auxillary input channel from f... |
%TODO:Use TIMER
% - change all the variables and objects to properties - done
% - create timer in constructor - done
% - laser stops moving - DONE
% Avoid using while whenever it is possible
% Change visibility of text instead of deleting --- ??
% Move constants to properties ... |
data_path = '/Users/burakonal/Desktop/edu/58j/hw3/PIRC2017_03';
% train data and test data feature extraction
train_data_features_8 = feature_extraction(data_path, [8 8]);
disp('train 8 completed')
test_data_features_8 = test_feature_extraction(data_path, [8 8]);
disp('test 8 completed')
save('/Users/burakonal/Desktop... |
function outputStr = encrypt(inputStr, multKey, addKey)
%ENCRYPT Encrypt a message using an affine cipher
% outputStr = encrypt(inputStr, multKey, addKey)
% inputStr message before encryption
% multKey multiplicative cipher key (int, should be relatively prime to 26)
% 1, 3, 5, 7, 9, 11, 15, 17, 19, 21,... |
function [Lxy_matrix, dx, dy] = Lxy_2D(xspan,yspan, np,val)
%Creates a 2D d^2/dx^2 + d^2/dy^2 laplacian operator matrix
% This function creates a 2D d^2/dx^2 + d^2/dy^2 laplacian operator with or without
% periodic boundary conditions over a number of grid points np
% of a span xspan and yspan
%If val = 0: non-p... |
function [D_06, residual_histogram]=read_ASAS_ATL06(thefile, pairs)
if ~exist('pairs','var')
pairs=[1 2 3];
end
beams={'gt1l','gt1r','gt2l','gt2r','gt3l','gt3r'};
% altimetry:
fields.None={'segment_id','h_li','h_li_sigma', 'delta_time','atl06_quality_summary' ,'latitude','longitude'};
fields.ground_track={'x_atc'... |
function obj = modelVerifyDataIntegrity(obj)
% Various tests to verify data integrity and check for files.
% Biafra Ahanonu
% branched from controllerAnalysis: 2014.08.01 [16:09:16]
% inputs
%
% outputs
%
% changelog
% 2021.08.10 [09:57:36] - Updated to handle CIAtah v4.0 switch to all functions inside cia... |
function MM = PWD2D(Lam,AOI,azi,e1,e3,a,bool_reflect,d)
eul = [azi 0 0].*pi/180;
AOI = AOI*pi/180;
epsilon = zeros(3,length(Lam));
alpha = zeros(3,3,length(Lam));
lam2 = (Lam/1000).^2;
epsilon(1,:) = e1;
epsilon(2,:) = epsilon(1,:);
epsilon(3,:) = e3;
lam2 = Lam.^2;
alpha(1,2,:) = a;
alpha(2,1,:) = alpha(1,2,:);
alph... |
function descriptors = get_pyramid_descriptor_for_level(image, level, step)
max_sift_step = 8;
max_sift_size = 8;
sift_step = max_sift_step * 2 * 1/pow2(level+1); % 8, 4, 2;
sift_size = max_sift_size * 2 * 1/pow2(level+1); % 8, 4, 2;
for i = 0:level
for j = 0:level
i_start = s... |
function [sibhfs,manifold,oriented] = determine_sibling_halffaces_tet_usestruct( nv, elems, usestruct)
[sibhfs,manifold,oriented] = determine_sibling_halffaces( nv, elems, usestruct); |
function annotate_cell_mask_files(field_dir,varargin)
tic;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Setup variables and parse command line
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
i_p = inputParser;
i_p.addRequired('field_dir',@(x)exist(x... |
function [ r ] = Theta_L( x, y )
r = min(1, 1-x+y);
end
|
function [dataL,dataR,U,V,R] = CreateSyntheticdataMTML4()
% Generate synthetic data
% Output: data = year, lakeid, predictor, response
randn('state',2016);
rand('state',2016);
NumR = 20;
numset = round(abs(randn(1,NumR)*50)); % random generate # of lakes per region
X = [];y = [];
d = 10;
k = 8;
m = 4;
U = ra... |
% eeg_recode() - recode EEG.urevent and EEG.event labels based on sequential template-matching
%
% Usage:
% >> OUTEEG = eeg_recode(INEEG, recode, overwrite)
%
% Inputs:
% INEEG - input EEG data structure
% recode - structured variable with fields [.label, .template, .position]. Each pass only
% ... |
function [x_w,w]=Hermite(N_app)
syms x
% Hn is the physicists version of the Hermite polynomial
Hn=(-1)^N_app*exp(x^2)*diff(exp(-x^2),N_app,x);
cc=sym2poly(Hn);
% x_w are the roots of the Hermite polynomial
x_w=roots(cc);
% w are the associated weights for the corresponding x_w
w=zeros(N_app,1);
Hn_1=(-1)... |
% M210x.m
% help file for M210x.dll
%
% returns -1 on error
% accepts 6 commands
% (defined in globals_mii.m as strutures C_ and M_)
%
% C_.INIT
%
% C_.MODE sets operating mode
% 2nd arg one of: M_MEMORY (followed by M_.HOST or M_.EXTERNAL)
% M_.BUFFER (followed by M_.CIRCULAR or M_.STOP)
% or M_.ADDRE... |
function X = Integrate(f, X0, t)
x = X0;
X = X0;
dt = t(2) - t(1);
for i=t(2:end)
x = IntStep(f,x,dt);
X = [X,x];
end
end |
function [xx,yy]=mybezier(x,y,numpoints)
n=length(x);
if (length(y) ~= n)
error('Dimensions of x and y do not match.');
end;
xx=zeros(numpoints,1);
yy=xx;
h=1/(numpoints-1);
for i=1:numpoints
ctrlpnt=[x,y];
t=(i-1)*h;
for k=1:n-1
for j=1:n-k
ctrlpnt(j,:)=ctrlpnt(j,:)+t*(ctrlpnt(j+1,:)-ctrlpnt... |
function [Gr,A]=gradient_angle(Img,Angle)
filter_para=[0,0];
filter_hsize=filter_para(1);%filer_hsize=0
filter_delta=filter_para(2);%filer_delta=0
%% Gamma/Colour Normalization
if size(Img,3) == 3
% size():获取矩阵的行数和列数
%(1)s=size(A),
%当只有一个输出参数时,返回一个行向量,该行向量的第一个元素时矩阵的行数,第二个元素是矩阵的列数。
%(2)[r,c]=size(A),
... |
%% Stelling 6
%
% Bij een bestaande vector v=[ 7 1 2 9] krijg je bij
% de aanroep:
%
% v(2:end)
%
% de waardes 1 2 9 als resultaat terug.... |
x=0.1:0.01:2;
y=1./x;
plot(x,y,'-k','linewidth',2)
%xlabel('x','FontSize',18,'Color','k')
%ylabel('y','FontSize',18,'Color','k')
grid on |
TR = 1.5;
%tlen = length(data);
tlen = 300
rho = 0.8;
VarR = 1;
noise_amp=1;
% BOLD effects
Xbe = zeros(tlen,1);
isi = [1:30 60:90 120:150 180:210 240:tlen];
Xbe(round(isi))=1;
Xbe = conv(Xbe,spm_hrf(TR));
Xbe = Xbe(1:tlen);
Xbe = Xbe/max(Xbe);
Xbe = Xbe;
%%% Build ASL design mtx
% modulation... |
function [ Blur ] = FastDeconvolution( Blur, kernel )
%% Deconvolve three color channels independdently using TV-l1 model and
% Alternating Minimization Method.
%
% INPUT
% Blur (matrix) gradient in vertical of the Burry Gray image
% kernel (matrix) the motion kernel estimated by K... |
function [f, g] = objfun_half(x,A,nei,beta,betal)
sizex = [size(x,1) length(nei) 2];
x = reshape(x,sizex);
g = zeros(sizex);
dxA = x-A;
normX = sqrt(sum(x.*x,3));
for i = 1:length(nei)
nei1 = nei(i,1);
nei2 = nei(i,2);
nei3 = nei(i,3);
x0 = squeeze(x(:,i,1));
... |
function [x, u, Tf] = n1re_ammc(N, m, Tf, p)
% This functions solves the PDE
% u_t = u_{xx} / (1 + u_x^2) - 1/u, x \in (0, L)
% u(0, t) = u(L, t) = 1
% u(x, 0) = 1 + 0.1*sin(2*pi*x/L)
% with 2nd order centred differences in space and null scheme with
% Richardson extrapolation in time.
% This equation models a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.