text stringlengths 8 6.12M |
|---|
function title_align_left(iText,varargin)
t = title(iText,'horizontalAlignment', 'left',varargin{:});
h = get(t, 'position'); set(t, 'position', [0 h(2) h(3)]);
end |
function p = m2p( m )
%M2P 此处显示有关此函数的摘要
% 此处显示详细说明
m(1,1) = m(1,1) - 1;
m(2,2) = m(2,2) - 1;
m = m(1:2,:);
p = m(:);
end
|
GUI-Graphical User Interface
Corresponde al entorno de programacion Orientada a objetos.
Para ingresar a la ventana de edicion de GUI, en el prompt del MATLAB
se debe escribir
>> guide
Seleccionar blank GUI y cambiar en preferencias
-Show name in component pallet-
Para duplicar un objeto se usa ctl+d
Para cambiar el ... |
function img = reconTomoSAA( sino, geom )
img = backProjectPixelDrivenMex(sino, geom );
w = backProjectPixelDrivenMex( ones( size(sino), 'single'), geom );
img = img./w;
end |
%% %%The Chorus Filter and System Objects%% %%
clear all
close all
clc
%% Another chorus filter
fs = 8000;
[h1,w1] = freqz ([1 zeros(1,49) 1 zeros(1,49) 1],[1],'whole',fs);
figure(1)
plot(w1,20*log10(abs(h1)));
xlim([0 0.1*pi])
ylim([-30 10])
title('freqz rad/samples D = 50');
%% The Chorus Filter
Fs = 8000; % Samp... |
function A = createEsEdges(A,Z,X,N,param,DEF_INF)
% Create edges in the graph between surfaces (See Equation 4 in LI06).
% Edges are created between each vertex and the corresponding vertex in the
% adjacent surface. These edges act as distance constraints between each
% surface, defining the minimum (dl(i,i+1)) and ma... |
function [stim_Ref, stimA, stimB1, stimA2, ERBspace, Tones_f, envs_A, envs_B1] = StimBind_noRect_3AFC(Corr_inds, fs,bw,bp_fo)
% IF ERB_spacing is given, that will be used instead of Tones_num
% This version of the binding stimulus will return the A and B parts
% seperatley for a 3AFC experiment. No half wave rectifi... |
function [ filtered_rti ] = detection_thresholding( rss_change_estimate,Tt )
%DETECTION_THRESHOLDING Filters the RSS change estimation with a vector
%mask [0 1] depending if the signal levels reach a threshold
% rss_change_estimate Estimated changes in RSS by each voxel
% calibration_steps Number of frame... |
function GridConfig = GenerateRhythmicGrid(CanvasW, Ratio, Baseline, ColumnsNum, GutterW, SubRhythm)
%GENERATERHYTHMICGRID Generate rhythmic grid(s) based on input configuration.
%Possible return of multiple grids (including non-optimal) or none.
%
% CanvasW [px] - Max canvas width
% Ratio string representing ratio... |
function molefractioncontroller = molefractioncontroller(teststream, name);
global processOperations
molefractioncontroller = neqsim.processSimulation.controllerDevice.MoleFractionControllerUtil(teststream);
if(nargin>=2)
molefractioncontroller.setName(name);
end
processOperations.add(molefractioncontroller);
... |
% Compute MJO phase from ERA-I observations (1985-2013) and split into
% favorable/unfavorable phases for a given ocean basin.
%
% Meg D. Fowler, 2017-05-02
%
%% Determine MJO phase
load('anomalies_ymean_1983-2013_ERA-I.mat'); %Loads array "anomalies_ymean"
load('timeForAnomalies_1983-2013_ERA-I.mat'); ... |
# Normalize the data around the mean and one standard deviation
function [xn, mu, sigma] = normalize(x)
m = size(x, 2);
mu = mean(x, 2);
sigma = std(x, 0, 2);
xn = (x - repmat(mu, 1, m)) ./ repmat(sigma, 1, m);
endfunction
|
function z = drift(fname,L,method)
%DRIFT('FAMILYNAME',Length [m],'METHOD')
% creates a new family in the FAMLIST - a structure with fields
% FamName family name
% Length length[m]
% PassMethod name of the function on disk to use for tracking
% returns assigned address in the FAMLIST that is uniquely iden... |
clc
clear all
close all
J = [0 1];
qi = [0 0.15];
qf = [2.0944 0.3];
T = 10;
incr = 0.1;
Vr=0.3; Vp=0.02;
tf=T;
dqi12=[0;0];
dqf12=[0;0];
j=1;
for t=0:incr:T
for i=1:length(J)
if J(i)==0
qi1=qi(1); qf1=qf(1); dqi1=dqi12(1); dqf1=dqf12(1);
V=Vr;
tb=(qi1-qf1+V*tf)/V;
... |
function [maxDD,MDDsIdx,MDDeIdx,longDDD,longDDeIdx] = calcMaxDD(nav)
% 潘其超, V.10, from backtest。
% 潘其超,20140710,V2.0
highLevel = nav;
for i = 2:length(nav)
% 前面一个发生的概率比较大,放在if。
if nav(i)<=highLevel(i-1)
highLevel(i) = highLevel(i-1);
else
highLevel(i)=nav(i);
end
end
drawDown = (hig... |
function main
a = 0;
b = 0.4;
n = 5;
I = 1.4 * log(1.4) - 0.4; % integral = (x + 1) * log(x + 1) - x
r = rectangles(a, b, n);
t = trapezium(a, b, n);
s = simpson(a, b, n);
% max f'' & f'''' at 0 on [0, 0.4]
R = [I; r; abs(I - r); abs((b - a) * power((b - a) / (n - 1), 2) * ... |
function [led,ts] = cleanBehavior(behavior);
i = 1;
ct = 0; ct2 = 0;
while i <= size(behavior,1)
foo = behavior{i};
foo2 = str2num(foo);
if ~isempty(foo2)
ct = ct+1;
ts{ct} = foo;
else
ct2 = ct2+1;
led{ct2} = foo;
end;
i = i+1;
end;
|
% update the parameters of GBNs for K clusters
warning off;
addpath(genpath('../bnt'));
clear all; close all; clc;
load City_Level_UD_Interp_New.mat;
load CityInfo.mat;
load training_ind_season_new.mat;
load ST_candidates_v1_new.mat;
load City_Level_Weather_Training.mat
mkdir('./Result_one_case');
mkdir('./Result_one_... |
function [postParticles] = Estimator(prevPostParticles, sens, act, init)
% [postParticles] = Estimator(prevPostParticles, sens, act, init)
%
% The estimator function. The function will be called in two different
% modes: If init==1, the estimator is initialized. If init == 0, the
% estimator does an iteration for a sin... |
% Часть 1.
% Расчёт величин B(k), C(k) и Um(k) и начальной фазы Pci(k) (k=1 - kmax) табл. 5.3
clear
echo off
kmax=input('kmax - максимальное число используемых гармоник; задайте kmax=');
Umm=100; T=0.01;
k=1:kmax;
Bk=(Umm./(pi.*k)).*(2.*sin(pi.*k./4).^2-cos(3.*pi.*k./2)+cos(2.*pi.*k)) % Здесь забить свои хтонические фо... |
function traces = fetchTraces(obj)
% function traces = fetchTraces(obj)
%
% This function organizes traces of the stats stimuli in [cells classes trials]
%
% MF 2011-08-24
key = fetch(obj);
% get traces of all neurons of a site and fps
T = Traces(key);
if ~isempty(RFFit(key))
T = T.*RFFit(key,['snr >' num2str(k... |
function out = Quantizer(m_t, L,mp, mu)
b = log2(L) ;%number of bits
v = m_t(1,:);
v(v == min(v)) = min(v) + 1e-10;
if mu == 0 %uniform case
m = fix(v*L/mp/2); %scale the voltage to L
else
v = log10(1+mu*abs(v))/log(1+mu); %mu low
m = fix(v*L/mp/2) ; %scale the voltage to L
end
m = m + L/2 -1 ;
out = [];
out... |
function [im_distort] = distort(img, K1)
[height, width, ~] = size(img);
S = max(height, width);
im_distort = zeros(height, width, 3);
for i = 1 : height
for j = 1 : width
ud = ( 2 * i - height ) / S;
vd = ( 2 * j - width ) / S;
r2 = ud^2 + vd^2;
... |
function plotBasicSeries(signal, fs)
%
% DESCRIPTION:
% A simple helper function used to plot the time series and frequency
% domain of a signal
%
% OUTPUTS: None
%
% INPUTS:
% signal: the time series to be plotted
% fs: the sampling rate of the time series signal
%... |
function drawgeom_ref(Ldomain)
%Ldomain unit is nm for nanopore escape exp; defaut value is 14*0.5
[pde_fig,ax]=pdeinit;
pdetool('appl_cb',1);
set(ax,'DataAspectRatio',[8.2223194748358903 1 32.533333333333353]);
set(ax,'PlotBoxAspectRatio',[1 1 1]);
set(ax,'XLim',[-0.250 0.25+Ldomain]);
set(ax,'YLim',[-0.05 0.05]);
set... |
%extract officer data from text files
clear all
filenames %load strfiles array
path='C:\Users\Nun Maker\Dropbox\Esher\Alumni\Annual Officer Directories\Annual Officer Directories\All Directories\';
officerinfo = {['Name, Email, Position, Year']};%initialize array
for file = strfiles
[ output ] = ext... |
function drawClusters3d(matrix, labels)
%DRAWCLUSTERS crta clustere u 3d
figure
scatter3(matrix(:,1), matrix(:,2), matrix(:,3), 15, labels, 'filled');
end
|
function eegcleaned = remove_artifacts(EEGICA)
% This is from Laura Froelich, available online at
% http://www2.imm.dtu.dk/ lf-fr/publications/indexpub.php. as "example use".
% The code was implemented and described in the article
% Classification of independent components of EEG into multiple artifact classes.
... |
function [ isGood ] = checkFslSetup( )
%checkFslSetup Checks that matlab is setup to execute fsl commands
% This function checks for several things that need to be setup for FSL
%to work when called from MATLAB
%
%1) Environment Variables
%2) Fsl file in fsldir/bin
isGood = true;
FSLOUTPUTTYPE = getenv('FSLOUTPUTTYP... |
function [wdot] = statesim(t,w)
% Hadi Saadat, 1998
% Given the solution of the time-varying matrix Riccati equation found
% by the function riccasim, this function solves the state equation in
% conjunction with the optimal control equation.
global A B Q R t0 tf x0
[A,B,Q,R,t0,tf,x0]=system(A,B,Q,R,t0,tf,x... |
% Dataset specs
projectName = 'visual';
sub_label = 'som648';
ses_label = 'nyuecog01';
% Input paths specs
dataPth = '/Volumes/server/Projects/BAIR/Data/BIDS/';
% Output paths specs
dataDir = fullfile(dataPth, projectName, 'derivatives', 'preprocessed', sprintf('sub-%s', sub_label));
%% Load preprocessed da... |
% c)
N = 10;
R = 10000;
alfa = 0.1;
% Configuration 1: n = 10, S = 100 Mbps
% Configuration 2: n = 4, S = 250 Mbps
% Configuration 3: n = 1, S = 1000 Mbps
n = 4;
S = 250;
p = 20;
W = 400;
lambda = [100, 120, 140, 160, 180, 200];
fname = 'movies.txt';
blockingProbHD = zeros(1,length(lambda));
termHD = zeros(1,length(l... |
%%本工程文件为Iridium-191原创内容,若有其他用途请联系原作者(B站ID:385867593)
fs=44100;
dt=1/fs;
T16 = 5/24;
number=0:dt:T16;
[temp k]=size(number);
t21 = linspace(0,T16,k);
t22 = linspace(T16,1.2*T16,0.2*k);
t23 = linspace(1.2*T16,8*T16,6.8*k);
t41 = linspace(0,0.5*T16,0.5*k);
t42 = linspace(0.5*T16,0.6*T16,0.1*k);
t43 = linspace(... |
format compact;
clc;
clear;
close all;
A=[1 2 5;3 4 8;5 6 10];
B=[1 5 -3;-2 5 45;4 8 6];
A-B %Diferenta a doua matrice
A+B %Suma a doua matrice
A^-1 %Inversa unei matrice
A' %Transpusa unei matrice
C=[A;B] %Concatenare
%Pentru a folosi si a aparea in CommandWindow o singura operatie puneti ;
%la s... |
function o = pssetactivelayer(n)
%PSSETACTIVELAYER Activate the current layer in the current document.
% The return value is the name of the previously selected layer.
%
% Example:
% o = pssetactivelayer('Layer 4')
%
% See also PSLAYERNAMES, PSNUMLAYERS, PSNEWLAYER, PSNEWLAYERMATRIX
% Thomas Ruark, 2/23/... |
function [T,calc,debye,deb_ein]=SpecificHeat(DOS,omega,T_D,n,omega0)
kb=1.3806488e-23; %m^2kg/(s^2K)
hbar=1.05457e-34; %m^2kg/s
T=0:3*T_D;
%Discrete Model
calc=zeros(size(T));
for ppp=1:length(T)
calc(ppp)=1/(4*kb*T(ppp)^2)*sum((hbar*omega).^2.*DOS.*csch(hbar*omega/(2*kb*T(ppp))).^2);
end
%Debye Model
debye=zero... |
function fs = ExtractSiftDescriptor(im)
%EXTRACTSIFTDESCRIPTOR Summary of this function goes here
% Detailed explanation goes here
w = size(im,1);
sc = (w-2)/12;
% feature frame with x, y representing centre, scale, and orientation in radians
fc = [w/2; w/2; sc; 0];
[fc fs] = vl_sift(im, 'frames', fc);
fs = double(f... |
function [ y ] = SPLINT( xa,ya,y2a,n,x )
%SPLINT splint
%
% SUBROUTINE splint(xa,ya,y2a,n,x,y)
%-------------------------------------------------------------------------------
% INTEGER n
% REAL x,y,xa(n),y2a(n),ya(n)
% INTEGER k,khi,klo
% REAL a,b,h
klo=1;
khi=n;
while khi-klo > 1
k... |
function [ clmParams, pdm ] = Load_CLM_params_vid()
%LOAD_CLM_PARAMS_WILD Summary of this function goes here
% Detailed explanation goes here
clmParams.window_size = [21,21; 19,19; 17,17;];
clmParams.numPatchIters = size(clmParams.window_size,1);
% the PDM created from Multi-PIE data
pdmLoc = ['... |
function [SNR] = Performance_check(Receiver_type,w_i,H_i,i,NoiseVar)
if Receiver_type ~= 0
i = 1;
end
w_i=w_i';
SNR_denominator_ai=0;SNR_numerator_ai=0;W_i_denominator=0;
a_i= w_i*H_i;
SNR_numerator_ai=(abs(a_i(i))).^2;
SNR_denominator_ai=sum((abs(a_i)).^2);
%Using the numera... |
% Name: Zheng Wen
% USC ID: 7112807212
% USC Email: zwen1423@usc.edu
% Submission Date 1/27/2020
function new_img = Basic(img, r, pattern, a)
% pattern = 1: Normal
% pattern = 2: Gaussian
[m,n]=size(img);
new_img=zeros(m,n);
panel=zeros(2*r+1, 2*r+1);
panel_center=r+1;
if pattern==1
for i=1:2*r+1
... |
function [sx,sy,ex,ey]=max_areaRect(M)
%% A function which returns the area of maximum rectangle occupied by 1 in a binary matrix,along with the coordinates of the end pointin the matrix.
DP=zeros(size(M,1),size(M,2));
r=size(M,1);
c=size(M,2);
DP(1,1)=M(1,1);
A=0;
x=0;
y=0;
l=0;
h=0;
% For first row
for i=2:c
i... |
function out=decCorrBootstrap(processed_data_mat,nReps)
data=processed_data_mat.data;
numFlies=length(data);
numParameters=size(data,1);
avgCorr=zeros(nReps,1);
for k=1:nReps
simMat=zeros(numParameters,numFlies);
for i=1:numFlies
for j=1:numParameters
index=ceil(rand()*numFlies)... |
function [nx, ny, Lx_n, Ly_n, ds] = get_src_params_3D(Lx, Ly, n_src)
% helps uniformally distribute n_src sources among an area
% of size Lx x Ly
% INPUT
% Lx,Ly - lengths in hte directions x,y,z of the area, ...
% the sources should be placed
% n_src - number of sources
% OUTPUT
% nx,ny - nu... |
function [t, y] = Adams(t_0, h, t_n, y_0, A)% t_0 - первый узел, h - шаг, t_n - последний узел, y_0 - начальное условие, A - матрица
s = rank(A);
t = t_0:h:t_n;
y = zeros(s, length(t));
y(:,1) = y_0;
[~,y_2] = RK(t_0, h, t_0+h,y_0,A);%использование метода Рунге-Кутты для нахождения y(t_0+h)
y(:,... |
% Call Syntax: h = HilbertMultiComponentPlot(t,S,IF,A,fs,fMax,STFTparms)
%
% Description: This function plots a multicomponent AM-FM signal.
%
% Input Arguments:
% Name: t
% Type: column vector (Px1)
% Description: time index
%
% Name: S
% Type: real matrix (PxK)
% Description: each column is the real sign... |
function fs = genfs(params,N)
% GENFS Generate Fourier series coefficients
%
% This generates Fourier series coefficients from parameters.
% The following signals are supported:
% - cosine wave [1 T0 A t0]
% - rectangular pulse train [2 T0 A t0 tau]
% - triangular pulse train ... |
% reference: http://www1.maths.leeds.ac.uk/~jaward/publications/JAW-UTSG-2010.pdf
%function [output] = lambda_calc(a_val,b_val,hm_val,params)
function [output] = lambda_calc(alpha_model,a,b,hm,params)
clear a s alpha v dv h_m b
syms a s h_m b v dv
ov_fcn = alpha_model*(a*(tanh((s-h_m)/b)+tanh(h_m/b))-v);
... |
%------------------------------------------------------------------
% VDP with VS Iteration Initialized with Vlin
% Compute an estimate of the region of attraction for the van
% der Pol oscillator using the V-S iteration. The iteration is
% initialized with the Lyapunov function from linearized analysis.
%
% 1... |
function [ param, muq, sigmaPred, nelbo ] = opperMainGaussFullReparam( y, param, conf )
%OPPERMAINGAUSSFULLREPARAM Summary of this function goes here
% This one uses the reparametrization directly
%
optimizer = 'minFunc';
%% Read first configuration
S = conf.S;
fwdFunc = @(xx) param.fwdFunc(xx, param.fwd... |
% 0. Setting up
setup;
vidNo = 4;
vidPath = '/Users/ihorng/Documents/MATLAB/Oxford/4yp/Bubbles video/bubbleImage';
vidPath = strcat(vidPath,num2str(vidNo));
addpath(vidPath); % adding path where images are
%{
% 1A. Get image patch containing 1 bubble
Ori = imread('Image47','jpg');
I = Ori([92:126],[166:200]); % 35 x ... |
%========================== AnalyseSFMcatch.m =============================
% Collects SFMcatch data from all sessions for a single subject (navigating
% the prescribed folder structure) and analyses perceptual report and eye
% tracking data for each session, before calculating averaged normalized
% perceptual s... |
function [ x2index, y2index, slope, keepGoing ] = myNeighbor( row, col, x1index, y1index, selection )
if (selection == 2)
selection = 0; %going down
elseif (selection == 3)
selection = 1; %going up
end
[limit,~] = size(row);
x1 = row(x1index);
y1 = col(y1inde... |
function plotOneResult_Parameters(ds, numK, numNFFT, attribute, filename)
f = figure;
X = ds(ds.K == numK & ds.NFFT == numNFFT, :);
t_attribute = sprintf('%s_Target', attribute);
i_attribute = sprintf('%s_Interference', attribute);
iterations = [50, 100, 200, 300];
Y = zeros(4, 4);
Z = zeros(4, 4);... |
clc; clear
A = [ 0 0 1 0 0 1 0 0 0 0;
1 0 1 0 0 0 1 1 0 1;
0 1 0 1 0 0 1 0 0 0;
0 0 0 0 0 0 0 0 0 0;
0 0 1 1 0 1 0 1 1 1;
1 1 1 1 1 0 1 1 0 1;
0 0 0 0 0 0 0 1 0 0;
0 0 0 0 1 0 0 0 0 0;
0 0 0 1 0 0 0 0 0 0;
0 0 0 0 0 1 0 0 0 0]; % adjacency matrix fo... |
% A robust CSS corner detector based on the turning angle curvature of image gradients
%
% Link:https://github.com/bbenligiray/robust-css-corners
%
% Code used in the following paper:
%
% C. Topal; K. ?zkan; B. Benligiray; C. Akinlar, "A robust CSS corner detector based on the turning angle curvature of image ... |
% MATH411 Q3 (b)
% 9/06/21
%% Introduction
% This script coordinates the main function, which solves Burgers' equation
% for varying grid sizes and varying diffusion parameters. They're arranged
% in a script like this, because Miguel has said that they can take up to
% 12 hours to run.
%% Returning Matlab t... |
function [xc,yc,Amp,wx,wy]=gauss2dellipse(z,x,y,noiselevel)
%[xc,yc,Amp,wx,wy]=gauss2dellipse(z,x,y,noiselevel)
%
%GAUSS2DCIRC.m attempts to find the best 2D circular Gaussian fit for the
%selected region of the image.
%
%Copyright 2008 Stephen M. Anthony, U. Illinois Urbana-Champaign
%
%This program is free software... |
clear all
close all
clc
rosshutdown
rosinit
liveplot = false;
figure
kkt_sub = rossubscriber('/MPC/kkt');
time_sub = rossubscriber('/MPC/solvertime');
disp('Start tracker')
kkt_data(1) = receive(kkt_sub,100);
time_data(1) = time_sub.LatestMessage;
kkt_mpc_data(1) = kkt_data(1).Data;
time_mpc_data(1) = time_data(... |
addpath('ccnl-fmri');
addpath('/Applications/bspmview-pimpd-master/');
addpath('/Applications/spm12/');
%addpath('/Users/hayley/Dropbox (Personal)/Studies/OptControl/UCR_fMRI/analyses/comp_model/')
|
function[circ_M_opToep,circ] = circ_2_level(circ_L_opToep,L,M,N)
circ = cell(L,M);
for i_loop=1:L
A(:,:) = squeeze(circ_L_opToep(i_loop,:,:,1));
clear c
% Now construct circulant approximation
c = zeros(M,N);
for i=2:M
c(i,:) = (M+1-i)/M.*A(i,:)+(i-1)/M.*A(M-i+2,:);
end
... |
% Codigo para imprimir un triangulo
fprintf('\ntriangulo\n\n')
for k=1:7
for l=1:k
fprintf('*')
end;
fprintf('\n')
end |
function Rlim= fRlimite(n,coef)
menordif=fmenordif(n,coef);
Rlim1=0.1*menordif; %0.1*min(diferenças entre a(i))
if (Rlim1<eps)Rlim1=0.1; end %se Rlim1 é nulo => Rlim1=0.1
Ndecimais=fNdecimais(n,coef); %numero maximo de digitos decimais fracionarios nos coeficientes
Rlim2=1./10^Ndecimais; % Limite equivalente ao ma... |
%% Main file to use for a single call of the tool
% This tool computes an interval over-approximation of the finite-time
% reachable set for a continuous-time system dx/dt = f(t,x,p) or
% discrete-time system x^+ = f(t,x,p) with input p, based on the intervals
% of initial states and of input values.
% Authors:
% ... |
function date_vector = convert_timestamp_to_date(timestamp,time_interval)
if ~exist('time_interval','var')
time_interval = 1;
end
timestamp = timestamp*time_interval;
current_year = get_year_given_seconds(timestamp);
days_passed_since_beginning_of_2007 = floor(floor(timestamp/3600)/24);
days_passed_since_beggini... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%
global record_count1 record_count2 record_count3 record_dat1 record_dat2 record_dat3;
global record_angle;
global save_file;
global handles_ana;
% % % save_file_name = get(handles_ana.edit_savepath, 'string');
% % %
% %... |
%function plot_power_grid(subj,block,power)
clear
subj = 'EC77';
%blocks = {'B11', 'B12', 'B13'};
%blocks = {'B31', 'B33', 'B34'};
%blocks = {'B11', 'B12', 'B13', 'B31', 'B33', 'B34'};
blocks = {'B26','B27','B28'};
day = 'Day1';
power = 1;
srate = 400;
path = ['/Users/johncase/Documents/UCSF Data/' subj '/' day '/'];
... |
function par=parity(Fmn)
hascos=any(abs(Fmn.c(find(not(isnan(Fmn.c)))))>10*eps);
hassin=any(abs(Fmn.s(find(not(isnan(Fmn.s)))))>10*eps);
if hascos && not(hassin)
par='cos';
elseif not(hascos) && hassin
par='sin';
else
par='both';
end |
function CreateParameters_cluster(ImagePath, ImageName, mode)
%yl09012017: create parameters for CurveAlignFE_cluster.m
% Input:
% ImagePath: image directory
% ImageName: name of the image
% mode: 1: CT-FIRE; 2: CurveAlign full image analysis, 3: CurveAlign ROI analysis
% Output:
% saved in a txt file
if ... |
clear all
close all
clc
setenv('TTKERNEL', 'X:\Bureau\tp3\fichiers_donnees\Fichiers necessaires\truetime-2.0-beta7\kernel')
addpath([getenv('TTKERNEL')])
addpath([getenv('TTKERNEL') '/matlab/help'])
addpath([getenv('TTKERNEL') '/matlab'])
truetime
mex -setup
% make_truetime %pour la compilation de la librairie tr... |
% testing script for the SIMPLE algorithm
% load the example data
load example-data.mat obs truth
% fusion settings
num_iter_keep = 3;
SIMPLEalpha = 2;
% run the SIMPLE algorithm
[SI_est_1] = SIMPLE(obs, num_iter_keep, SIMPLEalpha);
[SI_est_2] = SIMPLE(obs, num_iter_keep, SIMPLEalpha, 0);
[SI_est_3] = SIMPLE(obs, nu... |
cd /Users/syen/Documents/Work/Data/Neural/Cat/a4/site05/session25
g25 = ProcessSession(nptdata,'UnitType','s')
ng25 = ProcessSession(nptgroup,'IntraGroup','Cells',g25.SessionDirs,'AnalysisLevel','AllIntraGroup');
g25intra = ProcessSession(nptdata,'AnalysisLevel','pairs','Intragroup','Cells',g25.SessionDirs);
cd ../sess... |
%%%%%%%%%% plot discount curve %%%%%%%%%%
load('EONIA');
i = 500;
Act_365 = 3;
% plot discount curve
figure
plot(EONIA(i).Dates, EONIA(i).DiscountFactors, 'ob-',...
'linewidth',1.3,...
'markersize',5);
grid on
h = legend('$B(t_0,t_i)$');
title('Discount factors curve');
datetick('x','mm/yy','k... |
function valid_quats = extract_quaternion_debug(TBI,q0123i)
%%%Assuming T is a 3x3 matrix, extract the quaternion vector (q0,q1,q2,q3)
%%%assuming a 3-2-1 transformation sequence
%%%Let T be defined such that v(body) = T v(inertial)
%%In Mark Costello's notation, T would TBI
TIB = TBI';
q0i = q0123i(1);
q1i = q0123i(2... |
%%
% Round 2!
% This is a rather complex NN for MNIST digit Recognition.
clear; clc;
digitDatasetPath = fullfile(matlabroot,'toolbox','nnet','nndemos', ...
'nndatasets','DigitDataset');
imds = imageDatastore(digitDatasetPath, ...
'IncludeSubfolders',true,'LabelSource','foldernames');
figure;
perm = randperm(1... |
function varargout = B2orientacion1(varargin)
% B2ORIENTACION1 MATLAB code for B2orientacion1.fig
% B2ORIENTACION1, by itself, creates a new B2ORIENTACION1 or raises the existing
% singleton*.
%
% H = B2ORIENTACION1 returns the handle to a new B2ORIENTACION1 or the handle to
% the existing singleto... |
function e = eig(a)
% eig Eigenvalues of FAVAR model.
%
% Syntax
% =======
%
% E = eig(A)
%
% Input arguments
% ================
%
% * `A` [ FAVAR ] - FAVAR object.
%
% Output arguments
% =================
%
% * `E` [ numeric ] - Eigenvalues associated with the dynamic system of the
% FAVAR model.... |
function [sssPMO] = pmo(price,sPeriod,fPeriod,sigPeriod)
% Price Momentum Oscillator, PMO
%http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:dppmo
%two times EMA of ROC
%PMO = 20 EMA (10 * 35 EMA(((Today's Price/Yesterday's Price)*100)-100))
%Signal Line: 10 period EMA of PMO
%example :... |
k = 0;
trainSet = []; % Matrix
centroidMat = zeros(size(trainSet,1),k);
distanceMat = zeros(k,size(trainSet,2));
assignments_new = zeros(1,size(trainSet,2));
s = false;
% randomly selecting centroids
for i = 1:k
x = randi(1:length(trainSet));
centroidMat(:,i) = trainSet(:,x);
end
while s == f... |
function ShiftedAndRotated
% checked
% p 打乱维度
% s 分组集合数量
% M_10, M_30, M_50, M_100 不同分组对应的旋转矩阵
% w 不同分组对应的权重
% o 位移
Ast = RandStream('mt19937ar', 'Seed', 3);
RandStream.setGlobalStream(Ast);
for func_num = 1 : 12
if func_num == 10
D = 900;
else
D = 1000;
end
[lb, ub] = GetBounds(func_n... |
function dydt = int_fire_lin(t , y)
global net
% setting parameters
if ischar(net.Neurons.Model.ModelParam)
switch net.Neurons.Model.ModelParam
case 'def'
tau_m = 10;
C = 1;
R = 10;
end
else
C = net.Neurons.Model.ModelParam(: ... |
function accum = pelican_accumulator(accum,m,i,A,N,status)
% This accumulator function creates a single ping-averaged transect struct
% using all data.
npings = 30;
dt = npings*(max(A.mtime)-min(A.mtime))/length(A.mtime);
be.t = A.mtime(1):dt:(A.mtime(end) + dt/2);
[~,bn.t] = histc(A.mtime,be.t);
T.time = be.t(1... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% AGREE TEST KINEMATICS %
%-------------------------------------------------------------------------%
% Author: Stefano Dalla Gasperina %
% Email: stefano... |
classdef GSM_Complex_NonCent_NWarp < GSM_Complex_NonCent & iNWarp
%GSM_Complex_NonCent_NWarp Summary of this class goes here
% Detailed explanation goes here
methods
function obj = GSM_Complex_NonCent_NWarp(ann)
obj@GSM_Complex_NonCent(ann);
[obj.sim_basis,obj.pc,obj.ev] = obj.OrthonormalizeB... |
%% Clustering
load clusterData.mat
%% Density-Based Clustering
eps = 14;
minPts = 3;
model = clusterDBcluster(X,eps,minPts);
title('Densty-Based clustering'); |
function xs = integNumericaPreencheXS (xl, xu, npontos)
% x1 = Ponto Inicial
% xu = Ponto Final
% xs = arrei do tipi (n,1) com os interva-los
%objetivo preenche XS com os dados e retona a qtd de pontos em XS
distH = abs((xu-xl))/(npontos+1);
ixs=1;
nvet=0;
valxs=xl;
nvet = npontos + 2;
while (ixs <= nvet)... |
function plot_RTregression_v1(ax, sub, RTmin, RTmax)
global AZred AZblue
for sn = 1:length(sub)
% say 1 is left
dR = sub(sn).o1(:,4) - sub(sn).o2(:,4);
dI = -(sub(sn).n1(:,4) - sub(sn).n2(:,4))/2;
c = sub(sn).a(:,5);
c(c==2) = -1;
RT = sub(sn).RT(:,5);
RT(RT>RTmax) = nan;
RT(RT<RTmin) ... |
function show_state_estimated(X, Y_k)
X_mean = mean(X, 2);
figure(1)
image(Y_k)
title('+++ Showing mean value +++')
hold on
plot(X_mean(2,:), X_mean(1,:), 'h', 'MarkerSize', 16, 'MarkerEdgeColor', 'y', 'MarkerFaceColor', 'y')
hold off
drawnow
|
% 交叉操作函数
%输入:
%SelCh 被选择的个体
%Pc 交叉概率
%输出:
%SelCh 交叉后的个体
function SelCh=PMX_combin(SelCh,Pc)
NSel=size(SelCh,1);
for i=1:2:NSel-mod(NSel,2)
if Pc>=rand %交叉概率Pc
[SelCh(i,:),SelCh(i+1,:)]=pmxcross(SelCh(i,:),SelCh(i+1,:));
end
end |
clear all
close all
clc
%% Windows: first try
f=510; N=512; Fs=10000;
n=(0:N-1)/Fs;
x=exp(1i*2*pi*f*n);
x=x.';
w=window(@bartlett,50);
w(N)=0;
xw=x.*w;
X=fft(x,N);
W=fft(w,N);
XW=fft(xw,N);
F=linspace(0,Fs,N);
figure;
subplot(3,1,1)
plot(n,real(x));
xlabel('n'); ylabel('x(n)'); title('Signal');
subplot(3,1,2)
plot(... |
function [lfp,lfpTime] = getLFP(varargin)
p = inputParser;
p.addParameter('filename',[],@ischar);
p.addParameter('foldername',[],@ischar);
p.addParameter('fs',20000,@isnumeric);
p.addParameter('savePrefix','',@isstr);
p.addParameter('saveit',1,@isnumeric);
p.parse(varargin{:});
%%
filename = p.Results.filename;
fol... |
parfor i = 1:test_ds.n_data
% fit image
ann = f.Reconstruct(test_ds.data{i}.ann);
rann(:,:,:,i) = ann(:,:,:,end);
end |
% Function for Root Raised Cosin Filter
% span=20;
% sps=10;
% % beta=0.35;
function [p,t,filtDelay] = srrcFunction(beta,sps,span)
Tsym=1;
t=-((span)/2):1/sps:((span)/2);
num=sin((pi*t*(1-beta))/Tsym)+((4*beta*t/Tsym).*cos(pi*t*(1+beta)/Tsym));
den = (pi*t).*(1-(4*beta*t/Tsym).^2)/Tsym;
p=1/(sqrt(Tsym))*(num./den);
p(c... |
function [name sweep num_spikes AP_max AP_amplitude AP_width] = calculate_spike_ephys_properties(Cell)
%Find the number of spikes per sweeps for spikes generated by current injection in the first 3 minutes
for i=1:length(Cell.commands(1,:))
if max(Cell.commands(:,i)) > 0 &&...
Cell.sweep_time(i)- Cel... |
function Xs=RegulaRoot(Fun,a,b,ErrMax)
fail=0;%초기값
if Fun(a)*Fun(b)>0
disp('Error');
else
Xs=((a*Fun(b))-(b*Fun(a)))/(Fun(b)-Fun(a));
for i=1:100%문제에서 100을 주라했다
if Fun(a)*Fun(Xs) <0
b=Xs;
else
a=Xs;
... |
%% initialization
% old one
impulseName = 'wav/semBigCenterImp.wav';
respName = 'wav/semBigCenterResp.wav';
%impulseName = 'wav/semBigCenterImp2.wav';
%respName = 'wav/semBigCenterResp2.wav';
scaleAmplitude = 200;
% mode analysis
nbins = 2048; % stft analysis half bandwidth, bins
nskip = 32; % stft hop size, sa... |
% Taken From ----- https://www.mathworks.com/matlabcentral/fileexchange/51047-shear-force-bending-moment
%% SFBM
function [ShearF, BendM] = ShearForceBendingMoment( varargin)
%SFBM calculates the shear force and bending moment, plot the diagram and
%computes the equations of the lines.
global Name nc... |
%%
close all;
clear all;
first_ring(1:30,1:30) = 0;
second_ring(1:30,1:30) = 0;
first_ring(4,5) = 1;
first_ring(5,4) = 1;
first_ring(5,6) = 1;
first_ring(6,5) = 1;
first_ring = awgn(first_ring,.01,'measured');
second_ring(10,10) = 1;
second_ring(11,11) = 1;
second_ring(12,12) = 1;
second_ring(13,13) = 1;
second... |
#!/usr/bin/octave -qf
pkg load communications;
addpath( 'sim', 'modell', 'common');
global c B fc T gam M N v_max v_res r_max r_res pt g k t_noise fb_max Noise_re_vect Noise_re_matr Noise_im_vect Noise_im_matr;
const;
argv1 = argv(){1};
r_max_exp= 256;
r_res_exp= 1;
v_max_exp= 128... |
function p=para1(alpha,T,k,j,r)
p= -r/gamma(2-alpha); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.