text stringlengths 8 6.12M |
|---|
%% Ident_Proxy Function
% Goal:
% Use proxy identification method to identify the VAR model.
% Proxy method as in Mertens and Ravn (2013).
% Take instrument(factor) as give.
% Adjust if instrument is not of the same length as other variables.
% Input(varagin):
% i... |
function [coeff, b_est, a_out, group_est] = SSP_PLS_est_post(N, T, y, X, K, lambda, R)
%SSP_PLS_est_post
% call SSP_PLS_est by Su, Shi and Phillips and perform
% Post C-Lasso regressions
% only our scenario with two variables and two groups
assert(size(X,2) == 2);
assert(K == 2);
% estimate
[b_est, a_out, group_est] ... |
function [results,perf]= evalCodonSubsets(combCtg,meta, getCodons, metricNames)
%Evaluates all the subsets of codons
% combCtg:
% getCodons
% % meta: struct |
codonEvals = cell(size(combCtg,1),1);
perfTs = cell(size(codonEvals));
for i=1:size(combCtg, 1)
[codonEvals{i}, ~, per... |
function VANDERPOL
%
% Выбор метода решения:
method_type='Rado5'; % Допустимые значения:
% 1) 'Euler' --- неявный метод Эйлер
% (одношаговый, одностадийный, 2-ого порядка)
% 2) 'Rado3' --- метод Радо IIA
% (... |
function seed = reshapeSeed(seed , ns, npStar, ndStar, nv)
% inputs: seed - initial seed design (points within 1 and ns)
% ns - number of points in the seed design
% npStar - number of points of the Latin hypercube (LH)
% nd - number of divisions of the LH
% nv - number of variables in the LH
% outputs: seed - seed des... |
%% Script to call the constrained optimizer and related functions
global H;
global W_inv;
load dataset2.mat;
%%Initialize states and landmarks
T = t(2) - t(1);
X_0 = [x_true(1); y_true(1); wrapToPi(th_true(1))];
f_k = @(X, U) X + [T*cos(X(3)), 0;
T*sin(X(3)), 0;
0, ... |
function [phi, dphi] = RpiShape(point, nodes, neighs, sd_rad, options)
%% RpiShape
% Use: Computes the meshfree Radial Point Interpolation (RPI) approximation basis function and its gradient.
%
% Syntax: [phi, dphi] = RpiShape(point, nodes, neighs, sd_rad, options)
%
% Input:
% point - The coordinates of the eval... |
load statlog.heart.data
X = standardizeCols(statlog(:,1:end-1));
y = statlog(:,end);
[n,p] = size(X);
%% Solve with minFunc
Xmf = [ones(n,1) X];
ymf = sign(y-1.5);
options.display = 'none';
options.Method = 'newton';
tic
w = minFunc(@LogisticLoss,zeros(p+1,1),options,Xmf,ymf);
toc
%% Solve with glmfit
tic
b = glm... |
function rtp_run(dates, dataset, model, emis, sst, output, cleartype, fovsset, freqsset, fpd)
% function rtp_run(dates, dataset, model, emis, sst, output, cleartype, fovsset, freqsset, fpd)
%
% Creates the basic RTP matchup for the requested instrument data
% with model data.
% Optionaly perform clear sunseting or... |
function gui = drawFeatures(gui)
if(isfield(gui,'tracker'))
if(isfield(gui.features,'hullPlot'))
delete(gui.features.hullPlot);
end
delete(gui.features.panel);
end
features.panel = uipanel('position',[0 0 1 1],'bordertype','none');
features.axes = axes('parent',features.panel,'ytick... |
function [ ratio ] = last_bid_ask_relation( ticks, displayFlag )
%LAST_BID_ASK_RELATION 很简单的功能:统计last 与ask,bid的大小关系
% 程刚,20140723
%%
if ~exist('displayFlag', 'var'), displayFlag = 1 ; end
%%
l = ticks.last;
b = ticks.bidP(:,1);
a = ticks.askP(:,1);
len = length(l);
%%
ratio(1) = sum(l>a)/len;
ratio(2) = sum(l == a)... |
function [ best_idx, perform_mat] = TuneParam_Xlr...
(param_set, X, Y,X_R,coord,trainIdx,testIdx,vadratio)
%% INPUT
% data: original data
% obj_func_str: 1-parameter optimization algorithms
% param_set: the set of the parameter. array
% eval_func_str: evaluation function:
% signature [performance_mea... |
% Name: Zheng Wen
% USC ID: 7112807212
% USC Email: zwen1423@usc.edu
% Submission Date 3/3/2020
addpath('E:\Chrome Download\EE569\Week3\basicOperations');
raw_hedwig = readraw('hedwig.raw');
ori_hedwig = raw2img3(raw_hedwig, 512, 512);
imwrite(uint8(ori_hedwig), 'ori_hedwig.tif');
res_hedwig = warping_from_... |
%adg_test_problems test cuter problems
function adg_test_problems
pdat_set = mcute_org2pdat('adg_set.org');
pdat_test = mcute_test_pdat_set(pdat_set,1,1);
mcute_struct2org(pdat_test,'adg_test.org');
%keyboard
end |
function data = readOctMetaMerged(DataDescriptors, tags, filenameNumber)
% READOCTMETAMERGED: Helper for reading metaData for the segment functions
% in octsegMain reads the manual-Data if available, otherwise the auto-Data
%
% DATADESCRIPTORS: see octsegMain
% TAGS: Cell structure, created by getMetaTag if type 'both.... |
function z = Sample(m_t, fs)
t = m_t(2,2) - m_t(2,1); %difference beteen any two samples is the original sampling time
t_s = 1/fs; %the required sampling time
ratio = t_s/t %how many points for picking a single sample
current = 0;
z = [];
z_t = [];
for i = 1:length(m_t(2,:))
if floor(current) == i-1
curren... |
theta1 = pi/2;
theta2 =0;
% theta1 =0;
theta2 = 0;
%BPSK-BPSK
% m1 = [-1 1];
% m2 = [-1 1];
% 8PSK-8PSK
%m1 = exp(1j*theta1)*[1 -1 1j -1j cos(pi/4)+1j*sin(pi/4) cos(-pi/4)+1j*sin(-pi/4) cos(-pi/4)+1j*sin(pi/4) cos(3*pi/4)+1j*sin(3*pi/4)];
%m2 = exp(1j*theta2)*[1 -1 1j -1j cos(pi/4)+1j*sin(pi/4) cos(-pi/4)+1j*sin(-pi/4)... |
function [w,Phi] = shear_building_2DOF(m1,m2,k1,k2)
%% two-degree-of-freedom shear building model
%{
---------------------------------------------------------------------------
Created by:
Felipe Uribe
felipe.uribe@tum.de
Engineering Risk Analysis Group
Technische Universitat Munchen
www.era.bgu.tum.de
-------------... |
function [Ret, positions,netvalue,pnl,action,OptLambda] = InSampleTest4LogPrice(p,Step,Start,End,SI)
%InSampleTest4LogPrice Summary of this function goes here
% Detailed explanation goes here
% In
% p,spread,Step,Start,End
%
% Out
% postions,netvalue,pnl,action,OptLambda
%
%%%%%%%%%
xplot=[1:... |
function scamp()
% scamp = Sleep and Circadian Analysis MATLAB Program
%%(C)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) Leslie Griffith Lab, Brandeis University. %%
% Written primarily by Christopher G. Vecsey and Eugene Z. Kim. %%
% Use and distribution of this software ... |
%% douglas CO2 and gustavo O2 content merge
close all;
clear all;
clc;
%% Input parameters
% goed kijken naar eenheden, als je mmHg en [g/dl] hebt dan hieronder,
% anders omrekenen via omzet formules
%apCO2 = 29.8; %partial pressure CO2 [mmHg]
%apO2 = 70;
%aHb = 16.1; % concentration Hb [g/dl]
apHpl = 7.5; %pH in... |
function success = uq_PCK_calculate_coefficients(module)
% coefficients = UQ_PCK_CALCULATE_COEFFICIENTS: uqlab entry point to the
% calculation of the PCK coefficients. It results in a Kriging model with
% polynomial trend and a set of indices, such that the regular
% uq_Kriging_eval can be used for prediction
success... |
classdef Box
%SIDEMATRIX Summary of this class goes here
% Detailed explanation goes here
properties
sideMatrix;
end
methods
function obj = Box(x_Side_Initial, y_Side_Initial, boxHeight, boxLenght, boxOrientation)
if boxOrientation < 0
boxOrie... |
function output = sigmoid( inX ),
temp = (1 / (1 + (e^-inX)));
if( temp >= .5 ),
output = 1;
else
output = 0;
end
end
|
function imgout = localhistmatch(img1,img2)
%LCOALHISTMATCH Performs histmatch on subimages and stitches the image back
%together
% INPUT-
% img1 - reference image
% img2 - image requiring matching
% cornermat - Matrix of indices for creating the subimages
cornermat = [ 1,1,213,235;
4... |
img_1 = 0;
gen_video_1(img_1, 'video_fcount_1080p_', 1, 30);
gen_video_1(img_1, 'video_fcount_1080p_', 1, 60);
|
function [ res ] = my_power( x, m )
%Fast exponentiation via log 2 factors extraction.
if m == 0;
res=1;
return
elseif m == 1;
res=x;
return;
end
i=0;
exp=[];
j=1;
res=1;
p=0;
if m<0
p=1;
m=m*-1;
end
temp=m;
%Extract binary vector
while temp~=0;
if mod(temp,2) == 1... |
% participants
% file_list = dir('D:\MaggiesFarm\2019_04_17_MF_dev_explore\data_analysis\');
% part_num = [];
% for part_n = 1:size(file_list,1)
% if strcmp(file_list(part_n).name(1),'p')
% if str2num(file_list(part_n).name(6:8)) < 800
% part_num(end+1) = str2num(file_list(part_n).name(6... |
function SetInterfaceObj(obj)
% Set byte transmission order, static private method
%
% Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences
% mail4ywu@gmail.com/mail4ywu@icloud.com
end |
clc
close all
clear all
% filename = 'acoustic.wav';
% filename = 'harpsi-cs.wav';
% filename = 'trumpet.wav';
filename = 'jazztrio.wav';
% filename = 'marimba.wav';
[x, fs] = audioread(filename);
x = mean(x,2);
lenX = length(x);
n = (0:lenX-1)';
tauA = 40e-3;
tauR = 2e-3;
Q = 0.2;
% min_fc = 500;
% max_fc = 3000;
m... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% rheol.m
%
% Laurent Montesi, 11/17/2014
% Tools for manipulating strength profiles
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load planet data
load planet
% load rock data
load rock
% Some constant
Celsius=273.15;
% Define ... |
function printpackin(packstruct, indvec)
fprintf('Item: Cost: Price: Code:);
for i=1:length(packstruct)
fprintf('%d, %.2f, %.2f, %c\n', packstruct(indvec(i)).item,packstruct(indvec(i)).cost,packstruct(indvec(i)).price,packstruct(indvec(i)).code);
end
end
function outvec=indvec(vec)
outvec=1:length(vec)
for i=... |
function [positions, rect_results, time] = tracker(video_path, img_files, pos, target_sz, ...
padding, kernel, lambda, output_sigma_factor, interp_factor, cell_size, features, show_visualization)
temp = load('w2crs');
w2c = temp.w2crs;
%if the target is large, lower the resolution, we don't need that much de... |
function [ g ] = Discriminant_Function1( x, m, c)
g = -0.5*( log( det(c+0.0000001*(eye(size(c)))) ) / log( exp(1) ) ) -0.5*(x-m)*( inv(c+0.0000001*(eye(size(c)))) )*(x-m)';
%g = -0.5*( log( det(c) ) / log( exp(1) ) ) -0.5*(x-m)*( inv(c) )*(x-m)';
|
function pdfcrop(h,hborder,vborder)
%Make the paper size, the same as the figure size, (plus an optional
%border). This is important when exporting figures to pdf for inclusion in
%latex for example.
%
%h is the handle to the current figure and is returned by the matlab figure
%command as in 'h = figure;' when a... |
function MaleWISEJCS081020191911 = importJCS(filename, dataLines)
%IMPORTFILE1 Import data from a text file
% MALEWISEJCS081020191911 = IMPORTFILE1(FILENAME) reads data from text
% file FILENAME for the default selection. Returns the numeric data.
%
% MALEWISEJCS081020191911 = IMPORTFILE1(FILE, DATALINES) reads dat... |
function reMkdir(fold)
% Re-make directory.
%
% Input
% fold - name
%
% History
% create - Feng Zhou (zhfe99@gmail.com), 07-08-2013
% modify - Feng Zhou (zhfe99@gmail.com), 07-08-2013
% delete fold
if exist(fold, 'dir')
rmdir(fold, 's');
end
mkdir(fold); |
function c = colorstr2rgb(c)
% Convert a color string to an RGB value.
% This is cribbed from Matlab's whitebg function.
rgbspec = [1 0 0;0 1 0;0 0 1;1 1 1;0 1 1;1 0 1;1 1 0;0 0 0];
cspec = 'rgbwcmyk';
k = find(cspec==c(1));
if isempty(k)
error('MATLAB:InvalidColorString','Unknown color string.');
end... |
function out = Model1augloglikel(cnts, ty, u, eta, sigma, c, tau)
n = sum(cnts);
y = c./(1 + exp(-ty));
out = (n-1)*log(u) - Model1psi(u, eta, sigma, c, tau) - gammaln(n);
out = out + length(cnts)*(log(eta) - gammaln(1-sigma) - log(c));
out = out + sum(gammaln(cnts-sigma) + ...
(tau-sigma).*log(y) + log(c-y) - (cnt... |
#SHADER 101 1006
#PARAM_TEX shaderTexture 101 2000 |
function [SynthData] = gen_synth_trig_image_data(points_3d, lineIndices)
points_3d = [points_3d ; ones(1,size(points_3d,2))];
numLines = size(lineIndices,1);
% line end-points in 3d:
endPoints3d = {};
for j=1:numLines
endPoints3d = [endPoints3d [points_3d(1:3, lineIndices(j,1)) points_3d(1:3,lineIndices(j,2))]];... |
function [t,x,y] = LTVsim(A,B,C,D,tSystem,x0,inputSignal,solver,solverOptions)
% LTVSIM Simulates a linear time variant system with ODE45 or ODE15S.
% This function is used primarily as a utility function for WORSTCASE.
%
% [T,X,Y] = LTVSIM(A,B,C,D,TSYS,X0,INPUT,SOLVER,SOLVEROPTIONS) A
% linearization of the sy... |
function [SRF,noiseSTD] = DAImpulseResponse(awg,chnl,wv_ln,scope,data_ln,numAvg)
% measure da step response function
% Copyright 2017 Yulin Wu, University of Science and Technology of China
% mail4ywu@gmail.com/mail4ywu@icloud.com
SRF = NaN*ones(data_ln,2);
wv = qes.waveform.numeric();
wvdata = zeros(1,wv... |
%WRCOEF2 2 次元のウェーブレット係数から単一ブランチを再構成
%
% WRCOEF2 は、イメージの係数を再構成します。
%
% X = WRCOEF2('type',C,S,'wname',N) は、レベル N におけるウェーブレット分解
% 構造 [C,S] (WAVEDEC2 を参照) に基づき、再構成される係数行列を計算します。
% 'wname' は、ウェーブレット名を示す文字列です。
% 'type' = a の場合、Approximation 係数が再構成されます。
% 'type' = 'h' ('v' または 'd') の場合、水平 (垂直または対角) 方向の
% Det... |
function colors = seaborn_color_palette(name)
sns.deep=["#4C72B0", "#DD8452", "#55A868", "#C44E52", "#8172B3", ...
"#937860", "#DA8BC3", "#8C8C8C", "#CCB974", "#64B5CD"];
sns.deep6=["#4C72B0", "#55A868", "#C44E52", ...
"#8172B3", "#CCB974", "#64B5CD"];
sns.muted=["#4878D0", "#EE854... |
function confusion = confusion_matrix(class_estimate,class_ori)
%CONFUSION_MATRIX
error_sample_00 = find(class_estimate==-1 & class_ori==-1);
error_sample_01 = find(class_estimate==-1 & class_ori== 1);
error_sample_10 = find(class_estimate==1 & class_ori== -1);
error_sample_11 = find(class_estimate==1 & class_ori== 1);... |
function [output,values_for_csv] = histograms(roi_vals_vis1, roi_vals_vis2, modality_name, modality_units)
%% script to extract voxel ROI data from Mirada output
% Daniel Bulte, IBME, University of Oxford, December 2020
% edited by Ambre Bertrand, February 2021
% use this version as part of the registration pipeline
... |
%% CEST EVAL
% MODIFIED FROM CEST_EVAL toolbox:
% Date: 2016/02/10
% Version for CEST-sources.de
% Authors: Moritz Zaiss - m.zaiss@dkfz.de , Johannes Windschuh
% Divison of Medical Physics in Radiology
% German Cancer Research Center (DKFZ), Heidelberg Germany, http://www.dkfz.de/en/index.html
% CEST sou... |
%% parameters
idxVec = [1:7];
for idx = idxVec
sid = SIDS{idx};
switch(sid)
case 'd5cd55'
stims = [54 62];
block = 'Block-49';
bads = [1 49 58 59];
case 'c91479'
block = 'BetaPhase-14';
stims =... |
close all
clear all
path = '/home/local/carltonx/Documents/Smear_course/Data_to_Mette/';
files=dir(path);
name= extractfield(files, 'name')';
numfiles=length(files);
for k = 1:numfiles
myfilename = sprintf('file%d.txt', k);
mydata{k} = importdata(myfilename);
end
%file=load(['/home/local/carltonx/Documents/Sme... |
function [ st ] = Detect( I, model,opts )
%DETECT �˴���ʾ�йش˺����ժҪ
% �˴���ʾ��ϸ˵��
MLearners = model.ml;
MWeights = model.mw;
radius = opts.radius;
patchSiz = radius * 2 + 1;
nCells = opts.nCells;
sz = size( I );
M = edge( I(:,:,1), 'canny');
M([1:2 * radius end- 2 * radius:en... |
% clc;clear all;
% n=30;
% d = 5*rand(n,1); % The diagonal values
% t = triu(bsxfun(@min,d,d.').*rand(n),1); % The upper trianglar random values
% M = diag(d)+t+t.' % Put them together in a symmetric matrix
%
A0=eye(n); % Initial A_0
%
% A=[];
% for i=1:n
% d = 5*rand(n,1); % The diagonal values
% t = tri... |
%naturalimages=importdata('NaturalImages_rgb.mat');
% standard deviation as feature
[m,n]=size(spamimages);
for i=1:n
image=cell2mat(spamimages(1,i));
image=rgb2gray(image);
f=std2(image);
featureori(i)=f;
end
% save this feature as featureori_modified.mat
|
function [result,R,Rnew] = sag(time, data, episodes, firstI, deltaI,visible)
%===============================================================================
%SAG Measures the voltage sag parameters for each trace in a
% current-clamp IV.
% Returns the Vrest, Vsag, Vsteady, Vsag-Vsteady difference, and
% an index ... |
function Save_intermiediate_results(CFG, DATA)
intermediate_results_root = [CFG.general.data_folder_name, 'Intermediate_results\'];
if ~exist(intermediate_results_root, 'dir')
mkdir(intermediate_results_root)
end
save([intermediate_results_root, 'CFG.mat'], 'CFG')
save([intermediate_results_root, 'DATA.mat'], 'DA... |
%THIS PROGRAM EXTRACTS THE BOUNDARY FROM ANY GIVEN FRAME
%THIS IS CURRENTL MEANT TO WORK ONLY TO WORK ON ONE PAW AND ONE SIDE
%BOUNDARY AND CAN EXTRACT
%INCOMPLETE BACKGROUND EXTRACTION
%%
clc
clear all
close all
load Cropcor
file_names_clip = dir('C:\Users\Abhinav Sharma\Documents\Carnegie Mellon Research\CMU Lab... |
function d = DpiDVj(i,j, V, G, B, delta)
soma = 0;
delta = [0; delta];
% for n=1:size(G,2)
% if n~=i
% soma = soma + (G(i,n)*cos(delta(i)-delta(n))+B(i,n)*sin(delta(i)-delta(n)));
% end
% end
n = j;
soma = (G(i,n)*cos(delta(i)-delta(n))+B(i,n)*sin(delta(i)-delta(n)));
d = V(i)*soma; |
function RUN_Step5_ROI(filename, options)
% ROI sets must be saved as the name of the ome.tif it corresponds to
addpath(filename.folders.main)
mkdir([filename.folders.main filename.folders.output filename.folders.ROI]);
%% Creating structure of ROIs
for i2= 1:length(filename.folders.fols) %Looping through each ... |
function print_db( weather )
fprintf('Day | Temp | rain | humidity | wind\n');
fprintf('=======================================\n');
for i=1:length(weather);
% fprintf('%4d', Day(i), '\n');
% fprintf('%6d', temp(i), '\n');
% fprintf('%6d', rain(i), '\n');
% fprintf('%10d', humidity(i), '\n');
% fpri... |
function couplingData = getCouplingDataForNeurons(spikes, numOfBaseVectors, couplingBaseVectors)
numOfNeurons = length(spikes);
for i = 1:numOfNeurons
couplingData(i).couplingDesignMatrix = buildSpikeHistoryDesignMatrix(numOfBaseVectors,...
co... |
function SelectedPath=subfnPrintFSResults(SelectedPath,alpha,fid)
% write Fressurfer results to tables
switch nargin
case 2
fid = 1;
case 1
alpha = 0.05;
fid = 1;
case 0
SelectedPath = spm_select(1,'dir');
alpha = 0.05;
fid = 1;
end
cd(SelectedPath)
if exist(... |
function result=GetTimeStamp(Txant,RxAnt,subc,CSIData)
result=CSIData.timestamp_low;
end |
function [energy_linear,linearized_image]=linearize_image(image1,energy_scale)
linearized_image=zeros(size(image1));
linearized_count=zeros(size(image1));
image_size=size(image1);
horizsize=image_size(2);
vertsize=image_size(1);
energy_linear=linspace(energy_scale(1),energy_scale(end),length(energy_scale));
%constru... |
%% PVST with tariff model, 2015-2016, 2016-2017, 2017-2018
tic
clc
clear all
%% load price and PV generation ,and load
load DApricethreeyear
load Bornholm
load DAprice_2018
load PV_2018
load load_withHP
load load_withoutHP
% load tenwithandwithoutHPs
%% system setting
T=24; % optimization horizon
DAoneyear=DA2015; % Da... |
function displayROISonPicture(handles)
%DISPLAYROISONPICTURE Summary of this function goes here
% Denne funktion sørger for, at når der tegnet en ROI på et af billederne i
% et snit, så følger ROIen med når der skiftes billede (ekkotid) på slideren.
%
% INPUT:
% handles: handle til elementer i gui
%
% ... |
function [pilx,pily]=vekplot2(x,y,u,v,scale,line,mark,fillcolor)
% VEKPLOT2 - plot vectors as arrows
% [pilx,pily]=vekplot2(x,y,u,v,scale,line,mark,fillcolor)
%
% This function is essentially the same as quiver, but in VEKPLOT2 the
% scale is known so that plotting two vector-fields on top of each other
% for compar... |
classdef EKF3DConstMomentum < handle
properties
delta_t
K
Q
R
f
Phi
h
H
end
methods
function obj = EKF3DConstMomentum(delta_t, inertia, Q, R)
% State vector: [q1 q2, q3, q4, omega1, omega2, omega3]
% measurement... |
function [] = drawlog(theta)
% Define the ranges of the grid
u = linspace(-1, 1.5, 200);
v = linspace(-1, 1.5, 200);
% Initialize space for the values to be plotted
z = zeros(length(u), length(v));
% Evaluate z = theta*x over the grid
for i = 1:length(u)
for j = 1:length(v)
% Notice the ... |
function [mathSignal] = generateMathChannel(rawSignal, processedSignal, handles)
%applyMathChannel applies the operations specified in the math data panel
%to the given signal.
dataPlus = get(handles.mathData_DataPlus, 'Value');
dataMinus = get(handles.mathData_DataMinus, 'Value');
if dataPlus == 1 && dataMinus =... |
function [f, df, p, ch] = fitEchoNonlinear(phas, mag, TEs, tol, maxit, teUnwrap, verbose)
%FITECHONONLINEAR Non-linear fit for multi-echo data.
% Gauss-Newton algorithm to fit multi-echo phase data. A weighted linear fit
% is used as initial guess.
%
% [f, df, p, ch] =
% FITECHONONLINEAR(phas, [mag], [TEs],... |
function vec = makerow( vec )
% convert vector to row vector
% leave size == [1 0] alone too
if(size(vec, 1) > size(vec,2) && isvector(vec)) && ~(size(vec, 2) == 0 && size(vec, 1) == 1)
vec = vec';
end
if size(vec, 1) == 0 && size(vec, 2) == 1
vec = vec';
end
end
|
classdef LONG_roiextraction
%LONG_roiextraction roi extraction values
% store name, value and ROI extraction type for longitudinal data
properties
Pathtoroi
Pidn
Timepoint
end
properties (Dependent)
Extraction
Roiname
end
metho... |
function [interim_latent, kernel] = blind_deconv(y, truthImg, Mask, opts)
%%
%---------------Pre-processing --------------------%
if (size(y, 3) == 3)
y = rgb2gray(y);
end;
if (size(truthImg,3)==3)
truthImg = rgb2gray(truthImg);
end
y = im2double(y);
truthImg = im2double(truthImg);
%---------------e... |
function neuronParameters = learnModelsParameters(neuronsInNetwork)
load('stimulusDesignMatrix');
load('globalParams');
load('stimlusFilters');
load('spikes');
load('postSpikeHistory');
load('couplingBaseVectors');
load('spikes');
load('stimlusFilters');
load('stimulus');
numOfN... |
clear all;
close all;
%% Load the synthetic signal
load Signal.mat
Fs=200; %% Sampling Frequency
Ts=1/Fs; %% Sampling Period
t=0:Ts:2;
t=t';
%% Plot the signal
figure
plot(t,x)
xlabel('Time (s)')
ylabel('Amplitude')
ylim([-1.5 1.5])
%% perform STFT
win_len=0.3; %% default setting for window length;
... |
function [ResultStruct, ResultStructBW]=Blind_Deblur(CDataSetInfo, Param)
%%%Doc Starts%%%
%-Description:
%This method is to delur image using blind deconvolution.
%-Parameters:
%1. Size: The size of the initial guss INITPSF. Assume INITPSF has the same size in X, Y, Z dimension.
%-Formula:
%Matlab buil... |
% Loïc LERAT 1920881
% Simon-Pierre DESJARDINS 1739351
%% Nettoyage du workspace
clear all;
close all;
clc;
%%
%Partie 2 : Détection des extremas et descripteurs
imageGauche = rgb2gray(imread('gauche.jpg'));
imageDroite = rgb2gray(imread('droite.jpg'));
imageGauche = double(imageGauche)/255;
imageDroite = double(i... |
function boolValue = randBool()
% ثو¼´²ْةْ1/0
if(rand(1) > 0.5)
boolValue = 1;
else
boolValue = 0;
end
end |
function [ waveout, tstep, tlist, err, errmsg ] = bnrzmod(seqin, BitRate, SamplesPerBit, Ramp)
% amimod modulates the input sequence and generates analog waveforms
% the modulation is binary NRZ, differential
% input variables
% seqin (logical) , row vector): prbs sequence of length n (n>1)
% BitRate (d... |
function [c,ceq,gradc,gradceq] = grf_nonlcon(x,q,p)
%% add the last column
x0 = p.mapA*x(:,1)-p.mapB;
x = [x,x0];
%%
[c1,ceq3,gradc1,gradceq3]=grf_cons_d(x,p);
c = [c1;c2];
gradc=[gradc1,gradc2];
ceq=[ceq1;ceq2;ceq3;ceq4];
gradceq=[gradceq1,gradceq2,gradceq3,gradceq4];
% the gradient of the la... |
%% Set up constants
END_COLOR = 2; %Green: 3, Blue: 2, Red: 5%
COLOR_PORT = 1;
ULTRASONIC_PORT = 2;
ULTRASONIC_LEFT_PORT = 4;
GYRO_PORT = 4;
TOUCH_PORT = 3;
SPEED = 60;
%% Set up sensors
brick.SetColorMode(COLOR_PORT, 2); %Maybe change to Color RGB: 4 instead of Color Code: 2 to get more accurate reading
brick.GyroCal... |
function [candidate] = moveCluster(lat,coordinates)
% $Rev: 782 $
% $Author: qiangz $
% $Date: 2014-12-02 00:34:59 +0400 (Tue, 02 Dec 2014) $
% this function centers the cluster in the middle of the cell
% we also put the center of mass into [0.5, 0.5, 0.5]
% first we have to center the cluster, sometimes it is divide... |
function dim = size(this)
dim = this.dim * this.scale; |
% SCOPO FUNZIONE: Funzione di calcolo della direzione della sorgente sonora
% rispetto all'evento.
%
% PARAMETRI INPUT:
% - file_ep: matrice con solo l'evento sonoro individuato.
% - Fs: frequenza campionamento file sonoro.
%
% PARAMETRI OUTPUT:
% ... |
%% allign net stacks
%% net stack visualisation
%AU_net=( sum(AU) ./ max(sum(AU))) ;
%JP_net=(sum(JP)./max(sum(JP)));
%NI_net=(sum(MN)./max(sum(MN)));
%%KR_net=(sum(KR)./max(sum(KR)));
%AU=importdata('beam_0.2_5Hz_AU_full.txt');
%MN=importdata('beam_0.2_5Hz_NI_full.txt');
%JP=importdata('beam_0.2_5Hz_JP_full.txt');
cl... |
function [] = plotRecognition(firstRat, lastRat, folderName)
% analyze recognition
% input:
% firstRat: first rat that was run (usually 1)
% lastRat: last rat that was run. The range of these two rats are what
% will be plotted
% folderName: name of folder that the sessions for these rats can be
% f... |
clear; close all; startup;
% Mesh domain
[x1G,x2G] = meshgrid(linspace(0,10,101),linspace(0,5,51));
%% Define true function
fG = sin(x1G)+sin(x2G);
% fG = (x1G/2).^2;
% fG = sin(x1G)-sin(x2G);
% fG = x1G.^2-x2G.^3;
% fG = sin(x1G).*sin(x2G);
%% Noise in the measurements
% sigman = eps;
% sigman = .25;
% sigman = .05... |
clear; close all;
x0 = 0.1;
y0 = 2;
x1 = x0;
x2 = 30;
y1 = 1;
y2 = 40;
k1 = 0.25;
k2 = 0.4;
dk1 = 0.0025;
dk2 = 0.004;
dx0 = 0.001;
dy0 = 0.001;
s1 = 0.1;
s2 = 0.1;
%p(0.1, x1, x2, y1, y2, s1, s2, x0, y0, k1, k2, dx0, dy0, dk1, dk2)
function ret = g(y, y0, s2)
if(any(size(y)~=size(y0)) || any(size(y)~=size(s2)))... |
% extend SRLM over the subiculum
% This portion of the code was used in the original publication, but future
% work will define the (dummy label) SRLM over subiculum separately.
%% if left, flip
LR = output(strfind(output,'hemi-')+5);
if LR=='L'% && origheader.hdr.dime.pixdim(1)==1
labelmap = flipdim(labelmap,1);... |
%% MMSP2 - Lab 4
% Exercise 3 - Vocoder with voiced/unvoiced classification
clear
close all
clc
%% 1) Load the files 'a.wav' and 'shh.wav' and build a single signal
% concatenating them
[s_a,Fs] = audioread('a.wav');
s_shh = audioread('shh.wav');
s = [s_a;s_shh]; %i samples li metto consecutivi in un'unica colonna... |
function [numBlk, stat] = blinkcount(EOG, sr, display)
%BLINKCOUNT counts eye blinks in the EOG data. When set 'on' to display
%variable, a figure is plotted to denote all the eye blinks found in the
%data.
%Change log:
% Add one more output, 11/21/2015, Zhang Liang.
% Structurize the output into a structure varia... |
function [inputTrackingVideo] = createTrackingOverlayVideo(inputTrackingVideo,inputX,inputY,varargin)
% Takes tracking data and makes an overlay on a behavioral movie.
% Biafra Ahanonu
% started: 2014.01.03 [19:13:01]
% inputs
% inputTrackingVideo - [x y frames] movie or path to AVI file
% inputX - [1 frames] v... |
function [training,testing] = extract_windows_epochs_new(timeInfo,varargin)
inputs = parse_my_inputs(timeInfo,varargin{:});
%% TRAINING DATASET
nClass = numel(timeInfo.training);
% create training features
for iClass = 1:nClass
try
timeInterest = timeInfo.training{iClass}.timeInterval(1)+inputs.ws:timeIn... |
function x = normProbDensFun(x)
%PROBDENSFUN This function returns the reltive likelihood
% For the variable to take on a give on a certain value
% exp(1) is euler's number. The formula is slightly butchered,
% since normally you calculate ((x-mu)/sigma)^2 instead
% x^2, but simga is always 1 and mu is always 0 in our... |
function MODEL = minCPepModel()
MODEL.DESCRIPTION = 'Minimal CPeptide model by Dalla Man et. al';
MODEL.PREDICTOR = {
't' [0 240] {'time' 'min' 'time'}
};
MODEL.CONSTANTS = {
'BW' 'BW' {}
'Gb' 'G' {}
'CPb' 'CP' {}
'Ib' 'I' {}
};
MODEL.INPUTS = {
'G' 'Data' {'G'} 'Linear' {}
'd... |
g = 9.81;
r0 = 5;
r1 = 10;
alpha = 0.9;
K = [-100 -100 -100 -10];
a0 = 0.01 ;
a1 = 1 ;
a2 = 1000 ;
a3 = 1000 ;
a4 = 10;
bar_B = [
g 0;
0 -g
];
N = 100;
kappa = 5;
%% Initial conditions
set = 4;
switch set
case 1
% first set
x0 = 1;
y0 = 1;
z0 = 1;
theta0 = pi/6;
psi0 = pi/6;... |
classdef StiffnessMatrixComputer < handle
properties (Access = public)
K
end
properties (Access = private)
numberofElements
nNodesperBar
DOFperNode
nodalConnectionMatrix
nodeCoordinatesMatrix
materialMatrix
materialAssignMatrix... |
function [Times,errors]=flowError(flow,flowAprox,Time)
flowSizeHalf= size(flow,1)/2
flowSize= size(flow,1)
%real
for i=1:size(flow,2)
[RMF,RIF]=max(abs(flow(1:flowSizeHalf,i)));
[RMS,RIS]=max(abs(flow(flowSizeHalf+1:flowSize,i)));
IndexesR(i,:)=[RIF RIS+flowSizeHalf];
end
%aprox
for i=1:size(flowAp... |
function [m, sem, n] = meanAndSEM(x)
% @ Matt Golub, 2018.
x = x(:);
m = nanmean(x);
n = sum(~isnan(x));
sem = nanstd(x,1)/sqrt(n); |
function [gamma_opt, val, val_opf] = fw_attack_20150124(m, verbose)
% m is a struct with the following fields:
%
% mpc - (string) the filename of a MATPOWER case
% subset - an array of line numbers to consider for attack
% obj_type - one of 'magnitude' or 'angle'
% Lnorm - one of {inf, 1, 2}
% gamma_max - the maximum ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.