text stringlengths 8 6.12M |
|---|
%% On-line image processing core
% This script performs the necessary image processing tasks of
% microfluidic experiment (bacteria) images to obtain the cell fluorescence levels in real
% time. It is divided in 4 sections, Addition of required libraries and
% functions, Generation of ROI indexes to cut images, On-Li... |
function [x,y] = odeRK3(ODE,a,b,h,yINI)
x(1)=a;
y(1)=yINI; %yINI는 초기값이라고한다.
N= round((b-a)/h);
for i = 1:N
x(i+1)=x(i) + h;
k1=ODE(x(i),y(i));%7.83
k2=ODE(x(i)+(h/2),y(i)+(h*k1/2));
k3=ODE(x(i)+h,y(i)-(k1*h)+(2*k2*h));
y(i+1)=y(i)+((k1+(4*k2)+k3)*h/... |
%% get data
[pooldat,labelNames]=extractField_multiFile({'Circadian';'Circaidan';'labels_table'});
%{
for i = 1:length(pooldat)
pooldat(i).Circadian.id_trace.t = pooldat(i).Circaidan.id_trace.t;
pooldat(i).Circadian.id_trace.break = pooldat(i).Circaidan.id_trace.break;
end
%}
%%
npts=0; % get the m... |
function out_var=global_wmean(fieldin,vlon,vlat)
%------------------------------------------------------------
% levi silvers oct 2016
%------------------------------------------------------------
%clear longit latit latitweight glblatweight nlongit
%clear glbsumweight wgt_var out_var
l... |
function [x] = elite_guided_limit_parents(MP,x,l_map,pwm)
% Knowledge-driven strategy to reduce #parents for each vertex to MP.
% The edges to remove are determined with the Parent Weight Vector.
EP = sum(x) - MP; % #exceeding_parents
for v = 1:size(x,1)
if EP(v) > 0
l_idx = [find(l_map(:,1)==v); f... |
function beta_grf_heel = beta_grf_heel(in1,th)
%BETA_GRF_HEEL
% BETA_GRF_HEEL = BETA_GRF_HEEL(IN1,TH)
% This function was generated by the Symbolic Math Toolbox version 8.5.
% 17-May-2020 04:48:27
q1 = in1(:,1);
q2 = in1(:,2);
q3 = in1(:,3);
q4 = in1(:,4);
q5 = in1(:,5);
t2 = cos(q1);
t3 = cos(q... |
function [] = getAllSmartPoints(D)
%GETALLSMARTPOINTS creates matrix with all smarticle end points at all
%times and puts it into a datafile
% dat input is from vibDAta
%from
posOut=struct;
for(i=1:length(D))
c=fileparts(D(i).fold);
if exist(fullfile(c,'ballDat.mat'),'file')
load(fullfile(c,'ballDat.ma... |
clc;
clear all;
close all;
%----------------设置迭代参数----------------%
%设置信息量权重
a = 2;
%设置启发量权重
b = 2;
%设置信息素挥发因子
p = 0.8;
%区间缩小因子
r = 0.8;
%设置最大循环次数NC_max
NC_max = 100;
%给定蚂蚁数量
Ant_Quantity = 20;
%----------------设置目标函数参数----------------%
%设置维数
D = 2;
%上界
ub = 5;
%下界
lb = -5;
%----------------初始信息量全置为1,初始信息增量全置为0------... |
function sill1d_gui_handle = sill1d_analyze(rock, sill, welldata, result, release, codeloc)
% sill1d_analyze
%
% Postprocessing of sill model results.
%
% Developed by Karthik Iyer, Henrik Svensen and Daniel W. Schmid
%
%--------------------------------------------------------------------------
yr ... |
function a = fitparab(z,ra,rb,theta,filt)
% function [a,b,c] = fitparab(z,ra,rb,theta)
%
% Fit cylindrical parabolas to elliptical patches of z at each
% pixel.
%
% INPUT
% z Values to fit.
% ra,rb Radius of elliptical neighborhood, ra=major axis.
% theta Orientation of fit (i.e. of minor axis).
%
% OUTPUT
% a,b,c Co... |
function [logElements] = loadLogFile(fname)
% [logElements] = loadLogFile(fname)
%
% This function loads a log data file and stores it into a vector of
% structs.
%
% inputs:
% fname: logfile name (if non/invalid -> get path over ui)
% outputs:
% logElements: struct containing log element properties
% na... |
% The ; denotes we are going back to a new row.
A = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12];
% Initialize a vector
v = [1;2;3];
% Get the dimension of the matrix A where m = rows and n = columns
[m,n] = size(A);
% You could also store it this way
dim_A = size(A);
% Get the dimension of the vector v
dim_v = size(... |
function [Y] = gauss(X, miu, cov)
%Esta funcion genera las Gaussianas.
[n,m] = size(X);
e = (-1/2)*(X-miu)'*cov^(-1)*(X-miu);
d1 = sqrt(det(cov));
d2 = (2*pi)^(n/2);
d = d1*d2;
Y = exp(e)/d;
end
|
function findSplit_VC(N, L, R1, R2, splitting)
global ORG_STRUC
% this recursive function generates all possible variations
% of atom combinations with sum between R1 and R2
% example : R1=2, R2=3 - N2, N3, O2, O3, NO2, N2O, NO
% example2 : R1=2, R2=3 - N2, N3, O2, O3, NO2, N2O, NO
% N = number of atom types, L - how... |
function [p, sig, f, covp,corp,r2,rv]=mf_flsqr(x,y,err,pin,notfixed,func,fcp)
% mf_flsqr : Marquart Levenberg fit routine (fast, non graphic)
% Version 3.beta
% Levenberg-Marquardt nonlinear regression of f(x,p) to y(x)
% syntax : [p, sig, f]=mf_flsqr(x,y,err,pin,notfixed,func,{fcp})
% with fcp = [ dp niter stol ]
% Wh... |
close all; clear; clc;
% Parameters
nb_symb = 5e5;
nbps = 2; % Number of bits per symbol
constel = 'qam';
nb_bits = nb_symb*nbps;
bits_tx = randi(2,nb_bits,1)-1;
M = 50;
f_symb = 1e6; % symbols freq
fs = M*f_symb; % sampling freq
beta = 0.3;
T_symb = 1/f_symb;
nb_taps = 20*M+1;
t_shift = 1:5;
ratio_EbN0_db = -6:1:15;... |
function [] = NapTime()
while (true)
disp(['Nap time. ',num2str(20*rand(1))]);
disp(['Converged. ',num2str(6*rand(1))]);
disp(['Safe time step. ',num2str(20*rand(1)),' ',num2str(20*rand(1))]);
disp(['Cycling. ',num2str(20*rand(1)),' ',num2str(20*rand(1))]);
end
end |
Mx=20e-9; %% map X [m]
My=20e-9; %% map Y [m]
x=linspace(-Mx/2,Mx/2,Nx);
y=linspace(-My/2,My/2,Ny);
[X,Y]=meshgrid(x,y);
idx1= (abs(X)<a*sqrt(3)/2);
idx2=(tan(pi/6)*X+a>Y) .* (tan(pi/6)*X-a<Y) .* (-tan(pi/6)*X-a<Y) .* (-tan(pi/6)*X+a>Y);
idx=idx1.*idx2;
ER = idx.*adx;
%******************... |
% Este programa retorna a resposta do exercício 10 da lista 2.
disp('10) Determinar a redução necessária do motor de um elevador de cargas, sendo dado: • Motor elétrico de 1750 rpm, com redução por polias entre motor/redutor, sendo os diâmetros da polia motora e movida, de 10 cm e 20 cm, respectivamente; • Velocidade ... |
function [y,f,alphaF,alphaR] = ptDynPacejka(state,input,delT)
% parameter
m = 1466 + 82*2;
lf = 1.071;
lr = 1.724;
Iz = 2744;
g = 9.81;
% Mu = 0.8;
% Mu = ( delMat(1)^2 / delMat(2) + delMat(4)^2 / delMat(5) ) / 2;
% state
X = state(1,:,:);
Y = state(2,:,:);
vx = state(3,:,:);
vy = state(4,:,:);
yaw = state(5,:,:);
yaw... |
% Unfiltered spectrograms and dB scale frequency domain plots
subplot(2,2,1)
spectrogram(y(:,1),512,64,128,16000,'yaxis');
title('Speed 3 Inc 0');
subplot(2,2,2)
plot(f, yFreqdB(:,1));
title('Speed 3 Inc 0');
xlabel('Frequency')
ylabel('FFT (dB)')
subplot(2,2,3)
spectrogram(y(:,2),512,64,128,16000,'yaxis');
title('S... |
function visualize_denoisingDemo(d_cell, timing, title1st, sigma)
% save(fullfile('debugMATs', 'resultsSoFarGuided.mat'))
warning on
whos
im = d_cell{1};
% define the data to be plotted
noOfDenoisedImages = length(d_cell) - 1;
... |
function [stat] = statistic_analysis_TFN5(grandavg, sel)
% % %%% sel = a vector to determine the sub : [ 1 2 4 5 8 9 10]
% % %%% => removing sub 3 6 7
% % for index_task = 1 : 2
% % cfg = [];
% % cfg.keepindividual = 'yes';
% % grandavg{index_task} = ft_freqgrandaverage(cfg, data{sel,index_task});
... |
function D = spdiag(d);
D = speye(length(d));
D(find(D)) = d;
|
function x= tibshirani(H,f,t,maxIter)
% X=TIBSHIRANI(H,F,T,MAXITER)
% perform L^1 constrained reciprocity using Tibshirani's (1996) method for
% L^1 constrained least squares
%
% H: quadratic term of cost function (see Dmochowski et al. (2017),
% NeuroImage)
% f: linear term of cost function
% t: L^1 constraint
% maxIt... |
%%% MAXDISTCOLOR Demo Script %%%
% Plot the output colormap in the UCS, as a distance plot, and as colorbars with colornames.
% Some examples use CAM02 colorspace functions, which must be downloaded separately.
% The CIELAB colorspace can be used, but the results are suboptimal.
%fun = @srgb_to_Lab; % CIELAB = not... |
function plotirrdist(obl,ecc,lpe,con,earthshape,savename)
% plotirrdist(obl,ecc,lpe,con,earthshape,savename)
%
% Makes a plot of distribution of Earth's irradiance throughout the year
% and saves copy to hard drive.
%
% Input
% -----
% obl = obliquity in radians
% ecc = eccentricity of the ellipse
% lpe = longitude of ... |
%
%% cleaning
clc
close all
clear all
%% Network Architecture
% type in
neuron_num = [2;2]; % [2;2] two layers, every layer has two neurons
neuron_type = [1;1;-1;-1]; % 1 represents excitatory, -1 represents inhibitory
input_num = 1;
neuron_weight = [0 1 2 2;1 0 2 2;2 2 0 1;2 2 1 0]; % total_neuron_num b... |
function size=landwater(world,x,y)
global world
world
size=findsize(x,y);
end
function size=findsize(x,y)
global world
if world(y,x)=='M'
size=1;
world(y,x)='C';
else
size=0;
return;
end
offset=[-1 1 0 0 -1 1 -1 1
0 0 -1 1 -1 1 1 -1]... |
lMask = [];
masks_to_extract = uigetfile_n_dir();
for i = 1:numel(sPathImg)
[dImg{i},dicominfo{i}] = ReadDICOM(masks_to_extract{i});
end
counter = 1;
for j = 1:length(masks_to_extract)
lMask = main_read_mask(masks_to_extract)
end
% Das hier noch in die Schleife, um das für jede Maske zu machen
% 40% isoco... |
costs=[0.01,0.05,0.10,0.20,0.40,0.80,1.60,2.00,2.40,2.80,3.20,6.40,12.80];
for c=1:length(costs)
job=['policySearchMouselabMDPSavio(',num2str(costs(c)),')'];
job_name=['BO_Mouselab_c',int2str(100*c),'.m'];
submitJob2Savio(job,job_name)
end |
clear
clc
format long
%limites da integral de f(x)=ln(x)
a=0
b=1
Ie=b*(log(b)-1)-0%a*(log(a)-1) %calculada por limite em x=a=0
%integral de gauss legendre
for m=1:10
m
Gm=fGm10(a,b,m)
ErroexatoGm=abs(Gm-Ie)
end |
%FRET_dep_convection written 5-29-17 by JTN to simulate a 1d convection
%equation, where the rate of convection depends on the rate of MAPK
%activation
function udata = FRET_dep_convection(q_est,p,m0,m1,x,dx,xn,x_int,xbd_0,...
xbd_1,t,dt,tn,tdata,xdata,IC,IC_type,BC_x_0,BC_x_1,A_pos,A_neg)
%initialization, ad... |
function [signal, SPIOparams] = generateSe(gpudev, FFPparams, MPIparams, SPIOparams, Simparams, particleNo, div)
signal = struct;
% initialize parameters
info = h5info('./temp/PSF.h5');
dataSize = info.Datasets(2).Dataspace.Size;
zL = dataSize(1); xL = dataSize(2);
angleVecSize = info.... |
function cal = calChangeBitDepth(calfile, bitDepth)
% Change the bit depth of a PsychToolBox calibration file.
%
% cal = calChangeBitDepth([calfile], [bitDepth])
%
% INPUTS
% calfile: file name of Psychtoolbox calibration file (not including path
% or extension) [default = use GUI]
% bitDepth: bit d... |
clear all;
close all;
gpu1 = load('lib_gpu1_1thread.out');
aos = load('lib_gpu2.out');
figure(1);
x=gpu1(:,2);
y=gpu1(:,3:4);
hAxes = loglog(x,y);
% set(gca, 'Xscale', 'log');
% set(gca, 'Yscale', 'log');
%plot(aos(:,1),aos(:,2:4));
legend('CBLAS 1 thread', 'GPU 1st version' );
xlabel('Memory footprint (kB)');
ylabel... |
classdef (Abstract) Shape
%SHAPE (Abstract) Class that represents an abstract Factory for Shapes.
% This class uses the Abstract Factory design pattern.
% A Shape is a geometric property.
% Shapes are required for every Part.
%% Methods
methods (Access = public, Static)
funct... |
opt.n_p2 = {6,4,3}; % mass
opt.n_r = {3, 2, 1; % component 1: mouth
2, 1, 0; % component 2: nose
1, 0, 0; % component 3: left eye
1, 0, 0; % component 4: right eye
3, 1, 0; % component 5: jaw
1, 0, 0; % component 6: left eyebrow
1, 0... |
function [ResultStruct, ResultStructBW]=Laws_Filter(CDataSetInfo, Param)
%%%Doc Starts%%%
%-Description:
%This method is to perform Law's image filters in slice-by-slice.
%-Parameters:
%1. averWindSize: Size of the average window of Law's filters.
%-Revision:
%2016-06-14: The method is implemented.
%-A... |
%%
clear
clc
run parameter
run normalize_linearize
%%
stepsize = 1e-2;
tsim = 10;
% x = [x y z xdot ydot zdot roll pitch yaw p q r Omega_up Omega_lo a_up b_up]
Omega_lo0 = sqrt(m*g/(k_Tup*k_Mlo/k_Mup + k_Tlo));
Omega_up0 = sqrt(k_Mlo/k_Mup*Omega_lo0^2);
t0 = 0;
x0 = [0 0 0 0 0 0 0 0 0 0 0 0 Om... |
function [J, grad] = linearRegCostFunction(X, y, theta, lambda)
%LINEARREGCOSTFUNCTION Compute cost and gradient for regularized linear
%regression with multiple variables
% [J, grad] = LINEARREGCOSTFUNCTION(X, y, theta, lambda) computes the
% cost of using theta as the parameter for linear regression to fit the ... |
function [ShotStartEnd, ShotType] = videoevents_to_shots(VideoStruct, fill_thresh)
%VIDEOEVENTS_TO_SHOTS - Converts the VideoEvents structure to start-end-frame shots
% [ShotStartEnd, ShotType] = videoevents_to_shots(iseq, VideoEvents, fill_thresh)
% Fixes few indexing issues. Old version used to be defined in each cod... |
% Multi-variate conditional Granger causality calculation in time domain.
% Much faster than pos_nGrangerT2() for large (>50) variable case.
% Almost as stable as pos_nGrangerT2(), and mathematically equivalent to it.
%
% Usage (see also nGrangerT()):
% [GC, D, A2d] = nGrangerTfast(X, m, b_whiten_first)
%
% Time cost... |
%*********** clear all and get screensize *********************************
clear all; close all;
scrsz = get(0,'ScreenSize');
%**************************************************************************
%************ Compute Averages... could use cells instead... ***************
[M1(1,:) M2(1,:) M3(1,:) M4(1,:) M5(1... |
function BCaCI = CreateBCaCI(Results,BootStrap,JackKnife,Thresholds)
% from the point estimate, the bootstrap and the jacknife results return
% all of the bias-corrected, accelerated confidence intervals.
% Therefore, the whatever bootstrap estimates are calculated this function
% creates the BCa confidence intervals ... |
function upRatio = upr(ret, MAR)
%% Calculate upside potential ratio(upr) of return RET at MAR.
% MAR = minimum acceptalbe ratio, is a scalar.
%%
MAR = MAR/250;
upRatio = hpm(ret,MAR,1)/sqrt(lpm(ret,MAR,2));
end
|
function lambdaValue = lambdaFunctionLeisure(t)
% ============================================================================
% DESCRIPTION
%
% usage: lambdaValue = lambdaFunction(t)
%
% Function describing Leisure segment arrival rate of the Nonhomogeneous
% Poisson Process over time.
%
% ---------------------------... |
clear all
%% Homomorphic Filtering
% _I'd like to welcome back guest blogger Spandan Tiwari for today's post.
% Spandan, a developer on the Image Processing Toolbox team, posted here
% previously about
% <http://blogs.mathworks.com/steve/2012/09/04/detecting-circular-objects-in-images/
% circle finding>._
%
% Recently ... |
function modifyAclEntries(obj, pathVal, aclSpec)
% MODIFYACLENTRIES Modify the ACL entries for a file or directory
% This call merges the supplied list with existing ACLs. If an entry with the
% same scope, type and user already exists, then the permissions are replaced.
% If not, than an new ACL entry if added.
%
% Ex... |
clear; clc;
p = [1:0.02:2, 2.1:0.1:10, 11:1:100];
fi = 0 : pi/100 : pi/2;
x_0 = zeros(1,size(fi,2));
y_0 = x_0;
x = x_0;
y = y_0;
x_0 = cos(fi);
y_0 = sin(fi);
for i = 1:size(p,2)
for j = 1:size(fi,2)
norm = (x_0(j)^p(i) + y_0(j)^p(i))^(1/p(i));
x(j) = x_0(j)/norm;
y(j) = y_0(j)/norm;
end
plot(x,y,'k', -... |
function out = CPR_time_window(t,nSamples)
% This function extracts stimulus and joystick data in a specified time
% window at the end of a steady state
%
% Input: .t Table, Contains steady state information
% .nSamples Integer, Number of samples before direction
% ... |
% Spectrum Analysis app interface
%
% This script is a companion to the FftMatlabTest.ino sketch, which
% accepts the following serial commands from Matlab:
% cmd (0, input): sends the input array and receives the output array.
%
% Note: we are using Q.15 fixed-point format throughout this lab.
%
clear all; c... |
close all;clear all;clc;
img = imread('process/graycapture.jpg');
[M,N] = size(img);
rows = mean(img,2);
cols = mean(img)';
rows = rows-mean(rows);
cols = cols-mean(cols);
K = 1000;
[~,omg,FT,~] = prefourier([0,N],N,[0,pi],K);
col_f = FT*cols;
[~,m] = max(abs(col_f));
w = 2*pi/(omg(m));
col_p = angle(col_f(m));
[~,... |
% [ax] = plot_estimate(chi, name, window, hfig, t0, t1)
%
% Quick way to plot an estimate
% Inputs:
% chi : structure containing estimate
% name : legend label for estimate
% window : optional, averaging window (seconds), none by default
% hfig: optional, figure handle, calls gcf() if not pr... |
% layer(L).delta = (layer(L).a - target) .* layer(L).a;
%% =========== Forward : Computing Delta's : Update Weights =============
delta_W=zeros();
delta_W_last=zeros();
delta_theta=zeros();
delta_theta_last=zeros();
Accuracy_Train = zeros(1,iteration);
Accuracy_Test = zeros(1,iteration);
Accuracy_Validation = zeros(1... |
% Synetic data experiment code
% n_rep in line 37 control the repeat times of different initial points, in our experiment, we set n_rep = 20;
rng(2021);
i_iob = 1;
Jobs = {
1, 'Syn', 'Syn', [];
};
task = Jobs{i_iob,2};
s_data = Jobs{i_iob,3};
switch s_data
case 'Syn'
Datasets = {'N200R50... |
function [speechInd, LLR, params] = VQVAD(s, fs, params);
% Adaptive voice activity detector (VAD) presented in,
%
% [1] Tomi Kinnunen and Padmanabhan Rajan, "A practical, self-adaptive voice
% activity detector for speaker verification with noisy telephone and
% microphone data", to appear in ICASSP 2... |
load pngcoastline
geoshow([S.Lat], [S.Lon], 'Color', 'black','linewidth',2)
|
function [t,x] =eulerBHO(f,t0,tf,x0,n)
h=(tf-t0)/n;
t=t0:h:tf;
x=zeros(n+1,1); %reserva memoria para n+1 elementos del vector x
x(1)=x0;
for i=1:n
x(i+1)=x(i)+f(t(i),x(i))*h;
end
end |
function makeTuples( obj, key )
tuple = key;
import vis2p.*
% Load trace
trace = fetch1(Traces(key),'trace');
% Load times of the trace
times = fetch1(VisStims(key),'frame_timestamps');
% Load Stimulus info
[dotTimes, dotLocX, dotLocY, dotColors] = ...
fetchn(RFPresents(key),'dot_time','dot_loc_x','dot_loc_y',... |
function [W2] = maxSNR(EEG, alpha)
%[Inputs]%:
% EEGdata: the input EEG data for training, a 3D array with size [numCh, numT, nTrl]
%
% numCh is the number of channels
% numT is the number of samples in each channle
% nTrl is the number of trails for training
%
% LABELS: the ground truth class l... |
% Multi-variate conditional Granger causality calculation in time domain. v1.1
% Var Type Size Meaning
% X matrix p*len means p-variate data length len
% m scalar 1*1 model order desired to estimate
% GC matrix p*p causality matrix, influence direction is column -> row
% Deps matrix p*... |
function [c,ceq] = Truss25confun(X)
%
% Constraint function for the 25-bar truss optimization problem.
%
% Syntax
% [#c#,#ceq#] = Truss25confun(#x#);
%
% Description
% This function calculates the inequalities and equalities which define
% the constraints imposed on the fmincon optimization functi... |
%-----------------------------------
%
% Script for running the simulation
%
%-----------------------------------
clear all; clc; close all;
load_system('uvms_total.mdl');
disp('Loading uvms_total');
c=fix(clock);
fprintf('Running simulation at %i:%i:%i\n', c(4), c(5), c(6));
%% Mathematical parameters
d2r=pi/180;
r2d... |
function F = subfnStructFuncCogResModel2(coef,data)
% P <- A*b_A2 + S*b_S2 + CR*b_CR2 + (CR*S)*b_CRxS2 + Sum(F_pc*b_Fpc)
N = size(data,1);
N_Spc = data(1,end);
N_Fpc = data(2,end);
A = data(:,2);
S = data(:,3);
CR = data(:,4);
estF = data(:,5:5+N_Fpc-1)*coef(6:6+N_Fpc-1)';
P = data(:,5+N_Fpc);
% P = da... |
function []=plot_probabilistic(dataset, predicted_means)
figure()
scatter(dataset(:,1), dataset(:,2), 3)
hold on
scatter(predicted_means(:,1),predicted_means(:,2),40,'MarkerEdgeColor',[0.6350 0.0780 0.1840],'MarkerFaceColor',[0.6350 0.0780 0.1840],'LineWidth',1.5);
predicted_means(1,:)
pred... |
% Foundation Class: SYEnumerator < SYObject
% Written by Satoshi Yamashita.
% Fundamental Class enmuerating entries in an SYArray and return nan at
% the end.
classdef SYEnumerator < SYObject
properties
array = nan; % SYArray.
index = nan; % double.
end
methods
function obj = SYEnumerator(array_)
% Foundation... |
%% load fit data
fitdir = '20150615';
fitbasedir = 'data';
figDir = '~/Dropbox/gaborMotionPulseASD/figures/Figure02_ASDmethods/';
ff = @(mnkNm) fullfile(fitbasedir, [fitdir '-' mnkNm], 'fits');
vn = tools.makeFitSummaries(ff('nancy'), true, 'ASD');
vp = tools.makeFitSummaries(ff('pat'), false, 'ASD');
vu = [vp vn];
%... |
function c = mmult(a, b)
% multiplies two matrices
c = a * b;
end |
function r = eq(a, b)
% == Equal.
% (Quaternion overloading of standard Matlab function.)
%
% If one of the operands is not a quaternion and the other has zero vector part,
% the result is obtained by comparing the non-quaternion operand with the scalar
% part of the quaternion operand.
% Copyright © 2005, 2010 Steph... |
function [logEvi, sigmaInv, B, isNewBasis] = logEvidence(X, Y, XX, YY, XY, Reg, ssq, p, q)
%
% XX is X.T.dot(X) - m x m
% YY is Y.T.dot(Y) - 1 x 1
% XY is X.T.dot(Y) - m x 1
%
[RegInv, B, isNewBasis] = asd.invPrior(Reg);
if isNewBasis
q2 = size(B, 2);
XB = X*B;
XBXB = XB'*XB;
s... |
cd /Users/Juraj/Dropbox/USI/PhD/various/GridTools
%size of the problem
N = 40;
%iteration count
max_iter = 20;
%build 3D laplace matrix
[~,~,A] = laplacian([N N N]);
%spy(A)
%initial guess
x = zeros((N)^3,1);
%rhs vector
b = ones((N)^3,1);
%residual
r = b - A*x;
%search direction
d = r;
%set initial residual
re... |
function [filtered] = bandfilter(N, x, fs, band)
filtered = zeros(size(x))
for i = 1:N
filtered(:,i) = bandpass(x(:,i),band,fs)
end
end |
function RHS = hybrid_RHS(var,sim_obj,par)
%This script computes the ODE RHS for the full metabolism model
RHS = zeros(size(var));
m1_ext = var(1);
m2_ext = var(2);
m1 = var(sim_obj.m1_ind);
m2 = var(sim_obj.m2_ind);
E1 = var(sim_obj.E1_ind);
E2 = var(sim_obj.E2_ind);
con_rate = min([m1,m2],[],2);
%If V = 0 simu... |
function [S,pt_holding] = cbo(oldS,t,pt_holding,n,x,c,b,Prices)
% This code is partially ported C++ code in Bajgrowicz and Scaillet(2012).
% http://www.sciencedirect.com/science/article/pii/S0304405X1200116X
% Also refer STW(1999) for more details
% http://onlinelibrary.wiley.com/doi/10.1111/0022-1082.00163/abstrac... |
%% CASO PRACTICO : ENFERMEDAD DEL EBOLA
% Inicializo los valores del tiempo en dias proporcionados
% por la tabla de la OMS.
dias=[239,234,232,219,215,212,206,204,200,197,193,190,185,183];
dias=[dias,181,176,168,162,156,151,149,147,144,142,140,137,135];
dias=[dias,132,130,127,123,120,117,114,112,108,106,102,100,90];
d... |
function [image_ii_norm,image_ii] =integral_image()
% the function takes the array of the normal image >> image
% return the integral image >> image_ii
image=imread('cameraman_noise.tif');
image=double(image); %increasing the range of the image from unit8 to double size to allow the calculation of integral image
ima... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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,... |
function [p, d] = bplpva(h, boundaries, bmin, varargin)
% BPLPVA calculates the p-value for the given power-law fit to some data.
% Source: http://tuvalu.santafe.edu/~aaronc/powerlaws/bins/
%
% When using binned data, the data vector 'h' is assumed to
% contain histogram counts between bin edges 'boundaries'.
% ... |
%step 0: clears memory and graphics window
clear
clc
clf
load N1point44trialAfterSplit23.mat
nooise = 0.0001;
jt=1;
while numberofturns > 0
%step 1: calculating the time part of electric field
def = dt*(((1-1i*palpha).*DcarG+ (1-1i*pbeta).*dcarA-1).*ef + nooise*rand(dimx,dimz));
dDc... |
function [ status, message ] = op_Spiral2Img( data_handle, option, varargin )
%op_Spiral2Img converts spiral/tornado linescan into standard XY images
% --- Function Library ---
parameters=struct('note','',...
'operator','op_Spiral2Img',...
'ref_dataindex',[],...
'ref_scanline',[],...
'bin_dim',[1,1,1,1... |
function [A,s,o] = variable3(E,A,s,eta)
global P;
global 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 ... |
function E = pairwiseFullClayton_v2(info,p_id,q_id,q,nx,np)
[Pr,Pq] = updatePr(info,q_id,q,nx); % calculate current probability for each object
Pr(Pr==0)=1e-18;
E = sum(-Pr.*log2(Pr));
if ~sum(Pr==1)>0
% pick the next query that minimizes the expectation of entropy
a = 1:np;a(q_id)... |
%%
% g3 = sqc.wv.gaussian(30);
% % g3 = [qes.waveform.spacer(10),copy(g3)];
g1 = sqc.wv.gaussian(20);
g2 = sqc.wv.gaussian(80);
g3 = sqc.wv.gaussian(30);
% g3 = [g1,g2,g3];
% g3 = [copy(g3),copy(g3)];
n2p = nextpow2(g3.length)+1;
numpts = 2^n2p;
fs = 1;
timeSpan = numpts/fs;
% calculate frequency domain sample by fft... |
close all;
clear all;
tic;
subfolders = dir( 'data\zz\' );
kk = 1; %ignore the . and ..
for i = 1 : numel( subfolders )
if( isequal(subfolders(i).name, '.')||...
isequal(subfolders(i).name, '..')||...
~subfolders(i).isdir)
continue;
else
specimen_index(kk) = subfolder... |
x=[1, 1; 2,2];
Gains = [0.96, 1.16; .87, 1.03];
%error = [0.90; 0.09; 0.11; 0.07; 0.12; 0.05; 0.11; 0.09 ];
% interval_lower= [0.1,0.1; 0.13, 0.1];
% interval_upper= [0.08, 0.1; 0.16, 0.1];
width=0.7;
bar(Gains,width,'FaceColor',[1.0,1.0,1.0],'EdgeColor',[0 .01 .01],'LineWidth',8);
% set('BarWidth',0.8);
ylabe... |
%Muller MM2 method
x = linspace(-2, 5, 16);
nb = 0;
result = 0;
p = 0;
for i=1:size(x',1)
[y, iter(i)] = MM2_final(x(i),10e-10);
for j=1:size(result' ,1)
if abs(result(j) - y) > 10e-10
nb = nb + 1;
end
end
if nb == size(result', 1)
p = p + 1;
result(p) = y... |
function []=Automaton(A,B,C,L)
% A 地形矩阵:所有障碍物的值为99999,其余为0
% B 势能场分布图
% C 人员矩阵:初始时人员的分布,所有人的坐标为99999,其余为0
human = 99999;
for g=1:500
pause(0.1);
% 200次肯定可以结束,可以尝试用while,这里懒得了……
%imshow(max(A,C)==0,'InitialMagnification','fit')%取最大的作为人员在教室的分布,以及给出教室轮廓和障碍物图像
Graph=255*ones(size(A,1),size(A,2),3);
for ... |
fig1=figure()
dep=[bzip2.ProcPwr cactusadm.ProcPwr gromac.ProcPwr lbm.ProcPwr omnetpp.ProcPwr perlbench.ProcPwr];
plot(bzip2.Time,dep);
legend('bzip2','cactusadm','gromac','lbm','omnetpp','perlbench');
axis([0 2100 60 75]);
xlabel('Time (s)');
ylabel('Processor Power (w)');
%
fig2=figure();
depw=[bzip2.Watts cactusadm... |
function [y] = nb_test(nb, X)
% Generate predictions for a Gaussian Naive Bayes model.
%
% Usage:
%
% [Y] = NB_TEST(NB, X)
%
% X is a N x P matrix of N examples with P features each, and NB is a struct
% from the training routine NB_TRAIN. Generates predictions for each of the
% N examples and returns a 0-1 N x 1 vec... |
function c = flatten_cell(c)
if iscell(c)
c = cellfun(@flatten_cell, c, 'uniformOutput', false);
if any(cellfun(@iscell,c))
c = [c{:}];
end
end
end |
function [ out ] = small( mat , s )
%small reduces the input vector to size 's'
% Detailed explanation goes here
out=[];
step=floor(size(mat,1)/s);
for i=1:s
out=[out ; mean(mat((i-1)*step+1:i*step,1))];
end;
end |
function Pair = PivotName(Data,Pair,ac_er_ang, ac_er_dis,i,j,k)
[dis1,dis2,agl] = StarPair(Data,i,j,k);
%Elimination by angle
aglmin = agl - ac_er_ang;
aglmax = agl + ac_er_ang;
Pair(:,7) = (Pair(:,6)>aglmin)&(Pair(:,6)<aglmax);
Pair = Pair(Pair(:,7)>0,:);
%Elimination by distan... |
%input for simulation ending march03, called d.mat
alphas = [11.25 33.75 56.25 78.75]
sd = [8 16 24 32]
ntrials = [20 40 80 100 160 500]
for i=1:length(alphas)
bias(i,:,:) = squeeze(mean(log10(alphas(i)/abs(d.alpha(:,i,:,:))),1))*20
end
%plots d.alpha in two subplots (one increasing alpha, one increasing
%SD)... |
function y = LSA(A,D)
%whether the input parameters satisfy the pattern forming condition from linear stability analysis (Page 11 of support Kondo paper)
%only support one instance, A is a matrix, D is a vector
y = (trace(A)<0) && (det(A)>0) && (A(1,1)*D(2)+A(2,2)*D(1)>0) && ((A(1,1)*D(2)+A(2,2)*D(1))^2 - 4*D(1)*... |
function y = gradcheck()
y=1;
if hgradd>-22.5 && hgradd<=22.5
% imgclean(yloc,xloc:xloc+k)=imgclean(yloc,xloc+k);
elseif hgradd>22.5 && hgradd<=67.5
elseif hgradd>67.5 && hgradd<=112.5
elseif hgradd>112.5 && hgradd<=157.5
elseif abs(hgradd)>157.5 && abs(hgradd)<=180
elseif hgr... |
% This program tries to evaluate the optical cavity transmission
% function in frequency and time space. The reference paper is:
% "Response of a ring-down cavity to an arbitrary excitation"
% Hodges, JT; Looney, P; van Zee RD.
% J. Chem. Phys., 105, 10278, (1996)
% In particular, I assume an initial gaussian exci... |
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function [V1, V2] = lambert(R1, R2, t, mu, string)
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%{
This function solves Lambert's problem.
mu - gravitational parameter (km^3/s^2)
R1, R2 - initial and final position vectors (km)
r1, r2 - mag... |
function plotTimeFreq(theFillInTheBlankGram,freqs)
% FUNCTION plotTimeFreq(theFillInTheBlankGram,freqs)
%
% theFillInTheBlankGram: time by freq (i.e. time along first dim)
% freqs: vector of freqs
% length=size(theFillInTheBlankGram,2)
secondsPerFrame=0.008; % Assumption
fMarkers=[250 500 1000 2... |
%% Code for panels A-H for Figure 4
%% Panel A
load('Figure4Data')
figure
imagesc(expData(4).MeanPhase)
axis square
map = colorcet( 'C2' );
map = circshift(map,1);
colormap(map)
c = colorbar;
hold on
c.Label.String = 'Best Phase (rad)';
ylabel('MUA Channel')
xlabel('LFP Channel')
set(gca,'fontsize',14,'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.