text stringlengths 8 6.12M |
|---|
function ret=enlargeCov(cov,incre)
[U,S,V]=svd(cov); % singular value decomposition
% enlarge with increment
S(1,1)=(sqrt(S(1,1))+incre)^2;
S(2,2)=(sqrt(S(2,2))+incre)^2;
ret=U*S*V; |
clear
clc
close all;
%------ 具体数据------------------------------------------------------
PATH= 'C:\CodeStore\matlab\mit-bih-arrhythmia-database-1.0.0'; % path, 这里就是写刚才你保存的数据地址
ecgname='106'; %101 100+1100 %106 100+1300 %112 140+1100
nOPnum=1300;%截取数据个数
stp=100;%截取数据点起点
HEADERFILE=[ecgname,'.hea']; % 文件格式为文本格式
ATRF... |
classdef SparseVerticalDiffusionTest < SWEBarotropic3d
%FLOWOVERATRAPEZOIDTRECH 此处显示有关此类的摘要
% 此处显示详细说明
properties(Constant)
hcrit = 0.01;
ChLength = 10
ChWidth = 10
startTime = 0
finalTime = 1
end
properties
miu = 0.05
Cexa... |
function [ReturnImage] = InsertImageTransparent4(BackgroundImage,X,Y,Image,TransparentColor)
%Fast version of InsertImage with Transparency
ImageSize = size(Image);
BackgroundImageSize = size(BackgroundImage);
sYBackground = Y; sYImage = 1;
eYBackground = Y+ImageSize(1)-1; eYImage = ImageSize... |
classdef al_circle
%AL_CIRCLE This class definition file specifies the properties and methods of a circle object
%
% TODO: Add more comments
% Properties of the circle object
% -------------------------------
properties
windowRect
shieldAngle
... |
function responders(diag, text)
%thus function stores who sent what kind of diag message
global TESTBED
if strcmpi(diag, 'ranging')
spaces= find(text.STRING==' ');
addr = str2num(text.STRING(spaces(end-1)+1:spaces(end)-1));
TESTBED.received(TESTBED.nodeIDs==addr)=1;
elseif strcmpi(diag, 'chirped')
spaces= find... |
% Tests the relative accuracy of a single feature and a single
% statistic on the provided speech_test and music_test files
% --Inputs--
% thresh: threshold that separates speech from music in 1-D classification
% feature: one of three ['ZCR', 'SC', 'SF']
% stat: one of two ['AVG', 'VAR'], defaults to 'AVG'
% --Outpu... |
dataEMG = s.data(s.map_ch('EXG1'),:);
t = dataEMG;
threshold = 0.1*max(dataEMG);
trigOnset = find(t >= threshold);
nSecInterest = 2.5;
trig = trigOnset;
% remove lonely peaks due to muscle arftifact
for iTrig = 1:length(trigOnset)
win = trigOnset(iTrig)-20:trigOnset(iTrig)+20;
su = sum(ismember(win,trigOnset))... |
function DrawGrid(ax)
% Draw grids on the axes
% we use a grid size of 40 * 40, since the window size is 240 * 300, we have 6 rows and 8 columns,
% ax is the axes object of the figure.
for i = 1:6
for j = 1:8
line(ax, [40*j 40*j], [0 240], 'Color', 'white');
line(ax,... |
function [bcoff yhat varargout] = dregressp(Y,X,withinter)
%dregressp
% Use the Stat Toolbox regstats function to do linear regression
% on a data set collected for the HPCA paper
%
% Now do the regression
if withinter == 1
fprintf('Linear regression with interaction terms:\n');
stats = regst... |
function J = computeCost(X, y, theta)
%COMPUTECOST Compute cost for linear regression
% J = COMPUTECOST(X, y, theta) computes the cost of using theta as the
% parameter for linear regression to fit the data points in X and y
% Initialization
m = length(y); % number of training examples
J = 0;
[m, ~] = size(X);
hy... |
close all
clear variables
clc
%% Notes
% No need to use k-means to determine the center mu of each RBF
%% Variables and parameters
cartDefs;
global cart;
% System physic parameters
g = cart.g; % Gravity acceleration [m/s^2]
% State space: X =[x th v w]
numberOfState = 4; % Position and velocity
initialStateSpace = [... |
%% Matlab_Abaqus_25_Bar_Truss
% Find the cross-sections of the members of the 25-bar truss so that its
% weight is minimized and the constraints are satisfied. For more
% information please see the <Documentation.html Documentation of
% Matlab_Abaqus_25_Bar_Truss package>.
%%
% Initialize variables
format long... |
function[x, uu, tt] = FE_ks(N, m, Tf)
% This functions solves the PDE
% u_t = uu_x - u_{xx} - u_{xxxx}, x \in (0, 32*pi)
% u(x, 0) = cos(x/16)*(1 + sin(x/16))
% and periodic boundary conditions with 2nd order centred differences in
% space and FE in time.
%
% Key features:
% + 4th order stiff term
% + Kuram... |
%%%%%%%%%%%%%%%%%%%%%%%%%
% Last Update 6/2/2018
%%%%%%%%%%%%%%%%%%%%%%%%%
function uncert_3D = uncert_Variance(salMap, h)
% centerIndex = (WinSize-1)/2+[1 1 1];
% h(centerIndex) = -1;
temp = stdfilt(salMap,h).^2;
uncert_3D = temp/max(temp(:));
% h = ones(WinSize);
% h = h/numel(h);
% uncert_3D = salMap ... |
%%In this code, the interception distribution is varied in different month.
clear
clc
for o=[13]
Rnum=1; %Number of runs
EnNumber=o;
InNum=1369; %Number of ensembles
days=2158;
for q=1:Rnum
for u=1:EnNumber
copyfile('D:\u of s\InterceptionDA\DAFRsdswe... |
function assert_numeric_scalar_positive(x)
assert(isnumeric(x) && isscalar(x) && (x > 0), 'Value must be positive, scalar, and numeric.');
end
|
function H5_matrix_eq = H5_matrix(L4,L5,theta1)
%H5_MATRIX
% H5_MATRIX_EQ = H5_MATRIX(L4,L5,THETA1)
% This function was generated by the Symbolic Math Toolbox version 7.0.
% 22-Oct-2018 17:07:13
t2 = cos(theta1);
t3 = sin(theta1);
H5_matrix_eq = reshape([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0... |
function [H_VEL] = H_DIFF(H,samples)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
H_VEL(:,:) = zeros(11,3,1);
for i=1:1:samples-1
H_VEL(:,:,i+1)=H(:,:,i)-H(:,:,i+1);
end
end
|
function [ span, t1, t2 ] = longestDrawDown( nav )
% 最长连续回撤天数(不创新高天数)
% [ span, t1, t2 ] = longestDrawDown( nav )
% nav: 净值序列
% span: 最长回撤天数
% t1: 最长回撤起点
% t2: 最长回撤终点
% ----------------------------
% 程刚,20150510
%% main
nP = size(nav,1);
% 新高
isNewHi = ones(nP,1);
h = e... |
% testing script for the STAPLE algorithm
% load the example data
load example-data.mat obs truth
% fusion settings
epsilon = 0.001;
init_flag = 0;
prior_flag = 0;
cf1 = 0;
cf2 = 1;
% construct a "perfect" spatially varying prior
svprior = zeros([size(truth) length(unique(truth))]);
for x = 1:size(truth, 1)
for ... |
%% Basic MLE Maximizer - Heterogeneous Parameters
%{
Author: Keshav Patel
Advisor: Nancy Rodriguez-Bunn
Last modified: Keshav Patel
Date modified: 09/04/2018
This file scans over the parameter space and computes an MLE between the
solution and a given dataset. This file tests the case where parameters... |
clear ; close all; clc
pkg load io;
% Dodavanje puteva di se nalaze funkcije
cd ('C:\Users\Korisnik\Desktop\Faks 3. semestar\Praktikum\9');
addpath ('C:\Users\Korisnik\Desktop\Faks 3. semestar\Praktikum\FunkcijePogreske');
addpath ('C:\Users\Korisnik\Desktop\Faks 3. semestar\Praktikum\Grafovi');
% Ucitavanje ... |
function [h,hbody,maxcirc] = rgnIsoPlot(vxr,pivframes,bts, t,flowvel,...
sheetpos,lenmm, ...
ctrx,ctry, bodyx,bodyy)
% Plots vortices as surfaces through time, coloring by circulation
% Works using the vxr output of identifyVortices
if (nargin == 7),
... |
%% Huffman Encoding
tic
%Clear all variables
clear;
%% Load image
image = imread('images/image1.jpg');
data = double(image);
dim=size(data);
%length of 1-Darray;
m = dim(1)*dim(2)*dim(3);
%reshape image into 1-D array
data = reshape(data,1,m);
%freq->frequency of each symbol(1-256)
%p->probability of each symbol
... |
%% s_correlation_vector creates a 1-dimensional vector of the EEG-fMRI correlation data for use in statistical analyses
% Written by Josh Grooms on 2/16/2012
% Modified on 3/6/2012
% Initialize variables to be used
subject_numbers = [1 2 4 5 7];
subject_scans = {...
[1 2]
[1 2]
[]
[1 2]
[... |
function [w1,w2 , ys, errorApp] = backpropagation(x,yd,w1,w2)
%
% a1 = [x ones(n,1)]*W1; z1 = tanh(a1);
% a2 = [z1 ones(n,1)]*W2; y = a2;
% ERRs = -(yd-ys).*(1-ys.*ys);
% GradW2 = Zj* ERRs ;
%
% ERRj = (w2(1:n2-1,:)*ERRs')'.*(1-Zj.*Zj);
% GradW1 = [x ones(n,1)]'* ERRj ;
%
%--------------------------------------... |
function [A, b] = search_simplex_bounds(xi)
% For n dimensional simplex xi, return the n+1 simplex bounds A and b
% such that Ax >= b.
% Input : xi -> The dimension should be n by (n+1), dim-by-num-point.
% Output: A and b such that Ax >= b is within the simplex.
%
% Author: Muhan Zhao
% Institute ... |
function prox_g = prox_precompose(prox_f, t, b)
% PROX_PRECOMPOSE Proximal precomposition rule.
%
% Let g(x) = f(tx + b). Then
%
% prox_g = prox_precompose(prox_f,t,b).
%
% Here, prox_f only takes v and lambda as arguments.
prox_g = @(v,lambda) ((1/t) * (prox_f(v*t + b, 1/(lambda*t^2)) - b));
end
|
function results = create_sounds(ir_folder,save_dir)
lowfreq = 200; %The low frequency cut-off
highfreq = 20000; %The high freuqncy cut-off
filt_order = 8; %The order of the filter
tdt_50k = 48828; %The sampling rate of the TDT
db_target = 73; %The target dB
aten_factor = 10;
ramp_length_s = 0.2;
sound_path = '/home/... |
function newW = nextEstimate(QuadrotorModel, xNM, xActual, desRPM, tspan)
W = vertcat(xNM(1:10, 1), xNM(11:17, 1));
[t_soln, W_soln] = ode45(@(t,W) MAVDynamics(t, W(:,end), QuadrotorModel, desRPM'), tspan, W(:,end));
x = W_soln(end, :)';
newW = x(1:17, 1);
end |
%Metric values randomly initialized for demo ,enter the values specific to an
%experiment to generate plot for that experiment
sens(1)= 0.81;
spec(1)= 0.83;
prec(1)= 0.71;
gmean(1)= 0.82;
acc(1)= 0.83;
sens(2)= 0.62;
spec(2)= 0.92;
prec(2)= 0.82;
gmean(2)= 0.76;
acc(2)= 0.78;
%Bar plot
y = [sens(1) spec(1) prec(1) ... |
% Jan Heimann | 14th July 2017
r = 1:.5:10.5;
a = 1./(r);
offset = -20;
l = 20*log10(a)+offset;
path_frei = {'./csv_data/freifeld_#1.csv','./csv_data/freifeld_#2.csv','./csv_data/freifeld_#3.csv','./csv_data/freifeld_#4.csv','./csv_data/freifeld_#5.csv','./csv_data/freifeld_#6.csv','./csv_data/freifeld_#7.csv','./c... |
function [TangoPoseResult] = parseTangoPoseTextFile(TangoPoseTextFile)
% common setting to read text files
delimiter = ' ';
headerlinesIn = 1;
nanoSecondToSecond = 1000000000;
% open Tango pose text file
textTangoPoseData = importdata(TangoPoseTextFile, delimiter, headerlinesIn);
TangoPoseTime = textTangoPoseData.da... |
classdef VRClass
methods(Static)
%This function finds the Eucledian distances
function distance = findEuclideanDistance(one, two)
[rowOne, colOne] = size(one);
[rowTwo, colTwo] = size(two);
if (rowOne == rowTwo)
distance = zeros(... |
function re=iter_qd(a,mu,delta,vz,alpha_R,gamma,vc,mumax,l0,n,dim,omega)
% omega=0;
omega_n=hseqd(a,mu,delta,vz,alpha_R,gamma,vc,omega,n,0,mumax,l0,dim);
% k=(omega_n-0)/(0-delta);
% beta=-k;
beta=4;
count=0;
while abs(omega_n-omega)>1e-5 && count<3000
omega=omega_n;
count=count+1;
omega_n=hseqd(a,mu,delta,... |
%==========================================================================
% correlated_noise.m
% Author: Akira Nagamori
% Last update: 8/27/19
% Descriptions:
% Equations obtained from Destexhe et al. (2001)
%==========================================================================
close all
clear all
clc
%%
Fs ... |
%%xytrains.m
%%images2v_fweightxy_ud2.m
scatter(UD2(:,1),UD2(:,2));
hold on; scatter(UD2(4,1),UD2(4,2));
UD3=[ 16,6; %16,5;
16,7; 16,8;
15,7;
16,1]; % 14,7;
%%nD=5;
scatter(UD2(:,1),UD2(:,2));
hold on; scatter(UD2(4,1),UD2(4,2));
hold on; scatter(UD3(:,1),UD3(:,2));
%Outpu... |
x = zeros(1,39);
r =(0.1:0.0005:5);
r_vec = [];
x_vec = [];
for r =(0.1:0.001:2.5)
boi = zeros(1000,1);
x = 0.5;
for k = (1:2000)
x = r*x - x.^3;%x*r*(1-x);
if k > 1000
boi(k-1000) = x;
end
end
r_vec = [r_vec; r*ones(1000,1)];
x_vec = [x_vec;boi];
end
%%
scat... |
function peggroup( group )
global G_PEG;
if nargin == 1;
G_PEG.group = group;
if isfield(G_PEG,'receiver') && isjava(G_PEG.receiver)
G_PEG.receiver.setGroup( G_PEG.group );
end
end
fprintf('group = %d\n',G_PEG.group);
peginit;
|
function tests = randomModelTest
tests = functiontests(localfunctions);
end
function testEmptyInput(testCase)
% test random model on empty input
% construct model with empty options
modelOpts = [];
m = RandomModel(modelOpts, 1);
% train model using empty input should raise warning
trainHandle = @() m.trai... |
%LTI system with response 1/(1+jw)
function f=Lti_c(A,t)
in=partialfouriersum(A,2*pi,t);
N=(length(A)-1)/2;
for x=1:length(A)
w=x-N-1;
A(x)=A(x)/(1+j*w);
end
B=A;
y=partialfouriersum(B,2*pi,t);
subplot(2,1,1);
plot(t,y);
title("Output when 1/(1+jw) applied (c):");
subplot(2,1,2);
plot(t,in);
title("Input:");
end |
function recordEvent(object, eventdata)
global mouseDown trajectories trajNum queries cquery
trajNum = trajNum + 1;
mouseDown = true;
trajectories{trajNum} = [];
queries = [queries;cquery];
end
|
clear all
clc
%train a neural network to understand the connection between the CPU specs
%and the CPU performance
%data input
x=xlsread('machine_CPU_NN','D2:I210');
y=xlsread('Machine_CPU_NN','J2:J210');
%data normalization
[xsc,ps_xsc]=mapminmax(x');
[ysc,ps_ysc]=mapminmax(y');
%network creation
rand('see... |
function [f,ff] = grad_process1( S ,v, h,beta,index)
%UNTITLED5 此处显示有关此函数的摘要
% 此处显示详细说明
%S为输入的原图
%v为网络输出的横向差分,h为网络输出的纵向差分
%beta为平衡参数
f=S;
[N,M,D] = size(S);
I=zeros(N,M);J=I;
for k=1:N
J(k,:)=(0:(M-1));
end
for k=1:M
I(:,k)=(0:(N-1));
end
Dh_FFT=1-exp(-1i*2*pi*J/M);
Dv_FFT=1-exp(-1i*2*pi*I/N);
Denormin2=con... |
%
% find and calibrate the table top in image space
%
% 4/13/09/tcy
%
function calibrate_table_top
clear;clc; close all
image = double(rgb2gray(imread('../../../build/camera_images/table_cal.ppm')))/255;
figure(1);imshow(image,[])
%
% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
%
% set this threshold so that table edge is detec... |
clc
clear all
x = ecg(500);
n = awgn(x,0.5);
plot(n,'b');
title('Additive white Gaussian noise output')
xlabel('Time Index');
ylabel('Amplitude (mV)');
grid on; |
function [ ] = plot_ctmp( S, t )
%Рисует диаграмму переходов между состояниями
n = size(S,2);
x(1) = 0;
for i = 1 : n-1
x(2*i) = t(i);
x(2*i+1) = t(i);
end
x(2*n) = t(n);
for i = 1: n
y(2*i-1) = S(i);
y(2*i) = S(i);
end
plot (x,y)... |
%% Continuous fractional isentropic melting
tic;
Pi=40000; % Initial pressure
Pf=0000; % Final Pressure
potentialtemp=1350; % Potenital temperature
% %%%%%%%%%%%%%%%%%%%%%% pHMelts continuous isentropic %%%%%%%%%%%%%%%%%%%%%%
% tH2O=1; % Use trace H2Oi
% PPMH2O=1500; % Initial trace H2O (in PPM)i
% % Starting composit... |
function s = euclid_simil( mat1, mat2, param )
%s = euclid_simil( mat1, mat2, param )
% Compute the negative Euclidean distance between all the examples of
% mat1 (dim p, n) and mat2 (dim m, m) and returns a matric (p, m)
% Isabelle Guyon -- isabelle@clopinet.com -- May 2012
if nargin<3 || isempty(param), param='eucl... |
function mystring = NUM2STR_ZEROPAD(mynum, numzeros)
myformat = ['%0' num2str(numzeros) '.f'];
mystring = num2str(mynum,myformat);
return
end |
function [ visual ] = makeVisualizationFromNdgPhys( physMat )
if ( physMat.meshUnion(1).type == enumMeshDim.One )
[ visual ] = makeVisualizationFromNdgPhys1d( physMat );
elseif ( physMat.meshUnion(1).type == enumMeshDim.Two )
[ visual ] = makeVisualizationFromNdgPhys2d( physMat );
elseif ( p... |
% topSimPincer.m
%
% Top-level pincer simulation script
%----- Setup
clear;clc;
scenarioVec = {'null','moderate_multipath','severe_multipath', ...
'matched_power_spoofing','overpowered_spoofing',...
'weak_jamming','moderate_jamming','severe_jamming'};
scenario = scenarioVec{1};
s.PA = -15... |
function [respuesta] = diagonalDominante(matriz)
%DIAGONALDOMINANTE Summary of this function goes here
% Detailed explanation goes here
[n,m] = size(matriz);
if n == m
respuesta = true;
for i=1:n
a = i;
acumulador = 0;
for j=1:n
acumulador = acumulador + abs(matriz(i,j));
... |
% EXERCISE 1
% 1.a) Develop a MATLAB script to run simulator1 10 times with a stopping criterion of R = 500 at
% each run and to compute the estimated values and the 90% confidence intervals of both
% performance parameters (see Module3, slide 22, of theoretical classes) when lambda = 20
% requests/hour, C = 100 Mbps a... |
% command line arguments
args = argv();
% open input file
if (length(args))
fp = fopen(args{1}, 'r');
else
fp = fopen('parabola.csv', 'r');
end
% load all coordinates
points = sortrows(fscanf(fp, '%f;%f', [2, Inf])');
n = rows(points);
if (n < 4 )
printf('Few points in input file\n');
else
A = [ones(n, 1), points(:... |
function This = set(This,varargin)
% set Change modifiable nnet object property.
%
% Syntax
% =======
%
% M = set(M,Request,Value)
% M = set(M,Request,Value,Request,Value,...)
%
% Input arguments
% ================
%
% * `M` [ nnet ] - Neural network model object.
%
% * `Request` [ char ] - Name of a modifiabl... |
M = zeros(10000);
for i=1:size(M)
[~,Y] = randeval(data,ctrl,1e5);
M(i)= mean(exp(Y));
i
M(i)
end |
function V=diff2(t,T)
global M C UA Tst T0 W
V1 = (1/(M*C))*(UA*(Tst-T(1))+W*C*(T0-T(1)));
T1=T(1);
V2 = (1/(M*C))*(UA*(Tst-T(2))+W*C*(T1-T(2)));
T2=T(2);
V3 = (1/(M*C))*(UA*(Tst-T(3))+W*C*(T2-T(3)));
V=[V1;V2;V3];
end
|
function [ kl dKL gradK ] = opperKLGaussGPReparam( meanFunc, covFunc, loghyper, ...
x, post)
%OPPERKLGAUSSGPREPARAM KL Gauss GP using opper reparametrization
% Detailed explanation goes here
N = size(x,1);
mup = meanFunc*ones(N,1); % Not really used (for now, mup = 0)
K = feva... |
function conjugate(i,lamda)
load trainingSet.txt;
size=10;
x=trainingSet(1,1:size);
t=trainingSet(2,1:size);
x2=0:0.01:1;
y2=sin(2*pi*x2);
X=fliplr(vander(x));
XI=X(1:size,1:i+1);
v=zeros(i+1,1);
g=XI'*(XI*v-t')+lamda*v;%%ÆðʼµãÌݶÈ
old_g=inf;
alpha=0.001;
e=1e-7;
d=zeros(i+1,1);
while norm(g)>e
bet... |
% Converts an adjacency matrix representation to a Pajek .net read format
% INPUT: an adjacency matrix, [nxn], a filename, [string], node coordinates (optional)
% OUTPUT: text format of Pajek readable .net (or .txt) file in the same directory
% Note 1: If node coordinates are not provided, random numbers between 0 and ... |
function d = intersection(h1, h2)
% INTERSECTION computes the intersection similarity between the two
% histograms
d=(2*sum(min(h1,h2)))/(sum(h1)+sum(h2));
end |
% The projection function of the Positive Cone.
function v = proj_pos(v0)
v = zeros(length(v0), 1);
for i = 1:length(v0)
v(i) = max([0, v0(i)]);
end
end |
function [jumpPos, jumpMag] = findJumps(inData)
arguments
inData {mustBeNumeric,mustBeNonempty,mustBeReal}
end
if ~isa(gcp("nocreate"), "parallel.ThreadPool")
delete(gcp("nocreate"));
pp = parpool("threads");
ppcln = onCleanup(@() delete(pp));
end
buf = 200;
em... |
function junk = constructSigmoidPhenotypeFactorTest(alleleWeights, phenotypeFactor)
for ix1 = 0:2,
for ix2 = 0:2,
for ix3 = 0:2,
for ix4 = 0:2,
z = alleleWeights{1}(1) * ix1 + alleleWeights{1}(2) * ix2 + alleleWeights{2}(1) * ix3 + alleleWeights{2}(2) * ix4;
printf('alleleWeights:[%d %d %d %d]: computeSi... |
function varargout = calc_legendre_moments(amps,probs_JM,t_ip,t_free,consts)
% consts rotational constant 'B' in [1/cm] and centrifugal distortion 'D'
% in [1/cm] with the format: consts = [B D]
fprintf('Calculating moments of Legendre polynomials')
qE=1.60218e-19;
a0=5.29e-11; % [m]
eps0=1/4/pi;
c_au=1/137;
... |
%% this code is responsible for ploting strong NS
% intra-brain NS: threshold is visually detected by intra-brain NS distribution
% inter-brain NS: the top 10 highest INS are chosen
clear all; close all; clc;
addpath('f_PlotEEG_BrainNetwork');
addpath('D:\software\eeglab14_1_2b');
%% power-correlation
% cooperation
... |
function AX=cheek_by_jowl(rows, cols, box, delta);
%AX=cheek_by_jowl(rows, cols, box, delta);
% generates a set of (rows, cols) axes that
% nearly fill a rectangle defined by 'box'.
%
% box is in normalized coordinates in the current
% figure window, in the standard matlab format
% [min_x min_y delta_x delta_y]
%
% t... |
% produce quarter segments. assume the input data is in half segments
% already
segmentInfo_quarter{1} = []; % upward
segmentInfo_quarter{2} = []; % upward
segmentInfo_quarter{3} = []; % resting
segmentInfo_quarter{4} = []; % downward
segmentInfo_quarter{5} = []; % downward
for ind_seg = 1:2:length(segmentInfo.timeS... |
classdef (Abstract) Set < handle
%SET Interface defining a Set
% A collection that contains no more than one of any item
properties
end
methods
% Insert item into the Set
%
% Returns true if items added successfully
bool = add(this, item);
% Clears all items from the Set
%
% Returns array of c... |
cli_header(1,'Running darkfield...');
dirname = 'C:\Users\jaker\Pictures\Oregon_Eclipse\darkfield\png';
fnames = get_files(dirname,'png');
% imgs = cellfun(@(x) imread(fullfile(dirname,x)),fnames,'uni',0);
cli_header('Done.');
num_imgs = length(fnames);
%%
% num_bins = 1e3;
% bin_edges = linspace(0,1e4,num_bins+1);
num... |
% Copyright 2014
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writin... |
% this function really needs to be updated
function vt = vorticityThickness(x,y,v)
global upper_speed lower_speed N splitter_idx delta_U
for i = 1:200
vt(i) = (274.4-68.6)/max(v(10:90,i));
end
end |
function varargout = SIMGUI(varargin)
% SIMGUI MATLAB code for SIMGUI.fig
% SIMGUI, by itself, creates a new SIMGUI or raises the existing
% singleton*.
%
% H = SIMGUI returns the handle to a new SIMGUI or the handle to
% the existing singleton*.
%
% SIMGUI('CALLBACK',hObject,eventData,handles,... |
function [Centrin] = Centrin_fun()
%%%%% measure the number of cilia by measuring the area of centriols in the
%%%%% cells
d=dir('*centrin*movie');
Centrin.movie='Centrin';
Objective=60;
px2mu= 0.134*40/60;
if isempty(d)==0;
mo=moviereader(d(1).name);
fs=mo.read();
fm=mean(fs,3);
figure();imagesc(fm);BW=roipoly();
... |
function E=errorFit(x,y,S,T,TFov,A,B,kGrid,rkGrid,sep,M)
%ERRORFIT Measures the error for the least-squares reconstruction
%formulation
% E=ERRORFIT(X,Y,S,{T},{TFOV},{A},{B},{KGRID},{RKGRID},{SEP},{M}) returns the value of the
% objective function of the reconstruction
% * X is the reconstructed image
% * Y... |
function [rho, phi_pure, fug ] = solveGHC(T,P,XF,findMinZ,NC,Comp)
%This function will solve the GHC equation
%and compute fugacity at the given temperature and pressure
% Return: rho - density
% phi_pure - pure component fugacity coefficient
% fug - partial fugacities
%
% Inpute: T ... |
% CS 229 Homework 1 Problem 2 (d) %
close all; clear all;
% Load data %
x = load('q2x.dat');
y = load('q2y.dat');
% (i) %
% Unweighted least squares %
% minimizing || y - x'*theta || %
theta = x\y; % x\y = pinv(x) * y = inv(x'*x)*x'*y %
xx = linspace(min(x),max(x));
yy = theta*xx;
% plot linear regression %
subp... |
Lx = 2;
Ly = 1;
nx = 53;
ny = 21;
accuracy = 1e-8;
f = @(x,y) -2*(x^2+y^2);
gbottom = @(x, y) 1-x^2;
gtop = @(x, y) 4*(1-x^2);
gleft = @(x, y) 1+y^2;
gright = @(x, y) 2;
u = poisson2(f, gbottom, gtop, gleft, gright, nx, ny, Lx, Ly, accuracy);
hx = Lx/(nx-1);
hy = Ly/(ny-1);
x = 0:hx:Lx;
y = 0:hy:Ly;
surf(x, y, u');
axi... |
%> @brief struct_overlay Overlay default fields with input fields
%> @author Eric Cousineau <eacousineau@gmail.com>
%> @note From optOverlay() on Mathworks, modified
function [opts] = struct_overlay(opts_default, opts_in, options)
% Simple cases
if iscell(opts_default)
opts_default = struct(opts_defaul... |
function RehedgerStocks(aBot,aTime)
%First consider only strikes of 10
myStrike=10;
myExpiry=((169000-aTime)+3600*24*daysact('10-jun-2016', '16-sep-2016'))/(3600*24*252);
aTrades=aBot.ownTrades;
myING = zeros(length(aTrades.side),2);
options = GetAllOptionISINs();
myLTtime = round(aBot.sentOrders.ownOrderId(end));
fo... |
function [output_01 p1 p2] = TurboEncoder(x_01);
global prt;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Encoder-1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
p1_01 = ConvEncoder(x_01);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Encoder-2 (i.e., INTERLEAVER & Encode)
... |
files = dir('*.wav');
audio = cell(1,4737);
for k = 1:4737
% Reading an audio file
audio{k} = audioread(files(k).name);
[Y, Fs] = audioread(files(k).name);
filenames = ['voiced_' num2str(k+19066,'%d') '.wav'];
audiowrite(filenames,Y,Fs)
end |
%% Swarm Switching Behaviors for Motion
% Description : Switching Behaviors - Motion
% Author : Sasanka Nagavalli
% Date : February 5, 2016
% Other Files :
%% Clean up
clear;
clc;
clf;
close all;
%% Paths
addpath('../behaviors');
data_folder = '../data';
%% Simulation parameters
N = 10;
ti = 0;
dt = 0.1... |
function [E,C] = museClassifyAll(Y,k,X)
s = size(Y);
n = s(1);
for(i1=1:1:n)
C(i1) = museClassify(Y(i1,:),X);
end
D = ones(1,n);
E = zeros(1,s(2));
for(i1=1:1:n)
D(C(i1)) = D(C(i1))+1;
if (i1>k)
D(C(i1-k)) = D(C(i1-k))-1;
end
[m,j]=max(D);
E(i1)=j;
end
... |
function y=sigmoide(x)
y = 1 ./ (1 + exp(-x));
|
%% INVERSE DOMAIN SEARCH FOR MDD ANALYSIS
% Created By: Ryan McKeon
% Date: 10 March 2017
% Contact: ryan.e.mckeon@dartmouth.edu
% Updated 13 August 2018 --> Updated hematite diffusion kinetics following
% Farley 2018 GCA "Helium diffusion parameters of hematite from a
% single-diffusion-domain crystal
%%... |
% Copyright 2014
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writin... |
%Plot of mean and median of CI for Delta TGF for different values of A0
clear all
hold off
trials=400;
lg = [.75 1 .75];
gr = [0 .75 0];
gy = [.5 .5 .5];
or = [1 0.6 0.5];
%A0=1000
fCI1 = fopen('../data/Gillespie_Simulation_4_CI_T_A0_1000.dat');
t1 = textscan(fCI1, '%f%f%f%f%f');
fclose(fCI1);
CI1=t1{3};
CIT=median(CI... |
function result = get_depth_frames(dataset, subset)
% function result = get_depth_frames(dataset, subset, number)
% dataset is a result of calling function make_dataset
% subset is 'tr' or 'te' for training or test set
% number is the index of the video we want to read
if (strcmp(subset, 'tr'))
filename... |
% -------------------------------------------------------------------------
% Credit Risk Assessment Toolbox
%
% Author: D. N. Sotiropoulos (2019)
% -------------------------------------------------------------------------
% This script file provides fundamental computational f... |
clear all;tic
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This RF-CIW-ELM code achieves the following:
%-if M = 1600, an error rate on MNIST of about 98.3% correct on test data in about 30 seconds (on a four core computer using multithreading)
%-if M = ... |
% University of British Columbia, Vancouver, 2017
% Alex Kyriazis
% William Choi
%integrates generated microglia position data into the correct folders so
%it can be used for training
path = uigetdir('../../data/images','Open folder to integrate');
out_path = uigetdir('Open output folder to modify');
... |
% Class for a Plane object in the scene
classdef Plane < SceneObject
properties
Normal
Width
Length
RotateAxis
RotateAngle
end
methods
function plane = Plane(origin, normal, width, len)
plane.Origin = origin;
plane.Normal = normal;
... |
% This code belongs to the paper
%
% M. Bačák, J. Hertrich, S. Neumayer and G. Steidl.
% Minimal Lipschitz and ∞-Harmonic Extensions of Vector-Valued Functions on Finite Graphs.
% Information and Inference: A Journal of the IMA, vol 9, pp. 935–959, 2020.
%
% Please cite the paper, if you use this code.
%
% Alg... |
function lam = Louiville(trajData, jacEval)
intQuad = 0;
for i = 1:trajData.N
A = jacEval(trajData.X(i,:), trajData);
intQuad = intQuad + trace(A);
end
lam = intQuad/trajData.N;
end |
function [ perc_edge ] = edge_detection( immagine )
%EDGE_DETECTION: funzione per il calcolo della percentuale dei pixel
%appartenenti agli edge in un'immagine
%
%INPUT: immagine=immagine da elaborare
%OUTPUT: perc_edge= percentuale degli edge normalizzata
img = rgb2gray(immagine);
img1 = im2single(img);
edges = edge(... |
% This function produce the figures to illustrate Table V into graphs
function tableV_new(dataset_name)
addpath ../algorithms/;
addpath ../plotFuncs/;
spkm_maxiter = 10;
nnlsb_maxiter = inf;
str_now=datestr(now,30);
fprintf(['Now running for dataset ',dataset_name,'...\n']);
% obtaining parameters for the dataset
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; clc;
rng('default') % For reproducibility of data and results
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 5.3(a)
% Generate and plot the data points
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.