text stringlengths 8 6.12M |
|---|
function [ fullfilefilter,NonDropOut,DropOut, NonDrop, PotDrop,PureDrop,ImmDrop ] = dropouttypes( fullfilefilter )
%This function adds the drop out type to the file and makes new tables with
%the different types of drop outs (see function dropoutcheck)
%Input: file with patient data
%Output: file with extra columns in ... |
classdef Changed < event.EventData
properties
Data;
ControlId string;
ControlType string;
Setpoint;
MV;
PV;
end
methods
function this = Changed(controlId, controlType, mv, pv, sp)
arguments
controlId string... |
A=[1];
disp(A);
A=surroundWith(A,2);
disp(A);
A=surroundWith(A,3);
disp(A);
A=surroundWith(A,4);
disp(A);
A=surroundWith(A,5);
disp(A); |
% Returns orthonormal R which minimizes || A R - B ||_F.
% http://en.wikipedia.org/wiki/Orthogonal_Procrustes_problem
%
% When the matrix M = A' * B is rank 2, the last vector is up to sign.
function [R1, R2] = ambiguous_procrustes(A, B)
M = A' * B;
[U, S, V] = svd(M);
R1 = U * V';
R2 = U * diag([1, 1, -1]) * ... |
x=[0 0; 0 1; 1 0; 1 1];
x1= [x ones(size(x,1),1)];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Random matrix
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
R=rand(3);
y=x1*R;
divBy=repmat(y(:,3),1,3);
y1=y./divBy;
plot(x1(:,1),x1(:,2),'r+'); hold on;
plot(y1(:,1),y1(:,2),'bx'); hold on;
%axis([-2 2 -2 2]);
%%%%%%%%%%%%%%%%... |
function VideoON = TT_DetectVideoON(Filebase, nChs, Fs)
% 10 Oct 2018
% this function will determine the onset of pupil monitoring
% and make .video.evt file WITHOUT making any sync file
% ASSUMPTION
% A single sync pulse appears within first 30 sec in Ch#1.
% the pulse must be the first
%%%%%%%%%%%%%%%%%%... |
function [ output_args ] = xxxRawSpectra(dpn)
%xxxRawSpectra - function for making images and stuff from raw data
%extracted from Waters raw data
% Determine size of the thing
sz = [size(dpn.d1.sp,1) size(dpn.d1.sp,2)]
% Plot the spectra...
numScan = size(dpn.d1.numPoints);
figure; hold on;
for n = 1:100:numScan
... |
function hsl_ma97_expert(handle)
% HSL_MA97_DESTROY Free memory associated with factorization.
% hsl_ma97_destroy(handle) will free all memory associated with handle.
% The factorization may not be reused again.
%
% Usage: hsl_ma97_destroy(handle)
%
% Please cite HSL as:
% [1] HSL, a collection of ... |
%%
% File: Kronecker_product.m
% Directory: 2_demonstrations/egyeb/Matlab_tricks
% Author: Peter Polcz (ppolcz@gmail.com)
%
% Created on 2020. June 16. (2019b)
%
[He,O,I] = he;
%% (v ⊗ In) w = (Im ⊗ w) v
% De altalaban NEM igaz, hogy (A ⊗ B) C = (B ⊗ C) A
n = round(rand*10 + 3);
m = round(rand*10 + 3);
v = r... |
clear all;
syms('r');
fmhz = 915;
s = fmhz / 300;
dBm = 27;
pt = 10^(dBm/10); % mW
dbi = 8; % ant. gain (dBi)
eqn = fmhz/300 == pt * 10^(dbi/10) / (4 * pi * (r)^2);
soln = solve(eqn, r);
dist = eval( soln(soln > 0));
fprintf('********\nMaximum permissible exposure:\n')
fprintf('Distance is %.3f cm\n', dist);
fprin... |
function [s,o] = variable4testing(E,A,P,s,beta)
max_neurons =max(P);
m = length(P); %layers number
V = zeros(m, max_neurons + 1); %+1 for the threshold
%the first row of V are the inputs
aux = zeros(1,length(V(1,:))-length(E)-1);
if (length(aux)>=1)
E = [-1 E aux];
V(1,:) ... |
%% HW 5.6.5
%% Initial-boundary-value Problem
% * $v_t + v_x = 0, x \in (0, 1), t > 0$
% * $v(x, 0) = \sin^{80} \pi x, x \in [0, 1]$
% * $v(0, t) = v(1, t), t \geq 0$
% * One Analytic Solution: $v = \sin^{80} (\pi (x - t))$
%%%
%% Numerical Solution
%%%
ts = [0.0, 0.12, 0.2, 0.8];
% #1: $M = 20, \Delta t = 0.04$
dx = 0... |
Y = dicomread(('/Users/Pranav/Desktop/dicomimages/IM-0001-0001-0001.dcm'));
Av = mean2(Y);
disp(Av)
SD = std2(Y);
PIC = mat2gray(Y);
Con = imadjust(Y);
imshowpair(PIC,Con,'montage');
|
% Plot of two waves perperndicular to each other
% Create some x data
x = linspace(0, 4*pi, 30);
% Create two waves to plot
y = sin(x);
z = sin(x-pi);
% Plot the first wave in red and fill with color
u = zeros(size(x));
figure
fill3(x, y, u, 'r', 'EdgeColor', 'r', 'FaceAlpha',... |
function [ f ] = fn_sigma( L_vec, mu, n, A, G, u, v_eff, z )
L = tril(ones(A));
L(L == 1) = L_vec;
sigma = L * L';
f = 0;
for i = 1 : n
ui = u(i, :);
sigma_eff = sigma(ui, ui);
for k = 1 : G
f = f + z(i, k) * (log(det(sigma_eff)) + ...
(log(v_eff{i})' - mu(ui, k))' * (sigma_e... |
% This program solves the swing equation of a one-machine system
% when subjected to a three-phase fault with subsequent clearance
% of the fault. Modified Euler method
%
% Copyright (c) 1998 H. Saadat
%
function swingmeu(Pm, E, V, X1, X2, X3, H, f, tc, tf, Dt)
%global Pm f H E V X1 X2 X3
clear t
if exist('Pm... |
function [qs]=qcomp(q);
% function [qs]=qcomp(q);
%
% this function returns the complement of the
% quaternion, q* = [qo | -qbar]'
%
qs = [q(1);-q(2:4)];
|
function [archs2,results2] = RBES_add_archs(archs_to_add,results,archs)
global params
archs2 = archs;
results2 = results;
narc = size(archs_to_add,1);
for i = 1:narc
arc = archs_to_add(i,:);
if strcmp(params.MODE,'PACKAGING')
resu2 = PACK_evaluate_architecture8(arc);
end
add = resu2;
add.ins... |
function [y] = MyEdgeDetectionCell(c, neighs, N, n,w,e,s, nw,ne,sw,se)
he = fuzzyEq3(N(2, 1), N(2, 2), N(2, 3));
ve = fuzzyEq3(N(1, 2), N(2, 2), N(3, 2));
de = fuzzyEq3(N(1, 1), N(2, 2), N(3, 3));
ie = fuzzyEq3(N(3, 1), N(2, 2), N(1, 3));
cmp = max([ he, ve, de, ie ]);
y = cmp; %1 - exp(cmp);
%[c cmp y]
%... |
function [F, dF, fluxRampStrobe] = decodeSingleChannel(file, swapFdF)
% digitizerFrequencyMHz/numberSubBands
subBandHalfWidthMHz=4.8;
% if swapFdF =0 then f stream first, df second
% if swapFdF=1 then f stream second, dF stream first
if nargin < 3
swapFdF = 0;
end
if swapFdF == 0
nF = 1; nDF =2;
else
nF... |
%Crop the region of 24 colors in mcc chart
%
% Input
% * img: The mcc chart picture, can be the file path or loaded image(in RAM)
%
% Output
% * grid: The 24 * 4 map of all coord of the cropped regions
% * output: To output the image file (with crop info) to the output path
function mcc_align(img, img_title, fu... |
function bStatus = daq_appendProperty(filename, nameStr, valueStr)
%Append a name value pair to the end of the file.
%Can only be called on file of file format -4 or newer.
%nameStr: the name of the property to be appended to the datafile
%valueStr: the value of the property to be appended to the datafile
... |
%input:F(k)
%outpt:F(k+1); F(k+1)中每个项对应的支持度; L: F(k+1)中含有的频繁项的个数
function [EF2,sup,L]=Apriori_gen(EF1,k,P,AT,min_sup)
EF2=[];
sup=[];
L=0; % EF2中频繁项的个数
%N=size(TrainingData,1);
m=size(EF1,1);
if m>1
if k==1 %由1到2组合
for i1=1:m-1
for i2=(i1+1):m
location_1=find(... |
% Creates n x n hilbert matrix where the H(i,j) entry of the
% hilbert matrix is equal to 1/(i + j - 1)
function H = hilbert(n)
H = zeros(n);
for i = 1 : n
for j = 1 : n
H(i,j) = 1/(i + j - 1);
end
end
end |
function output = echo_gen(input,fs,delay,amp)
samples = round(fs*delay);
ds = floor(samples);
signal = zeros(length(input)+ds,1);
signal(1:length(input)) = input;
echo_signal = zeros(length(input)+ds,1);
echo_signal(ds+(1:length(input*amp))) = input*amp;
output= signal + echo_signal;
p = max(abs(output));
if p>1
o... |
function result = get_component(binary, k)
% result = get_component(binary)
%
% returns a boolean image where non-zero pixels represent
% the k-th largest connected component of the input image
[labels, sorted_labels, areas] = connected_components(binary);
if (numel(sorted_labels) < k)
result = [];
else
... |
clear all;% clc;
close all
% profile -memory on
Config();
% warning('off','all');
Sys.pOrd = 1;
Sys.hOrd = 1;
prjName = 'CircKoshiba26_5';
Mesh = IOrPoly( prjName, 'q34a1AQ', Sys.hOrd, 1e-3);
% PlotMesh(Mesh,1)
% PlotPoly(prjName, figure);
Mesh.a = 22.86e-3;
Mesh.b = Mesh.a/2;
Sys.WPnModes = 1;
Sys.WPport... |
function [] = setfigdefaults()
set(0,'defaultlinelinewidth',1)
set(0,'DefaultlineMarkerSize',6)
set(0,'DefaultTextFontWeight', 'normal')
set(0,'DefaultFigureWindowStyle','docked')
set(0,'DefaultAxesFontSize', 12)
set(0,'DefaultTextFontSize', 12) |
% plate_and_br_basic_comparisons.m
% Takes output from historic_timeseries_stats.m in addition to summary data
% for each plate and the surrounding bedrock. Summary data includes
% average % cover, average number of mobile species, average differential %
% cover and number of mobile species between each plate and the... |
function varargout = delta_gamma(varargin)
%% Mian Huang 20160406
% 画出三幅图,1 gamma vs vol, 2, delta vs vol, 3, delta vs price
% 用来实时观察delta 对冲 头寸,及时调整vol
% DELTA_GAMMA MATLAB code for delta_gamma.fig
%
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help delta_gamma
% Last Mo... |
function [traindata,testdata] = constructdata(x1data1,x2data1,x1data0,x2data0)
testdata = [];
for i = 1:length(x1data1)
testdata = [testdata;[x1data1(i),x2data1(i),1]];
end
for i = 1:length(x1data0)
temp = [];
temp = [temp;[x1data0(i),x2data0(i),-1]];
testdata = [testdata;temp];
end
ndata ... |
%% s的入口
% 注1:设置为nan,强制空仓(设置0未必空仓,因为还要中性化)
% 注2:code是保留字,是000001.SZ
% 注3:时间通过下标实现,如果要看日期,
% dateArr(i)形同'2014-09-14'
% dateNumArr(i)形同 735839
% 注4, col 是保留字
% 注5,其他保留字对照Main15_basicData看:
% open, close, high, low, avg (向前复权)
% openRT, closeRT, highRT, lowRT, avgRT(不复权)
% volume, amount, change, retr... |
function [otime,odata,otrough] = agemodel(itime, idepth, depth, data,otime)
% AGEMODEL function [otime,odata,otrough] = agemodel(itime, idepth, depth, data, otime)
%
% This function takes data with given tie-point dates, specified at certain depths, and makes a linear timeline
% between them. It then interpol... |
% Function to define the field range along which to determine the
% hysteresis.
function Field = GetField(FieldRange,angle)
Field.Hup = FieldRange;
Field.Hdn = -FieldRange;
Field.angle = angle*(pi/180);
end
|
clc
clear all
close all
% x = double(rgb2gray(imread('/Users/INNOCENTBOY/Documents/MATLAB/pic/256/4.1.01.tiff')));
x = [1,2,3;4,5,6];
% h = [-1,-1,-1;-1,9,-1;-1,-1,-1];
h = ones(2,2);
% h = h/9;
% h = [1,1;1,1];
M= size(x,1);
N= size(x,2);
m= size(h,1);
n= size(h,2);
c= zeros(M+m-1,N+n-1);
% c2 = zeros(M+(2*(m-1)),N+(... |
%define Kamin's World
% "Copyright (c) 2000 and The Regents of the University of California. All rights reserved.
%
% Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without written agreement
% is hereby granted, provided that the abo... |
close all;
MatrixName= 'result.mtx';
method ='bicgstab';
%method ='gmres';
el = 2;
% GMRES parameter
restart = 3;
tol = 1.0e-17;
maxit = 100;
DirName = 'figs';
FontSize = 14;
mats = {'result.mtx'};
for i = 1 : 20
[req,pot,add,F,c] = precol2('D2RestrictedColumns','Nat','Nat',num2str(i),'2','result.mtx',-1);
[req2,pot2,a... |
% function u = calculate_odometry(e_R, e_L, E_T, B, R_R, R_L, delta_t, mu)
% This function should calculate the odometry information
% Inputs:
% e_L(t): 1X1 --- encoder ticks for the left wheel in time step t
% e_R(t): 1X1 --- encoder ticks for the right wheel in time ste... |
% Loïc LERAT 1920881
% Simon-Pierre DESJARDINS 1739351
%% Nettoyage du workspace
clear all;
close all;
clc;
%% Exercice I
% Signaux simples
x = 0:pi/13:7*pi;
Y = @(x) sin(x);
C = @(x) 2.8 + 0*x;
moy = 0.1;
varia = 0.4;
B = @(x) moy + sqrt(varia)*randn(size(x));
Z = @(x) (Y(x) + C(x) + B(x));
moyenneZ = mean(Z(... |
function edge_image = my_canny_edge(img, low_th, high_th, filter_size)
% Find edge of Image using canny edge detection
% img : Grayscale image dimension ( height x width )
% low_th : low threshold type ( uint8 )
% high_th : high threshold type ( uint8 )
% filter_size : size of filter ... |
function [M] = attitude_controller(state,desired_state,params,question)
% Input parameters
%
% current_state: The current state of the robot with the following fields:
% current_state.pos = [x; y; z],
% current_state.vel = [x_dot; y_dot; z_dot],
% current_state.rot = [phi; theta; psi],
% current_state.ome... |
function [ S ] = system_masses(N, options )
%masses_model function is used to find the dynamic equations of N masses
%system. The no of masses is specified by N and options specify the constraints
%on the system.
% The syntax of the function is
% S=masses_model(N,options)
% system with N-1 inputs .
default_options = st... |
function [leftEyeAll, rightEyeAll, timeStampAll, crossHairEndTS] = DataCollectSemSal(userID, thisTrialInformation, pauseTimeInSeconds, handle, totalSeconds)
%DATACOLLECT collects the data from the eye tracker
% This function is used to collect the incoming data from the tobii eye tracker.
%
% Input:
% ... |
% Produces periodic thrust
% mode 1 = sinusoidal
% mode 2 = square wave
% wing beat frequency calculated form "Speeds and wingbeat frequencies of migrating birds compared with calculated benchmarks" BY C. J. PENNYCUICK
function flapthrust = flapping(T)
flapBeatFrequency = 10;
% typethrust = [sin(2*pi*(flapBea... |
function [ botSim, Turn, Forward] = move_commandSIM( botSim, moves, start_angle, resolution)
% Converts the discrete route into bot moves
%
% ===== Inputs =====
% botSim - BotSim Class
% moves - List of unit moves from start to target
% start_angle - start heading of bot
% resolution - size of route steps
... |
%Andrew Sivaprakasam
tic
%% Clearing and Adding Paths
clear all, close all
addpath('Sound_Samples/Part A/')
addpath('Functions')
addpath('Sound_Samples/Part B/Violin')
addpath('Chimera code and WAV files')
addpath('BEZ2018model')
addpath('SpikeTrains_SpectroTemporal-master');
%% Compiling C Code
cd BEZ2018model
mex... |
%% Inputs
h = 0.001; %% Time step [s]
y0 = -2e-3; %% Initial position [m]
ydot0 = 0.05; %% Initial velocity [m/s]
D = 7.38e2; %% Damping modulus [Pas]
E = 1.4e5; %% Elastic modulus [Pa]
h0 = 3e-04; %% Zero pressure w... |
clear
load("SAR_Results.mat");
correctPercent = zeros(1,12);
uncertainCorrectPercent = zeros(1,12);
ind = 1:3:length(Correct);
for l=1:length(ind)
i=ind(l);
correctPercent(l+2) = (2*Correct(i+1)+Correct(i+2) + 2*Uncertain(i+1)*UncertainButCorrect(i+1)+Uncertain(i+2)*UncertainButCorrect(i+2))/3; %% Twice as many... |
%% Creating a cortex segmentation on segmented mri done previously
cfg=[];
cfg.mri=segmentedmri;
cfg.threshold=0.1;
cfg.smooth=5;
cfg.grid.unit='mm';
grid=ft_prepare_sourcemodel(cfg);
save grid grid;
|
%%winnow sine to eliminate overlap with pulse song
%%There are two general categories to winnow
%%1 - sine that immediately precedes or follows pulses and overlaps 1 pulse
%%2 - sine that falls between and overlaps pulses
%%Case 1 can be winnowed simply by finding the set of sine song that does
%%not overlap pulses
%%C... |
% HW 4 Problem 3
% Steven macenski modified Sept 28 2013
x = [0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1];
y = [-.447 1.978 3.280 6.160 7.080 7.340 7.660 9.560 9.480 9.300 11.200];
a = polyfit(x,y,2);
fprintf('\n Equation \n%.3fx^2 + %.3fx + %.3f\n\n',a);
hold on
plot(x,y,'ok');
plot(x,-9.811.*x.^2 + 20.129.*x + -0.032,'-k'); |
%曾鈺皓_0071035_Matlab簡介_作業10
clear;clc;clf;
ex=xlsread('ML_1072_Ex_10_dat.xlsx');
%把Excel的檔案讀進來
[data1,text,all_data]=xlsread('ML_1072_Ex_10_dat.xlsx');
% sheet=1;
% x1Range='A2:H169'; %指定要讀哪一個區域的資料
% D=xlsread('ML_CH17_Excel.xlsx',sheet,x1Range);
% [day ot sp t td ws wd pre]=xlsread('ML_1072_Ex_10_dat.xlsx')
%(a)
day=d... |
% BreakLinkParCloseFcn
if 0
try
blockLinkStatus=get_param(gcb,'LinkStatus');
if strcmp(blockLinkStatus,'resolved')
set_param(gcb,'LinkStatus','inactive')
%set_param(gcb,'LinkStatus','none')
end
end
end |
clear
x = [ 10.34 10.42 10.25 9.82 10.33 9.66 10.27 10.25 10.30 9.50 9.55 9.40 10.00 9.34 ]
n = length(x)
soma = 0
for i = 1 : n
soma = soma + x(i) ;
end
media = soma/n ;
soma2 = 0 ;
for i = 1 : n
soma2 = soma2 + (x(i)-media)^2
end
s = sqrt ((1/(n-1))*soma2)
disp(s) |
% Consensus algorithm for getting a better lower bound of the real-time
% local-pooling factor
clear all; clc;
% Generate a random network
% Initialization of neighborhood information
% Convergence to consensus
|
clear all
close all
T = readtable('../Summary_Data_800_Gals/PatientInfo07132021.csv','Headerlines',2);
%pt 289 ('HPV224_20151203') time reset
%pt 330 ('HPV266_20151210') still bad
%No fucking clue:
%pt 78
%pt 172
%pt 124 bad ('HPV73_20141210')
%pt 654 ('HPV592_20150825')
%pt 655 ('HPV592_20151211')
%pt 656 ('HPV5... |
function [ threshold ] = threshold_cal_ir_new1( lam, rou, evl_num, Qval_t, th_step, th_start )
%DIST_TEST Summary of this function goes here
% Detailed explanation goes here
% clc
% clear all
% dc = 3;
% dv =4;
% evl_num = 1000;
threshold = th_start;
th_stepX100 = th_step * 100;
th_stepX10 = th_step * 10;
for ii=1... |
function volume = meshVolume(FV)
F = FV.Faces;
V = FV.Vertices;
nFaces = size(F, 1);
vols = zeros(nFaces,1);
for i = 1:nFaces
currentFace = F(i,:);
v1 = V(currentFace(1),:);
v2 = V(currentFace(2),:);
v3 = V(currentFace(3),:);
vols(i) = SignedVolumeOfTriangle(v1, v2, v3);
end
volume = abs(sum(v... |
function error = calc_R_error_lambdazero(R, k, n_folds)
k.set_R(R);
error = k.calc_cv_error(n_folds);
end
|
figure(1)
f=0.2; %f=1/T = 1/5 = 0.2 Hz
t=0:0.002:5;
x=sawtooth(2*pi*f*t); %generarea semnalului triunghiular
plot(t,x);
ylim([-2,1]);
title('Semnal triunghiular');
%%
figure(2)
f=0.2; %f=1/T = 1/5 = 0.2 Hz
t=0:0.02:5;
x=sawtooth(2*pi*f*t); %generarea semnalului triunghiular
plot(t,x);
ylim([-2,1]);
ti... |
function ShowSVdistribution()
% function ShowSVdistribution()
% Illustrates different distributions of singular values.
close all
A = GALLERY('randsvd', [500,100],10^6,3);
sv = svd(A);
figure
semilogy(sv)
title('Geometrically Distributed Singular Values','Fontsize',14)
xlabel(sprintf('A = gallery(''randsvd... |
function [deltaNl,deltaNm,deltaNs,eq,FOCiters,FOCerror,num_iters_wage,wage_tols,wage_tolVector] = steadyState1960(log_inp, param,IsthisBSReplication)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is to compute Bj in 1960, assuming Aj = 1 for all sector
% INPUTS:
% log_inp ----... |
% DataSamplingTestPCA.m
% 2015/06/02
clear all;
clc;
tic;
sample = 200;
half = sample / 2;
num_om = half;
num_hm = half;
% データの読み込み
FileName = 'SamplingData/%d/samplingdata_%d_%d.xls';
IndexSize = 5621;
dim = 3;
CoefName = 'TrainPCA/%d/coefs_%d_%d.xls';
MeanName = 'TrainPCA/%d/mean_%d_%d.xls';
SampleData = zeros(s... |
function output_cvx = scvx_subproblem(vehicle, lds, x_last, u_last, eta_last, weights)
%scvx_subproblem Solves one iteration of a SCVx problem
% This requires knowledge of the dynamics and previousl control and input
% histories. It returns a newly optimized trajectory and input control
% history with free final ... |
function [data,delta]=kpfit(x,y,n)
% Produces a poly fit to the data
% Input: y = vector with plot to be fitted
% x = x axis where the data happens
% n = degree of polyfit
% Output: data = result polfit data
if nargin<3
n=10;
end;
warning off
[p,S,mu] = polyfit(x,y,n);
[data,delta] = polyval(p,x,S,m... |
function [concentrations, dna_synthesis] = timecourse(exp_mode, exp_title, directory, max_time, ~, concentrations, knockouts)
syn_func = @(x) 54.97*(1-exp(-0.0308*x))+48.08;
%% time series
synthesis_vec = zeros(max_time,1);
synthesis_vec(1) = syn_func(concentrations(1,Constants.CDC25A));
f... |
classdef Tree_node < handle
properties
data;
children = {};
parent;
end
methods
function obj = Tree_node(data, parent)
obj.data = data;
obj.parent = parent;
end
function add_children(obj, children)
size_of_array_to_add... |
fl=pre_samples+post_samples+1;
sclsfr.dim=[];iclsfr.dim=[];fsclsfr.dim=[];ficlsfr.dim=[];ssclsfr.dim=[];
for i=2*l+1:1:size(X,2)-l
%tic
bsEEG=mean(X(sEEG_idx,i-2*pre_samples-1*post_samples-1:i-1*pre_samples-1),2);
sY=repop(X(sEEG_idx,i-pre_samples:i+post_samples),'-',bsEEG);
sY=ls_whiten(sY,5,0); ... |
function plotter()
close all;
image_expansion_x = load('image_expansion_x.txt');
image_expansion_y = load('image_expansion_y.txt');
N=5;
d=4;
degrees = pol_degrees(N,d);
hermit_basis = hermit_pol_coef(N);
sample = normrnd(0,1,10000,4);
result_x = [];
for k = 1 : length(sample)
u = 0;
for i = 1 : length... |
x = [-2:2]
p = @(x) exp(-x).*cos(2*pi*x);
t = [-2:0.01:2];
f = @(t) exp(-t).*cos(2*pi*t);
tt = [-2:2]
h = @(tt) exp(-tt);
grid;
%figure();
subplot(311);
plot(t,f(t));
xlabel('t');
ylabel('f(t)');
subplot(312);
plot(x,p(x));
xlabel('t');
ylabel('f(t)');
subplot(313);
plot(tt,h(tt));
xlabel('t');
ylabel('f(t)');
%... |
function imgout = ShotNoise(imgin,sigma,level,N)
M=size(imgin);
imgin=imgin/max(max(imgin));
[X,Y]=meshgrid(1:M(2),1:M(1));
amp=level*max(max(imgin));
imgout=zeros(size(imgin));
ind1=0;
while ind1<=N
newcoord(1)=M(1)*rand;
if newcoord(1)<1
newcoord(1)=1;
end
newcoord(2)=M(2)*rand;
... |
function start_livejournal()
clear;clc;
addpath ../dataset/data_LiveJournal/
addpath ../mit_network_analysis_tools/
% 选择参数实验 1--执行 0--不执行
S_shuffle = 0; % 跳数阈值实验
sigema_shuffle = 1; % 衰减因子实验
T_shuffle = 1; % 稀疏自编码器层数实验
beta... |
function yPredicted = testing_classifier_over_time(testing,classifier,class)
if ~strcmp(classifier.type,'spectral')
xt_Test_period = testing.features.temporal;
else
xt_Test_period = [];
end
if ~strcmp(classifier.type,'temporal')
xs_Test_period = testing.features.spectral;
else
xs_Test... |
%This code will be for the first part of the comodulation binding
%experiment collecting only behavioral data on 12 conditions
clear all; close all hidden; clc; %#ok<CLALL>
path = '../CommonExperiment';
p = genpath(path);
addpath(p); %add path to commonly used functions
addpath('Stim_Dev')
subj = input('Please subject ... |
% Given an a-value and n-value, this function will generate an approprate
% matrix that adheres to the 'patterning' given out in Question 4.
function A = generateA(a,n)
% generate the diagonal vector
negative2 = [ones(1,(n-1)/2)*-2, -(1+a), ones(1,(n-1)/2)*(-2*a)];
% begin building the other 2 diagona... |
function [ prediction_1, prediction_2,prediction_a] = get_Predictions_CoTraining(unlabelled_indices,view,link,v_Iteration,l_Iteration,Base_a,Base_r,v_mode,labels)
%returns final MVMRML predictions
%prediction_1 is obtained from average of probabilities of MV and MR model
%prediction_2 is obtained from produ... |
function ShowUnder()
% function ShowUnder()
% Illustrate two different methods for solving a full row rank
% underdetermined system.
clc
m = 3;
n = 5;
A = randn(m,n);
b = randn(m,1);
fprintf('Underdetermined System Solving\n\n')
xMethod1 = UnderQRpiv(A,b);
disp('xMethod1 =')
fprintfM('%20.15f',xMethod1)
... |
clc;clear all;close all
markers = ["lef","lbd","lelb","lelb1","lps","lie","lie1","ref","rbd","relb","relb1","rps","rie","rie1"];
subjectID = ["1330","1390","1490","1430","1950","1660","1160","1970","1580","1440","1110","1770","1250","1240","1610","1840","1130","1490","1940","1390","1410","1710","1380","1630"];
SID = 24... |
function [expDes,vid] = getVideoSettings(scr,const,expDes)
% ----------------------------------------------------------------------
% [expDes,vid] = getVideoSettings(scr,const,expDes)
% ----------------------------------------------------------------------
% Goal of the function :
% Select type of trial relative the di... |
function [NDC, nHospital, inHospital, nICU, inICU, nDeaths, INF]=ODE_to_Observables(T, nDC, E, Region, h_factor,i_factor,d_factor,h_stretch,i_stretch,a,...
Assumed_Delay_Reporting_Deaths, rc_Distribution_Hosp_Time, rc_Distribution_HospICU_Time, rc_Distribution_ICU_Time, Distribution_Symptoms_to_Hospital, Distributi... |
function [out, rout, Wi, L2, L1] = ANFIS_eval(in,fs,cons_param)
nSet = size(fs,1);
nIn = size(fs,2);
nRules = nSet^nIn;
x = in(1);
y = in(2);
actv_in = zeros(nSet*nIn,1);
for i = 1:nSet
actv_in(i) = fs{i,1}(x);
actv_in(i+nSet) = fs{i,2}(y);
end
L1 = actv_in;
%(Layer 2) T-norm prodotto
act_Tnorm... |
%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Sam Feig
% Vladimir Zhdanov
%
% CSCI 4831/5722
% Homework 3
% Instructor: Ioana Fleming
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [ outImg ] = meanFilter(inImg, kernel_size)
outImg = inImg;
[m, n, color] = size(inImg);
% Calculate bidirectional kernel offset
kernel_... |
function err = roundErr(y,X,Z,c,K0)
[N,D] = size(X);
if length(c) == 0
err = norm(y)/sqrt(N);
return;
end
[c2,ind] = sort(c,'descend');
%Z2 = Z(:,ind(1:min(end,K0)));
Z2 = Z;
[N,K] = size(Z2);
DK = D*K;
E = zeros(N,DK);
for i = 1:N
rank_one_mat = X(i,:)'*Z2(i,:);
E(i,:) = rank_one_mat(:)';
end
w = inv(... |
% 根据标准的类别标记,计算分类结果的错误率
% calPredictErrorRate
% 在 testAdaBoostLearner/testBoostLearner/testCascadeAdaBoost 等计算分类错误率时调用
%
% 输入:
% stdOutput 标准样本类别标记
% predictOutput 预测样本类别标记
%
% 输出:
% errorRate 错误率 :分类错误率的样本比例
% TPRate 检测率 :True-Positive Rate
% FPRate 误检率: Negative-True Rate
%
%
function [errorRate,TPRat... |
function [bb] = toheight(bb_corners)
%--------------------------------------------------------------------------
%
% Copyright (c) 2014 Jeffrey Byrne
%
%--------------------------------------------------------------------------
if isempty(bb_corners)
bb = []; return;
end
xmin = bb_corners(:,1);
ymin = bb_corners(:,... |
function set_subc(cont,num,subc)
cont.subcontrollers{num} = subc;
end |
%a) reparametrize into % v = [ab, ac, ad, bc, bd, cd, a2, b2, c2, d2,1] = [v0 1]
function M = build_homo_system(A, B, case_num, at, bt, ct, dt, et, prime_num)
%in cols:
% R3sym = [a^2+b^2-c^2-d^2, 2*b*c-2*a*d, 2*b*d+2*a*c;
% 2*b*c+2*a*d, a^2-b^2+c^2-d^2, 2*c*d-2*a*b;
% 2*b*d-2*a*c, 2*c*d... |
function PINK_STIM = genpink(HRIR,duration,Fs)
% GENPINK generation of pink noise stimuli convolved with HRIR
%
% function STIM = genpink(HRIR, duration, Fs)
%
% convolution of pink noise with all impulse responses in HRIR.
% the stimulus has the lenght of duration (in ms)
ramp = 5; % in ms
Fl = 100 ; %... |
function [c]=hier_clustering(dataset, number_of_clusters, algorithm)
switch algorithm
case 'complete'
Z = linkage(dataset,'complete');
case 'ward'
Z = linkage(dataset,'ward');
case 'WPGMC'
Z = linkage(dataset,'median');
otherwise
disp('... |
%% Paweł Antkowiak
clear
close all
clc
%% Dane
tzk=165;
R=190;
taup=130;
%% Obliczenia
A=taup/R^2;
rp=sqrt(tzk/A);
Rw=220:60:2500;
for i=1:max(size(Rw))
rc(i)=fsolve(@(r) 2.*(1-r)-3.*(1-r).^(2/3)+1-tzk./(A.*Rw(i).^2),0.5);
end
clc
B=taup/R;
Rwb=fsolve(@(r) 1-(tzk./B./r).^3,200):30:2500;
... |
function [period_index,cycle_num,per_cycle_index] = cycle_fit(event_index,amps,fit_model,S_period)
N = length(fit_model);
period_index = struct();
cycle_num = cell(1,N);
per_cycle_index = struct();
for i =1:N
t_per_cycle = round(2*pi/fit_model{i}.b1);
cycle_num{i} = round(length(S_pe... |
function y = apply_reflector_right(reflector, X)
% y = X*(eye(n) - 2*reflector*reflector');
y = X*reflector; y = y*reflector';
y = X - 2*y;
|
function theta_only
%---------------------initial parameter------------------%
h = 0.01;
t = 0;
y1 = 10*pi/180; %theta
y2 = 0; %theta_dot
x2=0;
x1=0;
%--------------------------------------------------------%
%Target value: The goal of control
%Current value: Current conditions sensed... |
function [ Quotes,LnQuotes,StdQuotes,CovMatx,CorrMatx,CovMatx4LnQuotes,CorrMatx4LnQuotes,CovMatx4StdQuotes,CorrMatx4StdQuotes] = DataProcJDBC( IndtyName,databasename,username,password,driver,databaseurl )
%DataProc Summary of this function goes here
% Detailed explanation goes here
% In
% IndtyName,databasename,... |
function generate_hdf5_train_test(path_txt, save_hdf5_path, txt_name, test_id)
%% settings
%% settings
% folder paths save the mat files
% save_hdf5_path paths save the final hdf5 file
% test_id = '10'
savefolder = strcat(save_hdf5_path,num2str(test_id),'/');
txt_train_name = strcat(path_txt, txt_name,'_S', num2st... |
function brood_plot()
set(gca,'FontSize',14);
laying_function = [-30,1,32,60,91,121,153,182,213,244,274,305,335,366,395;0.1,0.1,0.1,0.1,0.5,1,2,2,1,0.5,0.1,0.1,0.1,0.1,0.1];
laying_rate = 2000;
L_year_x = laying_function(1,:);
% Load y values of measure points for laying rate... |
function wind_speed = wind_streamline(X, CX, W, params)
%disp('wind_streamlines not done yet')
%Extracting min and max values from mesh grid to create a valid n-d grid
%for streamlines function
% Most work goes into creating a grid space with
%Constructing the wind field interpolant
%FX,
[F1, F2, F3] = wind_interp(... |
function [] = GUI_Lineal(plot_Servo,plot_Fuerza,plot_Fuerza_filtrat,plot_Biceps,plot_Biceps_filtrat,plot_Triceps,plot_Triceps_filtrat,t,t2)
subplot(2,2,1)
plot(t ,plot_Servo);
title ("Servo Position");
xlabel('Time (seconds)','Fontsize',10);
ylabel('Degrees (º)','Fontsize',10);
axis([ t2... |
function M = get_M(X)
for i=1:size(X,1)
mx(i)=max(abs(X(i,(floor(size(X,2)/2)-4):(floor(size(X,2)/2)+4))));
end
M=max(mx);
end
|
file_path = '/media/alex/900f118b-953c-405d-8127-f5f5914ad078/alex/Reverb_MSc_Matlab/IRs/All/Full_new/ferret_reverb1_full';
save_dir = '/home/alex/Desktop/Figures/IR_investigate/McDermoth_IRs/';
lowfreq = 200; %Low frequency cut-off
highfreq = 20000; %High frqeuncy cut-off
short_fft = lowfreq; %Whether to cut the FFT a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.