text stringlengths 8 6.12M |
|---|
function Options=setParameters(sq)
Options=struct();
Options.Verbose=false;
% Framework Parameters
Options.numFrameAhead = 3;
% Local EMD Matching Parameters
Options.candiRadius=20;
Options.bodyRatio=0.75;
Options.BoundThresh=5;
% Global EMD Matching Parameters
Options.searchDepth = min([3,Options.numFrameAhea... |
%Êý¾Ý
function f = problem_1_2(p)
% source_val = [20 20];%A B
% source_a = [5 2];%A BµÄpos_a
% source_b = [1 7];%pos_b
% syms x y
x = p(1);
y = p(2);
pos_a = [1.25 8.75 0.5 5.75 3 7.25];
pos_b = [1.25 0.75 4.75 5 6.5 7.25];
d = [3 5 4 7 6 11];
% sqrt((x - pos_a).^2 + (y - pos_b).^2)
dis = sqrt((x - pos_a).^2 + (y ... |
function coords = getLinSpacedPointsOnCircle(n, radius, degOffset)
% Angles at which our stimuli's centers will be. We start at degOffset
% and then equally space points around the edge of a circle
anglesDeg = linspace(0+degOffset, 360+degOffset, n+1);
%Delete last (duplicate) point
anglesDeg(end)=[];
%Convert to... |
function [Cost] = constrainedtsp(dtMatrix,Limit)
%
% [Cost] = constrainedtsp(Weights,Limit)
%
% A function for finding a feasible solution
% of the constrained TSP, with constraint on path length.
% The solution may or may not be optimum.
%
% Cost returns the cost of the minimum tour
% and the minimum tour except the... |
% heatmesh.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A script to extract the gridearch csv data file
% and plot a heatmap.
% x = 1:3;
% y = 1:3;
% z = linspace(3,9,3);
%
% [xgrid, ygrid, zgrid] = meshgrid(x,y,z);
% xgrid;
% ygrid;
% zgrid;
% Import table. Drop first column and row.
table = csvread('lowpt_2jet.csv',1,1);
nbi... |
%3AFC to determine phase difference detectable at different AM rates
clear all; close all hidden; clc; %#ok<CLALL>
path = '../CommonExperiment';
p = genpath(path);
addpath(p);
subj = input('Please subject ID:', 's');
file_load = input('File name for last block to load, type NONE if starting from 1st block:'... |
% [RTs regionlength regionwidth y] = ...
% movingwindow(mainwindow, fgcolor, bgcolor, stimulus,centerMultipleLines, widespacing, font)
%
% Performs a self-paced moving window reading task on window MAINWINDOW
% with text color FGCOLOR on background color BGCOLOR.
%
% Text string STIMULUS is displayed one region... |
function [PP_CFG, PP_DATA] = EB2_postprocessing_config(PP_CFG, PP_DATA, CFG, DATA, test_idx)
PP_CFG.tests{test_idx}.key_factor_name = 'EB2_Error_npix'; |
function [ p_list_warped ] = point_warping(M, p_list )
%M- warping matrix between frames
%p_list-point list
%[x1,y1:
% x2,y2;
% : :]
[h,~]=size(p_list);
p_list=[p_list';ones(1,h)];
p_list_warped = inv(M)*p_list;
p_list_warped = p_list_warped(1:2,:);
p_list_warped = p_list_warped';
end
|
function LORs_output = process_a_raw_file(filename_f)
%PROCESS_A_RAW_FILE Summary of this function goes here
% Detailed explanation goes here
load(filename_f)
%% Decode a detector
[gpos_A,e_A,pID_A,cID_global_A,t_A,em_A] = panelProcessor(coincidence_data_pool(1:16,:));
[gpos_B,e_B,pID_B,cID_global_B,t_B,em_B] = panel... |
function [rpeAuto rpeMult] = segmentRPELin(bscan, PARAMS, medline)
% SEGMENTRPELINAUTO Segments the RPELIN from a BScan. Intended for the use on
% circular OCT-Bscans
% RPELINAUTO = segmentRPELINAuto(BSCAN)
% RPELINAUTO: Automated segmentation of the RPELIN
% BSCAN: Unnormed BScan image
% PARAMS: Parameter struct fo... |
function stdev = calculateStandardDeviation(labels)
% high standard deviation = low purity
if numel(unique(string(labels.label))) == 1
stdev = 0;
return;
else
stdev = std(cell2mat(labels.label));
end
end |
function [a, ae, rs, rsd, rn] = getML_LIPModelroc99asso(Monk, recompute)
% fit LIP roc areas at 99.9% coh to a piecewise-linear model
% (early training sessions with only 99% coh)
savepath = ['/work/mirror_jeff/code/matlab/tmp-mat/getML_LIPModelroc99asso_' Monk '.mat'];
if recompute
a = getML_txt([Monk 'TRai... |
function [ output_args ] = dilationAndViscosityEffectsFlow( input_args )
%________________________________________________________________________________________________________________________
% Written by W. Davis Haselden
% M.D./Ph.D. Candidate, Department of Neuroscience
% The Pennsylvania State University & H... |
function g = AccuG( lati,h )
%使用1930年国际重力公式计算重力加速度g
%20170322Salamander
%输入:lati 纬度 单位 弧度
% h 高 单位 米
%输出单位:米/s^2
g=9.78049*(1+0.005288*sin(lati)^2-0.000006*sin(2*lati)^2-0.0003086*h/1000);
end
|
% Autor: Erik Zamora G�mez
% Fecha 31/07/2015
% Este c�digo es distribuido bajo la licencia CC BY-NC-SA
clear all, close all, clc
R=csvread('datosSeno.csv')
X=R(:,1)
Y=R(:,2)
P=[0,0;
0,1;
1,0;
1,1]
T=[0,1,1,0]'
P=X;
T=Y;
Q = size(P,1);
red = [size(P,2),30,40,size(T,2)]
% Valores iniciales
... |
function [TestThreeRate,TestSetIndexes] = FindTestRate(TestSet)
[satir , column] = size(TestSet);
data=zeros(1,1);
TestSetIndexes=zeros(1,1);
for i=1:satir
count=0;
j=1;
while count<4 && j<column
if(TestSet(i,j)~=-1 && count<3)
count=count+1;
data(i,count)=TestSet(i,j);
... |
% mps_template: creates template for use with snesim;
%
% Call
% [template]=mps_template(n_max,n_dim,method,do_plot);
%
% IN:
% n_max=16; % max 16 conditioning data (def=4);
% n_dim=2; % 1D/2D/3D (def=2)
% method = 1; % suing n_max pints closest to center
% = 2; % mixed point cross
% = 3; % mi... |
function isLoopClosed = isLoopClosed(track, state,varargin)
if ~isempty(varargin)
error = varargin{1};
else
error = .5;
end
if sum(abs(state(1:2,end) - track.xy(:,1))) < error
isLoopClosed = true;
else
isLoopClosed = false;
end |
% function computing the precision associated with 2 observed frequencies coming from two different models
function precision = getPrecision(seqObs1, seqObs2, hmm1, hmm2)
logprob11 = zeros(size(seqObs1,1),1);
logprob12 = zeros(size(seqObs1,1),1);
logprob21 = zeros(size(seqObs1,1),1);
logprob22 = zeros(size(seqObs1,1),1... |
% Returns a linear system of equations given cameras and projections
%
% Parameters:
% cameras -- 3 x 4 x F
% track
% frames -- m x 1 vector of frame indices
% points -- m x 2 vector of observations
%
% Returns:
% Q -- 2m x 3F sparse matrix
% q -- 2m x 1 vector
% Q x = q defines the projection constraints
functi... |
function dBIC = deltaBIC(A,B,lamda)
% H0: hypothesis that A and B will be modelled best by 1 Gaussian
% H1: hypothesis that A and B will be modelled best by 2 separate Gaussians
d = size(A,2);
if (isempty(lamda))
lamda = 00;
end
n = size(A,1);
m = size(B,1);
fused = [A;B];
... |
%{
-> obj.Dec
---
auc_total :longblob #area under the curve [classes reps]
auc :longblob #area under the curve [classes reps neurons]
%}
classdef Contribution < dj.Computed
properties
keySource = obj.Dec
end
methods(Access=protected)
... |
function [latpar,simpar,slspinfo,icntinfo,clusterinfo,solset,ffo,grapho] = pi3d()
%% INFORMATION
% V.1.39.a.1. FUNCTION NAME: pi3d(). start: 06092013
% V.2.003D_REVISION_01:FUNCTION NAME:procureinputs3D:start:09082013
%% LATTICE PARAMETERS
% CELL BLOCK OUTPUT VARIABLE(s): latpar{:,:}
latticenumber = 01;
if latticenumbe... |
function [ norm_data, max_val, min_val ] = normalize_me_python(data)
%==========================================
%Author: Uladzislau Barayeu
%Github: @UladzislauBarayeu
%Email: uladzislau.barayeu@ist.ac.at
%==========================================
max_val=max(max(max(data)));
min_val=min(min(min(data)));
... |
close all; clear all
addMyPath;
fprintf('Compiling pitch2waveMex.cpp...\n');
mex pitch2waveMex.cpp \users\jang\c\lib\audio\audio.cpp \users\jang\c\lib\utility\utility.cpp \users\jang\c\lib\wave\waveRead4pda.cpp -I/users/jang/c/lib -I/users/jang/c/lib/audio -I/users/jang/c/lib/utility -I/users/jang/c/lib/wave
pv=[NaN;4... |
function Z = mkzmat( rb, re, a, freq, mu, eps, fpsi )
% Z = mkzmat( rb, re, a, freq, mu, eps, fpsi )
%
% Populates the moment/impedance matrix for a wire, piecewise constant
% expansion and pulse testing. (See mktriss for how to convert to Galerkin)
% rb, re - wire segment beginnings and ends, n-by-3
% a ... |
% AUTOCOV Gray-level autocovariance coefficients.
% [X,FEAT] = AUTOCOV(I,BW) computes 24 the autocovariance coefficients
% from the gray-level image I masked by the binary image BW. X is a numeric
% vector with the feature values and FEATS is a cell vector with the name of
% the features in the same order as... |
function draw_robot(q,L)
figure;
hold on
view(200,25)
grid on
axis equal
T1=Rz(q(1))*Tz(L(1));
plot3(0,0,0,'ro','MarkerSize',10,'LineWidth', 10);
plot3([0 T1(1,4)],[0 T1(2,4)],[0 T1(3,4)],'-b','LineWidth', 5);
T2=Rz(q(1))*Tz(L(1))*Ry(-q(2))*Tx(L(2));
plot3(T1(1,4),T1(2,4),T1(3,4),'ro','MarkerSize',10,'LineWidth', 10)... |
%% Kalman Filter Hedef Takibi Üç Boyut 17/06/2017
clear all; close all; clc;
%% Verilerin Text'ten Okunması
% Konum
fileID1 = fopen('konumuc.txt','r');
x_text = textscan(fileID1,'%s',3,'Delimiter','|');
x = textscan(fileID1,['%f',repmat('%f',[1 2])],'CollectOutput',1);
fclose(fileID1);
konumX = x{1,1};
... |
function scans_to_process = LONG_extractMNItimepointROIs(scans_to_process, pathtoROIs, timepoint)
%LONG_extractMNItimepointROI - extract ROIs and add to scans_to_process
%structure
%
% Syntax: scans_to_process = LONG_extractMNItimepointROIs(scans_to_process, pathtoROIs, timepoint)
%
% Inputs: scans_to_process - arra... |
function signature = binarisation(signature1,seuil)
signature = (signature1>seuil);
end
|
function f=jm99afun(n)
%99年中国大学生数学建模竞赛a题:自动化车床问题一函数
%参见《数学的实践与认识》2000.1.p36-40
mu=600*0.95;sig=196.6292*0.95;
L=100*n(1)+3005;
L=L*normcdf(n(2)-n(1)/2,mu,sig);
t=0:0.1:(n(2)-n(1)/2);
L=L+10/n(1)*trapz(t,t.*normpdf(t,mu,sig));
c=200*n(2)+10*n(2)/n(1)+3000;
L=L+c*(normcdf(n(2),mu,sig)-normcdf(n(2)-n(1)/2,mu,sig)... |
function [err] = relError(xEs, xApp)
% RELERROR computes the relative error.
% E = RELERROR(XE,XA) return the relative error given the exact solution
% XE and the approximated solution XA.
err = norm(xEs - xApp)/norm(xEs);
end |
%% Fine eye movements and different types
% Note that this is done at high spatial (2 sec) and temoral (10 ms)
% resolution. So it takes a while to run.
%
% It would be very nice to figure out a way to run this using parfor
%
disp('**** EI Fine Eye Movement')
% Can be changed without recomputing everything
nTrials ... |
% tideFFEdge
%
% Prediction of the next tidal edge using a Multilayer Perceptron.
%
% Author: Tommaso Papini,
% Last modified: 20th March 2013, 17:04 CET.
%PARAMETERS
cycle = 28*24; % tidal cycle duration (28 days) in hours
int = 1; % tide observation intervals in hours
sample1 = 10000; % tidal heights observed... |
function [a0, a1, r2] = cf_nonlinfit(ord, func, Z)
n = size(ord);
n = n(1);
Z0 = zeros(n, 2);
d = zeros(n, 1);
a0 = 30;
a1 = 5;
%initialize to start the while loop
st = 1000;
while st > 1
% to use the values of the z matrix to get output
Z0 = zeros(n, 2);
for i = 1:n
part_func1 = cell2mat(Z(1));
... |
%% test_SoundIO
%
% This script test the input output of a sound card using a pure sine wave.
clear; close all;
%%
io.fs = 192e3;
fs = io.fs;
io.ref_Pa=20e-6;
io.VperPa=0.316;
InitializePsychSound;
pause(1);
io.dur = 2;
%%
devs = PsychPortAudio('GetDevices');
speakerIdx = cellfun(@(X)~isempty(strfind(X,'Speakers (Ly... |
%%=======================================================================%
% This code read the excel files (KDD feature-based) and do the following:
% 1- calculate the probability for protocol, Service, and flags
% 2- replace nominal values into numeric
% 3- generate a numeric CSV file
% 4- read the csv file and nor... |
%Parameters: Function, initX, initY, h, Number of points
%output : Root, vector, message
function [varargout] = RungeKutta(f, initX, initY, h, it)
handle = matlabFunction(evalin(symengine, f));
xi = initX;
yi = initY;
vxy = [xi; yi];
for i=1:it
k... |
function error_entrust_amount = clear_holding( obj, pct, times, ...
competitor_rank, round_interval)
% 每轮委托使其尽量成交
% 进行清仓的函数[最终返回未能平仓的数目和资产,原因]
% error_entrust_amount = clear_holding( obj, pct, times, ...
% competitor_rank, round_interval)
% 输入参数:pct百分比[0~100],times平仓的轮流次数,competitor_rank对手价格档数,round_interval每轮交... |
function pass = uq_SVR_test_ExpDesigns( level )
% Make sure that Kriging works with user defined experimental designs
% regardless of scaling choice
Scaling_choices = [0,1];
fname = 'SVRValTest.mat';
N = 20;
Nval = 500;
eps = 5e-1; % Large error threshold. The idea is just to make sure that the code runs without error ... |
% script for question 1.2.6
clear all;
precisionEst = zeros(6,4,4);
precisionModels = zeros(6,4,4);
NbreSeq = [30 100 200 500];
for nbreLoops=1:4
for i=1:6
for j=1:4
tmp = Q1_2_6_fct(NbreSeq(j), i);
precisionEst(i,j,nbreLoops) = tmp(1);
precisionModels(i,j,nbreLoops) ... |
function [tp,num,ovals] = matchparams(p, req, opt)
% function [tp,num,ovals] = matchparams(p, req, opt)
%
% Mercurial revision hash: $Revision$ $Date$
% Copyright (c) 2010, Eric Tytell <tytell at jhu dot edu>
nd = 0;
for i = 1:length(p),
nd = max(nd,ndims(p{i}));
sz(1:ndims(p{i}),i) = size(p{i})';
end;
for i... |
function [sfun, efun] = anglefns(ri, hi, dr, dh)
global BASE_HEIGHT HUMERUS ULNA;
h = @(r)(dh/dr)*(r-ri)+hi;
s2w_r = @(r)r;
s2w_h = @(r)h(r)-BASE_HEIGHT;
s2w = @(r)( s2w_h(r) * s2w_h(r) ) + ( s2w_r(r) * s2w_r(r) ); % (Length of line from shoulder to wrist (S-W))^2
a1 = @(r) atan2( s2w_h(r),s2w_r... |
function [answ, flag, retQuery] = implementGet(p, quantity, query, varargin)
answ = [ ];
retQuery = query;
flag = true;
switch query
case {'autoexog'}
answ = struct( 'Dynamic', [ ], 'Steady', [ ]);
[~, ~, answ.Dynamic] = model.Pairing.getAutoexog(p.Autoexog.Dynamic, quantity);
[~, ~, answ.... |
function map=fmap(nsl,xres,mapdel);
if(nargin<3)
mapdel=2.5e-3;
end
if(nargin<2)
xres=64;
end
for n=1:nsl
eval(sprintf('tp0mag=readim(''sl%d.000'',[xres xres]);',n));
eval(sprintf('tp0phs=readim(''sl%d.phs.000'',[xres xres])./1000;',n));
eval(sprintf('tp1mag=readim(''sl%d.001'',[xres x... |
%Finding length of Auswertung-struct:
lMLC=length(index);
%%
%find amount, where Raso=NaN or Cloudnet=NaN. This is done by using hmax.
for k=1:lMLC
MLC_hmax(k)=MLC_classification(k).hmax;
MLC_cloudlayers(k)=MLC_classification(k).cloud_layers;
end
%%
%if Hmax=NaN, then Rasofile or Cloudnet at Rasotime is mis... |
function [ isFind loc_a loc_b ] = util_find_a_in_b( a, b, varargin )
%UTIL_FIND_A_IN_B Find whether one element of B equals each element of A
% Looking into all elements of the collection B, to find out if one or
% more elements equals the value of each element in A. If no elements in
% B equals A, then it r... |
clc;
clear all;
close all
sj=xlsread('E:\数学建模\建模论文\2017CUMCM\B\附件一:已结束项目任务数据改1.xls',1,'B2:E836');
i=1;
j=1;
t=1;
a=zeros(5,4);
jd1=113;
jd2=112.6;
% sum=0;
% means=zeros(5,4);
while (i<=5)
w1=22.8;
w2=22.4;
while (j<=4)
while(t<size(sj,1)+1)
if ((sj(t,1)<w1&sj(t,1)>w2&sj(t,2)<jd1... |
function selch(ch)
% select channel in Waveshaper
self_dir = fileparts(mfilename('fullpath'));
wsp_file = sprintf('ch%d.wsp', ch);
fprintf('select channel #%d\n', ch);
cmd = sprintf('python selch.py wsp/%s', wsp_file);
prepwd = pwd;
cd(self_dir);
try_times = 2;
try_num = 1;
while 1
try
... |
function [ Z0, Z, C, B ] = lista_fprop( X, We, S, theta, T )
%LISTA_FPROP Summary of this function goes here
% [ Z0, Z, C, B ] = lista_fprop( X, We, S, theta, T )
% Detailed explanation goes here
B=We*X;
C=zeros(numel(B),T);
Z=zeros(numel(B),T+1);
Z(:,1)=h_theta(B,theta);
for t=1:T
C(:,t)=B+S*Z(:,t);
... |
% =========================================================================
% Part of the Matlab code to accompany the paper
% 'Solving heterogeneous agent models in discrete time with
% many idiosyncratic states by perturbation methods', CEPR Discussion Paper
% DP13071
% by Christian Bayer and Ralph Luetticke
% http:/... |
% set up global variables for the discriminative patch code
% TODO: change code path to where ever there is the SUN_source_code or
% vlfeat code
code_path = '/data/hays_lab/Attributes/SUN_source_code_v2/code/';
addpath(genpath(code_path));
vl_setup('noprefix'); |
function combineDev = combinedDifference_std( D1, D2, thresholdPercentile )
binDev = regionAvgThresholdDifference(D1,D2, thresholdPercentile);
stdDev = standardDifference(D1,D2);
combineDev = binDev .* stdDev;
end
|
function [VfiResult, ExitFlag] = VFI_EXHC_FACTOR(Params)
% Taxing Human Capital
% @Author: Wenlan Luo
% Solve household value function iteration
% with exogenous human capital
% unpack structures
v2struct(Params);
if (r < 0)
VfiResult = [];
ExitFlag = -1;
return;
end
% TauGs should never be used. Write i... |
function [] = coil(args, varargin )
% This function is for calling loopify in parallel. It accepts the same inputs as loopify.m (see 'help loopify'), but instead of running all loops sequentially,
% will call the function in 'execute_fn' using the system function and the cluster-to-matlab-interfacing command specified... |
function X = sqrtm(A)
% Matrix square root.
% (Quaternion overloading of standard Matlab function.)
% Copyright © 2008, 2010 Stephen J. Sangwine and Nicolas Le Bihan.
% See the file : Copyright.m for further details.
X = overloadm(mfilename, A);
% TODO Implement a more accurate dedicated algorithm for this function.... |
function mnf = test_bisearch(p)
low = 1;
high = length(p);
mid = ceil((low+high)/2);
N = length(p);
while ~( sum(p(1:mid)) >= sum(p((mid+1):N)) && sum(p(1:(mid-1))) < sum(p(mid:N)) )
if sum(p(1:mid)) < sum(p((mid+1):N))
low = mid;
else
high = mid;
end
% fi... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2018 Crypto4a Technologies Inc.
%
% Permission is hereby granted, free of charge, to any person obtaining a
% copy of this software and associated documentation files (the "Software"),
% to deal in the Software without restriction,... |
% Detecting and removing blinks. Blink data is replaced with average pre-blink and post-blink data
% DJ V1.0 : September 15, 2016. Use absolute median deviation to detect
% blink duration. Data is smoothed using wind_size variable.
function [t_pupil_new, t_pos_new] = blink_detect_v10 (t_pupil, t_pos, wind_size)
bli... |
function [ R2, M, Y_fit] = anyRegress( X, Y, varargin )
% regress any two signals : predictor and predicted
% use regularization with lambda = reg
% Given that Y = M*X: find the best M and see how well that M predicts Y
% from X
lambda = 10;
getM = true;
regType = 'none';
%% Parse command line for variable arguments... |
function [m_ElemLoc,c_ProyIncrEps] = f_DominioLoc(e_VarEst_new,e_VarEst_old,m_DefLocal,e_DatSet,e_VG)
nSet = e_VG.nSet;
nElem = e_VG.nElem;
ntens = e_VG.ntens;
m_ElemLoc = false(1,nElem);
%Determinación del incremento en la "dirección" de Bxn (tensor)
%Se divide por 2 para la doble contracción... |
classdef ciatah < dynamicprops
% Performs analysis on calcium imaging data. Also performs analysis on behavior (response signals) compared to stimulus or other continuous signals during an imaging session.
% Biafra Ahanonu
% started: 2014.07.31 (2020.10.25 [22:30:29])
% This is a re-write of my old code from contro... |
function new_arch = improve_remove_interference(varargin)
global params
arch = cell2mat(varargin);
current_interferences = PACK_get_current_interferences(arch);
new_arch = arch;
n = size(current_interferences,1);
if n > 0
interf = current_interferences(randi(n),:);
instr1 = strcmp(params.packaging_instrument_li... |
% Example Phiwave batch script
% Make sure phiwave is loaded
phiwave on
% SPM design path
spm_name = spm_get(1, 'SPM.mat', 'Select SPM design');
% Make phiwave design object
D = phido(spm_name);
% Set some options for estimation (see @phido/estimate.m)
params = struct('wavelet', phiw_lemarie(2), ...
'scales', ... |
function asw=iscycleslip(obuf,obs,poob,prn,cst,lmt,otptu)
%
% Function iscycleslip
% ====================
%
% Determine if the current observation is a cycle slip or not
% It uses the geometry free combination of carrierphases:
%
% gf(i)=L1*f1(i)-L2*f2(i)
%
% gf -> geometry free combination
% ... |
%% Body panel definitions - symmetric NACA aerofoils only
function [x,z,x_c,z_c,n_hat,t_hat,sin_theta,cos_theta,X2] = ...
BodyPanelDefinition(c,t,Npanel,m,p)
%In angular terms,
delta_beta = pi/(Npanel);
beta = 0:delta_beta:2*pi;
%2*pi implies that top and bottom are being simulated.
%Corresponding x-coordinates:... |
%filters data based on set lapse rate
%saves structure of pooled data
clc
clear all
close all
subject = 'am016';
thedate = '09-Apr-2013';
ndays = 45;
species = 'mice';
IncludeData = {};
counter =0;
all_data = [];
prop_chose_right = 0;
total = 0;
mean_categories = 0;
addeddates = {};
propChoice =... |
function [final_output_corrected,final_output_dicom,final_output_gated] = PreProcessing(cell)
% Preprocessing of the PET MoCo Data
current_data = cell.hier(:,:,:);
counter = 1;
feature_value_1 = zeros(1,42);
feature_value_2 = zeros(1,42);
feature_value_3 = zeros(1,42);
for l = 1:42
for i = 1:3:42
f... |
function cardResolution = get_resolution(dev)
%% get_resolution(dev)
% Used to find card resolution based off of daq model
% Written By: Gordon Huynh
% Last Updated: July 21, 2016
%
% INPUTS
% dev: array of daq devices detected
% OUTPUTS
% cardResolution: integer of daq card resolution
% ADDITIONAL COMMENTS
% To ... |
clear
addpath(genpath('.'));
KokkosInitialize(8);
opts = MapOptions(); %Setting options to default
multis2 = [0 1;2 0];
mset2 = MultiIndexSet(multis2);
ParFunc = ParameterizedFunction(2,mset2,opts);
ParFunc.SetCoeffs(ones(1,ParFunc.numCoeffs))
disp('Coeffs')
disp(ParFunc.Coeffs)
disp('Evaluate')
disp(ParFunc.Eval... |
function varargout = runSSA(varargin)
% RUNSSA MATLAB code for runSSA.fig
% RUNSSA, by itself, creates a new RUNSSA or raises the existing
% singleton*.
%
% H = RUNSSA returns the handle to a new RUNSSA or the handle to
% the existing singleton*.
%
% RUNSSA('CALLBACK',hObject,eventData,handles,... |
function [ test_label_p15, test_label_p50, test_label_p85 ] = ...
thecannon_marginalize_label_grid( test_label_gvs, chi2_cube )
% Written by: Bo Zhang (NAOC, bozhang@nao.cas.cn)
% Last modified: 29-Jun-2016
%
% Aim:
% -
% Example:
% -
% -
% INPUT:
% -
% -
% OUTPUT:
% -
% -
% HISTORY:
% -... |
function [h,rr,gg] = rgbhist(R,G,rbin,gbin)
% this function constructs a histogram
% input R and G should be in 0-255 scale
if max(R(:))<=1
R = R*255;
G = G*255;
end
raxis = linspace(0,255,rbin+1);
gaxis = linspace(0,255,gbin+1);
rr = raxis(1:end-1) + 255/2/rbin;
gg = gaxis(1:end-1) + 255/2/gbin;
h = zeros(rbi... |
subplot(2, 2, 1);image(myimage);axis image;title('original');
subplot(2, 2, 2);image(flippedY(myimage));axis image;title('flipped y');
subplot(2, 2, 3);image(flippedX(myimage));axis image;title('flipped x');
subplot(2, 2, 4);image(flippedY(flippedX(myimage)));axis image;title('flipped x and y'); |
function mcode_str = wgeneratematlabcode(caller,fig,varargin)
%WGENERATEMATLABCODE Generate Matlab code.
% M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 16-Mar-2011.
% Last Revision: 27-Oct-2011.
% Copyright 1995-2011 The MathWorks, Inc.
% $Revision: 1.1.6.4 $
GD = guidata(fig);
figPROP = GD.WfigPROP;
figPar... |
% Implementation of null model of Hindrick2105, NeuroImage
% 03-03-2017 Jonathan Wirsich Brainhack Global 2017, UIUC
%
% ts - input timeseries(time x regions)
% iter - number of iterations
%
% shifted_ts1 shifted_ts2 - timeseries pairs of iteration x connection x
% timepoint with random pahseshift for each connections ... |
function [HashCodes AbsPathHashCodes]= CheckHashCodeOfMFilesInFolder(absPathFolder)
%CHECHHASCODEOFMFILESINFOLDER This function checks if all the m-files in
%the given directory contain hashcodes as created by us. The goal is to
%check if students altered the forbidden parts of the given code.
%
% ----------------... |
function [u,v,w] = rotateMeasurement(um,vm,p,r,y)
% takes in measured velocities in u and v directions labeled: um, vm
% takes in pitch and roll angles: p and r
% outputs the u,v,w wind velocities
if nargin() == 4
y = 0;
end
R1 = [[1,0,0];[0,cosd(p),sind(p)];[0,-sind(p),cosd(p)]];
R2 = [[cosd(r),0,sind(r)]... |
X = [ 2 1 3; 7 1 9; 1 8 1; 3 7 4 ];
y = [2 ; 5 ; 5 ; 6];
theta_test = [0.4 ; 0.6 ; 0.8];
computeCostMulti( X, y, theta_test ) |
% getitng audio samples to play back
% at different pitches by doing an FFT -> shifting the frequency bins
%-> IFFT
[inwave,fs] = audioread("sample.wav");
%plot(y);
%size(y)
outwave=inwave;
chunk_size= 1024;
for start_sample=1:chunk_size:length(inwave)-chunk_size
y=inwave(start_sample:start_sample+chunk_size);... |
%% SELECT ALL SESSION PATHS
celldisp(cellstr(EXPERIMENT_DIR));
% List of open inputs
% Named Directory Selector: Directory - cfg_files
nrun = 1; % enter the number of runs here
jobfile = {strcat(CODE_PATH, '/rest_sessions_select_dirs_job.m')};
jobs = repmat(jobfile, 1, nrun);
inputs = cell(1, nrun);
for crun = 1:nru... |
clear;close all;clc
%Bildschirmgrösse
sz = get(0,'screensize');
%Modellparameter
lambda = 8e-9;
gamma = 0.35025;
%Simulationshorizont (in Tagen) und Inkrement
t = 300;
dt = 0.1;
k = floor(t/dt);
S = zeros(k+1,1);
I = zeros(k+1,1);
R = zeros(k+1,1);
p = linspace(0,k*dt,k+1);
%Startbedin... |
function imageMap = preloadImages(stimulusData, wPtr)
imageMap = containers.Map();
for nTrial = 1:size(stimulusData.fileName, 1)
for nStimulus = find([stimulusData.isImage(nTrial, :)])
imageKey = stimulusData.fileName{nTrial, nStimulus};
if ~isKey(imageMap, imageKey)
... |
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Advance Neuroscience Motor Control Project
% Porf. Dr. Ghazizadeh
% Ali Ghavampour - Student Number: 97102293
% Maryam Maghsoudi - Student Number: 97102503
% Spring 2023
% %% Caution: Change your directory to the project "Codes" folder
% cd('C:\Deskto... |
function ret = hasSignalProcessingToolbox(taskName)
% Verify that Signal Processing Toolbox is installed and license obtained
ret = hasToolbox(taskName, 'signal', 'Signal_Toolbox');
end |
% Pre load BEL results and disp
% Load NF dataset
[file, path] = uigetfile('*.mrsbel','Select the noise-free dataset');
load([path file],'-mat');
models_NF = SNMR.Solution.model;
% Load Noisy dataset
[file, path] = uigetfile('*.mrsbel','Select the noisy dataset');
load([path file],'-mat');
models_NOISY = SNMR.Solution.... |
function [result] = matskew(v)
vx=v(1);
vy=v(2);
vz=v(3);
result=[0 -vx -vy -vz;vx 0 vz -vy;vy -vz 0 vx;vz vy -vx 0];
end
|
% best pops fig generation
% plot frequencies of each stimulus distn
tapers=3; avg=1; fs = 1000;
pars = struct ('Fs', fs, ...
'tapers', [tapers 2*tapers-1], ...
'pad', 0, ...
'trialave', 1);
for k = 1:numStimStats
[S(:,k), f] = mtspectrumc(outSignal(:,1+(k-1)*numSignalsPerStat:k*numSignalsPerStat), par... |
c=clock;
timenow=[num2str(c(1)) num2str(c(2)) num2str(c(3))];
if ~exist('Pr')
load('allKW201712Collaps_Deg0Removed.mat')
load('TrainedNet2017.mat');
load('EvalData2017.mat');
disp('Finished reading data');
[Yr,~,~,~,perf] = sim(net,Pr);
degA15=Pr(1,:);
degB15=Pr(2,:);
... |
%Task3 show the horizontal edges, vertical edges and all edges of the image im
im = imread('lenna512.bmp');
im = double(im);
[r,c] = size(im);
im_horizontal_edges = zeros(r,c);
im_vertical_edges = zeros(r,c);
for i = 1:r-2
for j = 1:c-2
im_horizontal_edges(i,j)=(im(i+2,j)+2*im(i+2,j+1)+im(i+2,j+2))-... |
%% Stelling 15
%
% In Matlab kun je een rijvector van kolomvectoren maken.
% Dit wordt een matrix genoemd.
%
Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
|
function [] = videoClipper(filename)
in_vid = VideoReader(filename);
video = VideoWriter('EyeTrackingClip14');
numFrames = in_vid.FrameRate * in_vid.Duration;
open(video);
start = false;
for i = 1:numFrames
frame = read(in_vid,i);
rFrame = frame(:,:,1);
gFrame = frame(:,:... |
function [BV,delta,delta1] = comp_bvf(BTWC, N_startf, N_finalf, IP, flag);
% function [BV,delta] = comp_bvf(BTWC, N_startf, N_finalf, IP, flag);
%
% This function is used to compute a set of "warped" cosine
% basis vectors over frequency
% Note: This version give identical set of bv as compared to tfrontc
% ... |
function [zi,Adk,Bkw,Mk] = gibbs_update(zi,Adk,Bkw,Mk,...
I,D,K,W,di,wi,ci,citest,Id,Iw,Nd,alpha,beta);
k=1:K;
% for each pair (word,doc)
for i=1:I
% substract the old topic assignments from counts
for j=1:ci(i)
Adk(di(i),zi{i}(j)) = Adk(di(i),zi{i}(j)) - 1;
Bkw(zi{i}(j),wi(i)) = Bkw(... |
function SegmentationMethod1AMPAO(handles)
folderPath = handles.PathName;
% folderPath = 'D:\kafieh\AMPAO';
filterindex = 2;
% folderPath = strcat(folderPath,'\');
image = double(handles.data.BScan);
%------------- Get Slice Numbers
prompt={'Enter value \range of slices to be Segmented (at least 3 slices)'};
name =... |
function freezeColors(varargin)
% freezeColors Lock colors of plot, enabling multiple colormaps per figure. (v2.3)
%
% Problem: There is only one colormap per figure. This function provides
% an easy solution when plots using different colomaps are desired
% in the same figure.
%
% freezeColors freeze... |
%% PID Control of an Unmanned Surface Vehicle (USV) using a dynamic model
clear; close all; clc;
sim_time = 100;
sampling = 0.1;
%% Set-up Simulation Model
figure(1)
ax = axes('XLim',[-10 10],'YLim',[-5 20],'ZLim',[-2.5 2.5]);
view(3); % View all the axes (3D)
grid on;
% Modelling water
Water_x = -10:0.5:10;
Wat... |
function r = sqresidue(A, B)
D = A - B;
r = sum(D(:) .^ 2); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.