text stringlengths 8 6.12M |
|---|
function [R,T] = SDstat(M,Idc)
%SDstat Strength-Duration Statistics (Rheobase and SD-Time)
% [R,T] = SDstat(M,Idc) this function estimates the statistics of the strength-
% duration curve with Weiss's law. It returns the rheobase [R] and the
% strength-duration time constant (SD-Time). These are estimated for a ... |
function [x,y,x_fil,v_fil,t] = filtro_g_h_0(x0,v,T,N,s_x,g,h)
%Aplica un filtro g-h de coeficientes constantes a un móvil con dinámica
%MLU. Se asume un error de medida gaussiano de media nula.
%Parámetros de entrada:
%x0: posición inical del móvil en t=0 (en metros).
%v: velocidad del móvil (en metros p... |
function val=penalty(ind)
%%
%适应度函数:为目标函数的相反数,越大适应度越大
global RHOo;
global MUo;
global Bo;
global RHOw;
global MUw;
global Bw;
global Swi;
global Sor;
global N;
global Np;
global fw;
global Sw;
global R;
aw=ind(1);
bw=ind(2);
ao=1;
bo=ind(3);
%R=Np/N;
%Sw=R*(1-Swi)+Swi;
R=(Sw-Swi)/(1-Swi);
Krw=aw*((Sw-Swi)/(1-Swi-Sor)).... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
function makeFrameByStripes(~,evnt)
%% function makeFrameByStripes(ai, SamplesAcquired)
% This is the 'SamplesAcqiredFcn' for GRAB/LOOP mode operation
% Takes data from data acquisition engine and formats it into a proper intensity image.
% Function also handles averaging, tracking of # frames/slices, and disk-logging ... |
function [SI_one_slice,Mz] = simu_steady_state_with_motion(flip_angle_slice,Mz,M0,TR,Slab_T1,max_disp,heart_rate)
T = 1:3000; % number of alpha pulses
total_time = T(end)*TR/1000;
Ncycle = total_time/60*heart_rate;
max_disp = 100*max_disp; % one slice thickness = 200 pixels
Motion = round(sin(T/T(end)*Ncycle*2*pi)*max_... |
function outLabel=deblend_Multi(imlocal,imlocal_BW,DEBLEND_MINCONT,DEBLEND_NTHRESH)
% This function is for deblending the touching or overlapping objects by
% using the multi-threshold method,and using the watershed method to assign
% the outlying pixels which have a flux lower than the separation thresholds
% to the... |
% An example of 3-D plot
% surf_eg.m
x = linspace(-1,1);
y = linspace(0,1);
[X,Y] = meshgrid(x,y);
Z = X.^2 + Y;
surf(X,Y,Z)
% plot3_eg.m
t = linspace(0,10*pi);
plot3(sin(t),cos(t),t);
grid on
axis square
% create a movie
fps = 15;
t = linspace(0,6,6*fps);
x = linspace(0,2*pi);
h = figure(1);
clear M;
% plot and save... |
function [Dinit,Xinit] = INITdic(trData,H_train,dictsize)
% initialization for D and X
% Input:
% trData -each column is a training sample
% H_train -a one-hot binary matrix (size: nClass * nSmp)
% dictsize -number of columns in the dictionary
% Output:
% Dinit -initialized dictiona... |
function Ex = function_energy(vector)
Ex=sum(abs(vector).^2);
end
|
function blm = crmbck(data, model_specs, n_steps)
%CRMBCK Fit Bayesian censored heteroscedastic linear model.
% BLM = CRMBCK(DATA, MODEL_SPECS, N_STEPS) returns BLM, a
% structure containing a Bayesian linear model object.
%
% DATA is an m by n+1 matrix of observed values, where m is the number of
% observation... |
%Filtering - Q2-c
%Testing the Single pole IIR Filter with various parameters
%submitted by Deepak Gopinath - 903014581
x1 = rand(44100*2,1); %Generate 2 seconds of white noise
y1 = SinglePoleIIR(1, 0, x1); %Call the filter functions
y2 = SinglePoleIIR(0.5, -0.5, x1);
y3 = SinglePoleIIR(0.1, -0.9, x1);
subplot(3,1... |
% fit_Lotka_Volterra_same_r.m
%
% Function to fit a two-species Lotka-Volterra competition model to population data.
% Force same growth rate (r) for both groups
%
% Force N0, t_lag as user-input values
%
% See notes, 2, 4, 9 Oct. 2013; 30 Oct 2013 on weighting
% Dec. 10, 2013
%
% uses boxcarpad.m... |
[m,n] = size(data) ;
P = 0.70 ;
idx = randperm(m) ;
Training = data(idx(1:round(P*m)),:) ;
Testing = data(idx(round(P*m)+1:end),:) ;
[Rm,Rn] = size(Training);
Rr = 1+(Rm-1).*rand(1,1);
[Em,En] = size(Testing);
Er = 1+(Em-1).*rand(1,1);
[Rm,Rn] = size(Training);
Rr = round(1+(Rm-1).*rand(1,1),0);
[Em,En] = ... |
function [ desired_state ] = trajectory_generator1(t, qn, map, path)
% TRAJECTORY_GENERATOR: Turn a Dijkstra or A* path into a trajectory
%
% NOTE: This function would be called with variable number of input
% arguments. In init_script, it will be called with arguments
% trajectory_generator([], [], map, path) and late... |
function [hn] = sbesselh1(n,kr)
%% sbesselh1: spherical Hankel function of the first kind
% sbesselh1 - spherical hankel function hn(kr) of the first kind
%
% Usage:
% hn = sbesselh1(n,kr)
%
% hn(kr) = sqrt(pi/2kr) Hn+0.5(kr)
%
% See besselh for more details
%
% PACKAGE INFO
kr=kr(:);
n=n(:);
[hn] = besselh(n'+1/2,1,... |
function diffSum=pvDiffSum(pv)
% pvSimilarity: Similarity between two pitch vectors
% Usage: [recogRate, absAveError, correctCount, pitchCount]=pvSimilarity(cPitch, tPitch, pitchTol, plotOpt)
% cPitch: computed pitch
% tPitch: target pitch
% pitchTol: pitch tolerance for computing the recog. rate
% plotOpt: 1... |
function j = cost2(x,y,theta,h1) % Cost Function
j = 0;
m = length(x);
for i = 1:m
j = j + y(i,:).*(-log(h1(x(i,:),theta))) + (1-y(i,:)).*(-log(1-h1(x(i,:),theta)));
end
end
|
function select = peakFilter(initiallocs, currentlocs, N, ison)
% this function scans the currentlocs input one by one until find out a loc
% that a certain neighbourhood of N centered at 2*loc and 3*loc contains
% peak as well, and select that loc as bass
% input: currentlocs
% output: select
% algorithm:
% - select... |
% Charge depletion plots for report
tau1 = 2884.3;
tau2 = 840.3;
tau3 = 2659;
tau4 = 26.6;
t = 1:1200;
minutes = t/60;
Qratio1 = exp(-t/tau1);
Qratio2= exp(-t/tau2);
Qratio3 = exp(-t/tau3);
Qratio4= exp(-t/tau4);
figure(15)
hold off
plot(minutes, Qratio1, 'LineWidth', 2,'color',[0 0.7 0])
hold on
plot(minutes, Qr... |
cd C:\shared\ArterialVisualTask
tof = load_untouch_nii('avg.nii.gz') ; |
function project_svm(M)
fprintf('SVM classification of the diabetes set\n');
X = M(:,1:8);
Y = M(:,end);
% Data parameters
m = size(X, 1);
n = size(X, 2);
% map y =0 to y = -1
Y(Y==0) = -1;
indices = crossvalind('Kfold',m,10);
accuracy = 0.0;
for i = 1:10
test = (indices == i); train = ~test;
model =... |
%Function to plot circular obstacles
function [] = plotObstaclesCircle(circular_obstacles_struct, ax)
for i=1:length(circular_obstacles_struct)
obs = circular_obstacles_struct{i};
rectangle(ax, 'Position', [obs(1) - obs(3), obs(2) - obs(3), 2*obs(3), 2*obs(3)], 'Curvature', [1, 1], 'FaceColor', 'b');
end
|
% this function performs accoding to moving Burst Frequency:
% Inter burst intervals are calculated and moving BUrst Frequency (rate) is
% calcualted) --- algorithm accoding to getBurst_movFR_NB
function [lBurstStart,lBurstStop,shStart,shStop] = getBlocks_slope(burstStart,burstStop,spikeVec, varargin)
%default
a... |
clear;
clc;
%part a
z1 = 5 + 25j;
z2 = -3 - 12j;
z3 = z1 * z2;
re = real(z3);
im = imag(z3);
[angle, pole] = cart2pol(re, im);
angle = angle * 180 / pi;
fprintf('angle:%4.4f\nmag: %4.4f\n\n', angle, pole);
%part b
z4 = conj(z1) / (2 * z2)
clear;
|
close all;
clear all;
addpath('/Users/woodie/Desktop/Compressed-Sensing-Delay-Estimation/matlab/lib');
%% Preliminary
% Parameters
Fs = 50; % Sampling rate
Ts = 1.0 / Fs; % Time interval
low_freq = 1;
high_freq = 3;
acc = 100; % The accuracy of the downsampling
times = 200; ... |
cd c:/shared/utef/jeremie; ls
locs = load_untouch_nii('color_locs.nii.gz') ;
raw = load_untouch_nii('dof12_jeremie.nii.gz') ;
for i=1:65
[cx,cy,cz] = centmass3(locs.img==i) ;
locimg(i,:,:,:) = squeeze(raw.img(cx-10:cx+10,cy-10:cy+10,cz-10:cz+10)) ;
end
for i=1:65 ; figure ; for j=1:21 ; subp... |
%
% Generates the time series of a population that obeys the
% following simple rules. In each generate, three things can
% happen to an individual. There is a 10% chance that the
% individual dies, a 50% chance that the individual produces
% an offspring, and a 40% chance that nothing happens.
%
function p = pop(p0)
... |
%% Q.2 Use tauchen.m to generate 21 grids for p_t
N = 21;
[prob,grid] = tauchen(N,0.5,0.5,0.1)
%% Q.3 Plot the value of firm depending on the initial stock and current price p = 0.9, 1, 1.1
% Use value function iteration
S = 100;
delta = 0.95;
V_ini = zeros(N, S + 1);
prob = prob';
V = zeros(N, S + 1); % V(i,j) maxi... |
addpath('kinematics')
addpath('test')
addpath('vis')
addpath('dynamics')
addpath('dynamics/autogen')
addpath('control')
addpath('hybrid') |
rate = 100;
Tmax = 10;
dt = 0.001;
T = linspace(0,Tmax,Tmax/dt);
mu = 0.05;
kappa = 5;
alpha = 0.04;
gamma = 0.5;
rho = -0.5;
cov = [1,rho;rho,1];
dW = sqrt(dt)*(1/sqrt(2))*cov*randn(2,length(T));
X = zeros(1,length(T));
v = zeros(1,length(T));
Y = zeros(1,length(T));
eta = 0.1*randn(1,length(T));
... |
% %% CODE
% % Initial input data
% % Add paths
% % Input "ctrl" variable
% % Read input files
% % Compute idx for the different alternatives of time
% % Sampling combinations (or designs)
% % Apply PreDIA
% % Compute BME diagonal
% % Save results
% % Plot results
%
% %% Initial input data
clc
clear
format compact
% mu... |
function d2fdxdpval = genlin_d2fdxdp(t,y,p,more)
% GENLIN_D2FDXDP computes second partial derivatives of values of fits to
% observations at time t with respect to state values in Y and
% parameter values in P
% Observations are related to variables by the equation
% Fit = Ay + Bf where y is the column vector of s... |
function [contar] = histograma_simbolos(fonte, titulo)
%cria o histograma
close all;
alfabeto = unique(fonte);
contar = contar_ocorrencias(alfabeto, fonte);
bar(alfabeto, contar);
%output = contar;
title(titulo);
xlabel('Alfabeto');
ylabel('Numero de ocorrencias');
end
|
clc;
clear;
close all;
s = [1 1 2 2 3 3 5];
t = [2 3 4 5 6 7 8];
weights = [0 0 0 0 0 0 0];
names = {'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H'};
G = digraph(s,t,weights,names);
h = plot(G,'Layout','force'); |
% Generate Matlab Code for given action matrix and coefficient matrices
% (GBsolver subroutine)
% by Martin Bujnak, mar2008
function [res] = gbs_ExportMCode(filename, M, Mcoefs, coefscode, known, knowngroups, unknown, algB, actMvar, amrows, amcols, gjcols, aidx)
[p probname e] = fileparts(filename);
if isemp... |
%---------------------------------------------------------------------
%load toscahires-mat/cat0.mat
% load toscahires-mat/cat1.mat
% load toscahires-mat/cat2.mat
% load toscahires-mat/cat3.mat
% load toscahires-mat/cat4.mat
%names = dir('toscahires-mat/cat*');
function [X, E, trigs] = load_data(surface)
trigs = surf... |
clc
clear
close all
% Matric A0138993L
% Classes chosen: 9 and 3
load('characters10.mat');
%imshow(reshape(train_data(2997,:), [28,28]));
train_idx = find(train_label == 3 | train_label == 9);
% 9 --> 1 and 3 --> 0
TrLabel = train_label(train_idx);
TrLabel(TrLabel == 9) = 1;
TrLabel(TrLabel == 3) = 0;
train_x = trai... |
function [X,Y,Z] = genPointCloud(xx,yy,idepths)
w = 640;
h = 640;
X = [];
Y = [];
Z = [];
ratio = 540.0/640.0;
fx = ratio*w;
fy = ratio*h;
cx = w/2.0;
cy = h/2.0;
K = zeros(3,3);
K(1,1) = fx;
K(1,3) = cx;
K(2,2) = fy;
K(2,3) = cy;
K(3,3) = 1.0;
xyz = [];
for row = 1:length(yy)
for col = 1:length(xx)
xyz... |
%Open Loop Indoor crane anti-sway control
%Assumptions:
%Zero disturbances
%Negligible string elongation
%Zero friction
%Small deviation of theta
%Neglect effect of initial jerk
clc
clear all
close all
global M m l g D t1 t2 Vmax w T thetamax a_max a a1 n tmid t_total t_total1 t_total2 V_average V2... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% script that simulates behavior of connectome via a network of delay-coupled %
% neural mass models with subsequent lesioning of critical nodes %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function criteria_list = get_criteria_list(session_instance)
% GET_CRITERIA_LIST - Return the names of the database fields that may be used
% as optimization criteria. Such fields should fill the followig conditions:
% 1) Be a feature field in the knowledge instance;
% 2) Have a compute_ method implemented in the 'fe... |
clear all
close all
clc
%%画出函数图
figure(1);
lbx=-2;ubx=2;%函数自变量范围[-2,2]
lby=-2;uby=2;
ezmesh('x*cos(2*pi*y)+y*sin(2*pi*x)',[lbx,ubx,lby,uby],50);%画出函数曲线,有范围的画图都是这样
hold on;
%%定义遗传算法参数
NIND=40;%种群大小
MAXGEN=50;%最大遗传代数
PRECI=20;%个体长度
GGAP=0.95;%代沟
px=0.7;%交叉概率
pm=0.01;%变异概率
trace=zeros(3,MAXGEN);%寻优结果的初始值
FieldD=[PRECI P... |
function sectmap = readsectmap(mapfile)
%read the output of "sectormap" command of MAD to obtain
%the sector map (6D)
%across each element or range, there is a R (6x6) matrix or the usual transfer
%matrix and a T (6x36) matrix, which is the second order TRANSPORT matrix.
%If we rearrange each row of T to a 6x6 matrix... |
%% Metric Rectification Method 2. We will not use the affinely rectified but the original perspective image in this case.
I = imread('building.jpg');
imshow(I);
[x,y] = getpts;
P = [x y ones(1,15)']; %Please use three points to form an intersection of orthogonal lines
% saveas(gcf,'z 1.png')
%%
hold on
% Use the 5 pair... |
%==========================================================================
%
% Properties of the Functional Central Limit Theorem for various moments
%
%==========================================================================
clear all
clc
RandStream.setDefaultStream( RandStream('mt19937ar','seed',15) );
ndraws ... |
function [ output_args ] = supermatrix_struct( table )
if numel(table) == 1
[r,c] = size(table);
br = 0;
bc = 0;
else
br = size(table, 1);
bc = size(table, 2);
r = 0;
c = 0;
for i = 1:br
r = r + size(table(i,1), 1);
... |
files = dir('*.fig')
i = 0;
while (i < length(files))
save = files(i + 1).name;
fig = openfig(save);
ax = gca;
ax.TitleFontSizeMultiplier = 1;
saveas(fig, strcat(save(1:end-4), '.png'), 'png');
i = i + 1;
end
|
function show(obj,hf)
if ~isempty(obj.FigureHandle)
if ~ishandle(obj.FigureHandle)
obj.close;
else
figure(obj.FigureHandle)
return
end
end
% Deal with figure
if nargin < 2
% Create main figure
hf = figure('Position', [ obj... |
function megaffx = ibma_config_mega_ffx()
% IBMA_CONFIG_MEGA_FFX Define the matlabbatch job structure for third-level
% of a hierarachical GLM using FFX (at the third-level only).
% megaffx = IBMA_CONFIG_MEGA_FFX() return the matlabbatch configuration
% to run Fisher's meta-analysis.
%
% See also IBMA_CONFIG_FI... |
clc; clear; close all
pkg load image;
pkg load video;
% Ejemplo de video
clc; clear; close all
pkg load image
pkg load video
function P_ = MVDM(P)
P = sort(P);
P_ = P(2);
if P(2) == 0
P_ = P(3);
end
if P(3) == 255
P_ = P(1);
end
end
function A_ = FMFA(A)
[H, W] = size(A);
A_ = zeros(H, W);
fo... |
function [ I, I_l ] = Location_Loop( z_ft_abs, d, k, B, n )
%UNTITLED10 この関数の概要をここに記述
% 詳細説明をここに記述
z_sort = sort(z_ft_abs,'descend');
J = zeros(d*k,1);
for i = 1:d*k
j = 1;
while z_ft_abs(j) < z_sort(i)
j = j + 1;
end
J(i) = j;
z_ft_abs(j) = 0;
end
... |
function tab = tableOfQuantiles(muoEle, njets)
%function tab = tableOfQuantiles(muoEle, njets)
[X w] = getLeptonJetsRamData(muoEle, 2:18, 'njets', njets);
p1 = 0.025;
p2 = 0.975;
p1 = 0.005;
p2 = 0.995;
tab = [];
for v = 1:size(X,2);
x = X(:,v);
% filter out NaNs
arenan = isnan(x);
wf = w(~arenan);
xf = x(... |
function update = patch_ttv(Image,llr,para)
Image = permute(Image,[1,2,4,3]);
patch_all = Image(llr.idx);
update_tv = compute_tTV_yt(permute(patch_all,[1,3,2]),para.Recon.weight_tTV,1e-7);
update_tv = permute(update_tv,[1,3,2]);
update_t = zeros(size(Image),'like',Image);
for i=1:llr.Npatch
update_t(llr.idx(:,:,... |
function opts = trainingOptions(solverName, varargin)
% trainingOptions Options for training a neural network
%
% options = trainingOptions(solverName) creates a set of training options
% for the solver specified by solverName. Possible values for solverName
% include:
%
% 'sgdm' - Stochastic gradient ... |
load alldataFilteredTargets
HEOL = [];
HEOR = [];
VEO = [];
for sub = 1:size(masterdata,1)
for con = 1 % :size(masterdata,2)
if size(masterdata{sub,con,30,1},1) == 750
HEOL =[HEOL; masterdata{sub,con,30,1}'];
else
HEOL =[HEOL; masterdata{sub,con,30,1}];
end
... |
clc
clear all
close all
mex -setup cpp
codegen problem_exact_integrals_eastwest_M1_code.m -args {zeros(1,1),zeros(1,1),1.0,1.0}
|
data.A = sparse(A);
data.b = full(b);
data.c = full(c);
params_copl = struct('max_outiters', 100, 'max_iters', 10000);
[x, y, s, info_copl] = copl_matlab_large(data,params_copl);
|
% Author: X.GAO
function [img_rot] = pre_rotate(image)
% rotation invariant
pixel_sum = sum(sum(image~=0));
C = zeros(2,pixel_sum);
count = 1;
for j=1:size(image,1)
for z=1:size(image,2)
if(image(j,z)~=0)
C(1,count) = z;
C(2,count) = j;
... |
function x=outputHDD(Table1,min1, max1, Table2,min2, max2)
while min1<max1
while min2<max2
if Table2.Time(min2)==Table1.Var4(min1)
Table2.Var15(min2)=Table1.HeatingDegreeHours(min1);
end
min2=min2+1;
end
min1=min1+1;
end |
function [windows , n] = create_window(y_whole , Fs , window_length , overlap_length)
n = 0;
windows = [];
window_size = floor(Fs*window_length);
overlap_size = floor(Fs*overlap_length);
t = 0 : 1 : window_size-1;
ham_win = 0.54 - 0.46*cos(2*pi*t/(window_size-1));
y_lengt... |
%%%%% BIG BOX
bigbox = shape;
bigbox.height = 1700 / 100;
bigbox.width = 2350 / 100;
bigbox.type = 'rectangle';
%%%%% MID BOX
midbox = shape;
midbox.height = 1400 / 100;
midbox.width = 2000 / 100;
midbox.type = 'rectangle';
%%%%% SMALL BOX
smabox = shape;
smabox.height = 1350 / 100;
smabox.width = 1400 / 100;
smabox.... |
function hOut = plotRegressionWithCI(model, coefInds, figHandle, varargin)
p = inputParser;
p.addParameter('LineWidth', 2)
p.addParameter('LineStyle', '-')
p.addParameter('XOffset', 0)
p.addParameter('Color', [0 0 0]);
p.parse(varargin{:});
if nargin < 3
figure
else
subplot(figHandle)
end
coef... |
%% Example 2
clear
A =0.5*randn(2,2);
B = randn(2,1);
C = randn(1,2);
network.weight = {randn(5,2),randn(1,5)};
network.bias = {randn(5,1),randn(1,1)};
network.activeType = {'tansig','purelin'} ;
%save data_1 network A B C
load data_1 network A B C
run('generateFun.m')
%load data network net
input.min = -0.5;
input.m... |
%% Basic test
% Create a polar flow
dr = @(t, r) -r(1);
dtheta = @(t, r) 3;
dy_pol = @(t, r) [dr(t, r); dtheta(t, r)];
% Translate to cartesian
dy_calc = polToCartFlow(dy_pol);
% Check results
dy_exact = @(t, y) [-y(1)-3*y(2); -y(2)+3*y(1)];
y_eval = [1; 2];
calculated = dy_calc(0, y_eval);
expected = dy_exact(0, y_... |
function [laneSectionNr, laneID,roadID] = isOnRoad(obj,point)
%ISONROAD Check if a point is located within a road
% Return the laneID, lanesectionNR and roadID if point is within road
%
%----------------------------------------------------------------------
% BSD 3-Clause License
%
% Copyr... |
function [new_ac_pos] = aircraft_simulator(ac_pos, ac_vel, ac_vel_std, dt)
%AIRCRAFT_SIMULATOR Summary of this function goes here
% Detailed explanation goes here
dx = ac_vel*dt + (randn() * ac_vel_std) * dt;
new_ac_pos = ac_pos + dx;
end
|
function pa_pet_originset(file,origin,varargin)
% PA_PET_ORIGINSET(FILE,ORIGIN)
%
% Set the origin of the brain data FILE (in NIFTI format)
%
% PA_PET_ORIGINSET(...,'PARAM1',val1,'PARAM2',val2) specifies optional
% name/value pairs. Parameters are:
% 'display' - display the brain data before and after origin set... |
classdef SegmentationLoss < dagnn.Loss
properties
numClass = 21;
end
methods
function outputs = forward(obj, inputs, params)
predictions=inputs{1};
true_labels=inputs{2};
%true_labels=cat(4,true_labels{:});
true_labels=true_labels(:,:,[1],:);
mass = sum(su... |
function robotsPerNeighbors = experiment_stats(simulation)
%
% INPUT:
% simulation: contents of a CSV file from a single Webots simulation run
% OUTPUT:
% robotsPerNeighbors: Average number of robots having a given number of
% neighbors for each state (neighbors in line, state in column).
% The two avoidanc... |
function [ cluster clusterSize ] = datamining( config )
sample = zeros(config.learningSamples,2);
count=1;
hold on
for i=config.resolution*config.xmin:config.resolution*config.xmax,
for j=config.resolution*config.ymin:config.resolution*config.ymax,
[ts,ys] = ode45(config.system,[0,config.sim_time+3*rand],[i... |
%% The task of the program is to find cell cortex border and determine cell
%% parameters (cell ends, cell length, angle, profile of cell width)
% Result array contains: cell ends(1,2,3,4 (x1,y1,x2,y2)),
% cell axis angle in degrees(5), cell width close to cell end(6), cell length(7)
function [CellParams] = f_Cell... |
% Integers stream
integers = integersFrom(1);
% Even and odd numbers
even = addStreams(integers,integers);
odd = addStreams(integers,integersFrom(0));
% Fibonacci numbers
fibonacci = fiboFrom(0,1);
% Perfect squares
perfectSquares = streamAccumulate(odd,0,@plus);
perfectSquares2 = mulStreams(integersFr... |
function outstruc = get_experiment_data(dateval,brutmode,timecut,mode_in,mtc_0,htc_0,U_0)
% reads the experiment output at the date = dateval from the T drive
% input: dateval is the date of form YYMMDD as number
% outputs: - outstruc with time, concentration and temperature (at z = 0.5)
% - writes conditio... |
% This procedure find rewards for the different artificial forests
clear
clc
close all
set(0,'DefaultAxesDrawMode','normal')
tree_r = 0.0811;
RMAX = 261.238654714193
% only load the previous results and polt
load('../../data/processed/forest_experi_3.mat')
for id = 1:20
parameters = allforest{id}.parameters;
... |
% Plot Impact Muliplier
close all;
clear all;
load('/Users/maximilianbrill/Desktop/Brill&Wolf/MATLAB/resultsIM/impact_zlb_igp_mf_0.mat');
mf_0 = impact_zlb_igp_mf;
load('/Users/maximilianbrill/Desktop/Brill&Wolf/MATLAB/resultsIM/impact_zlb_igp_mf_2.mat');
mf_2 = impact_zlb_igp_mf;
load('/Users/maximilianbrill/Deskto... |
function plotRPCA( imDims, varargin )
%% Creates plots from the experimental results
%
% Author: Vahan Hovhannisyan, 2017.
if ~exist('imshow')
warning('imshow was not found!');
return
end
layout.xI = 20;
layout.yI = 20;
layout.gap = 2;
layout.gap2 = 1;
% Hardcode names!
names = {'Original', 'Low Rank', 'Sp... |
classdef vocalizations_storage < handle
properties
count = 0;
path;
h;
ax;
end
methods
function obj = vocalizations_storage(path, start_count)
obj.path = path;
obj.count = start_count;
obj.h = dialog ('visible', 'off'... |
function b_lars=lars_normtest(X,y,option);
[n,P]=size(X);
eps=1e-5;
if strcmp(option,'WithNormalization');
mu=mean(X);
sigma2 = std(X);
ndx = find(sigma2 < eps);
sigma2(ndx) = 1;
E=zeros(P,P);
for i=1:P;
E(i,i)=1/sigma2(i);
end
X = X ... |
function [seq , varBound]=variationalEStep(seq,params,InferenceMethod)
%VARIATIONALESTEP File implementing the E Step
%Konstantinos Panagiotis Panousis
%Gatsby Computational Neuroscience Unit
%University College London
%8 June 2015
%Used to call the Inference Method of PopSpikeDyn package in order to
%perform inferenc... |
function [ training_set, actions, new_state ] = initialize_episode( sys_tf, sample_time )
%start state of pendulum
actions = [0.1];
[state, reward] = get_reward(sys_tf, actions, sample_time);
training_set = [0, 0, 0.1, reward, reward, state(1), abs(state(1))];
actions(2) = 0;
[new_stat... |
function [MatrixProfile, MPindex] = StompSelfJoinGPU(A, SubsequenceLength)
% Compute the self similarity join of time series A
% Usage:
% [matrixProfile, matrixProfileIndex] = StompSelfJoin(A, subLen)
% Output:
% matrixProfile: matrix porfile of the self-join (vector)
% matrixProfileIndex: matrix porfile index ... |
classdef (SharedTestFixtures={matlab.unittest.fixtures.PathFixture(...
fileparts(pwd))}) ...
PacketGeneratorMockDistributionsTest < matlab.mock.TestCase
properties
Generator
ArrivalDistBehavior
PlDistBehavior
end
methods(TestMethodSetup)
function initial... |
%% Problem 1:
%% Problem 1a:
% With both an injected current of 0nA and 1nA, the neuron never fires,
% unlike 10nA, where it fires rapidly. At 0nA, the neuron decreases from
% its resting potential until it reaches a limit (-70mV), whereas the 1nA
% is enough current to maintain -60mV.
membrane = -60;
ie = 0;
nsim =... |
function [ ] = getColsCuts( visMatrixDir, rowsCutDir, saveFileDir )
%GETCOLSCUTS Summary of this function goes here
% Detailed explanation goes here
fileExt = '*.txt';
files_pose = dir(fullfile(rowsCutDir, fileExt));
rosCutLength= length(files_pose);
for i=1:rosCutLength
i
... |
function yd=tTypeCarrier(x,xd)
yd=(1+1e-8*x(1).*xd.*xd);
yd=x(3)+(x(2)./yd);
end
|
function [] = plotPlots()
% function [] = plotPlots()
%
% The purpose of this function is to create plots, e.g. the G-Forces,
% speed vs. track length, bank angle plots, and the track itself.
%
% input: ----------------------------
%
% output: ----------------------------
%
% Authors: Keith Covington
% Ryan Davis
%... |
function accuracies = collectAccuracies(results, ...
percentBlackMin, percentBlackMax, classifierNames)
if ~exist('percentBlackMin', 'var')
percentBlackMin = intmin;
end
if ~exist('percentBlackMax', 'var')
percentBlackMax = intmax;
end
if ~exist('classifierNames', 'var')
classifierNames = unique(results... |
function [y,newmap] = cmsort(x,map,opt)
%CMSORT Sort color map.
%
% NEWMAP = CMSORT(MAP) sorts the color map MAP by luminance.
%
% NEWMAP = CMSORT(MAP,OPT) where OPT is one of the strings 'red',
% 'green', 'blue', 'hue', 'saturation', 'value' and 'luminance', sorts
% the map according to the specified criteri... |
%% part a Satelite problem
clear; clc; format compact; close all;
f = @(t,y) [ y(2);
-y(1)/(sqrt(y(1)^2+y(3)^2)^3);
y(4)
-y(3)/(sqrt(y(1)^2+y(3)^2)^3)];
IC = [4;0;0;.5];
tmin = 0;
tmax = 50;
numpts = 20000;
[t,y] = MyGeneralEuler(f,tmin,tmax,numpts,IC);
... |
function plota(varargin)
% PLOTA
% is the same as standard PLOT function, BUT it plots each new plot
% using other color ( making 'hold on' automatically and cycling
% through the colors in the order specified by the current axes
% ColorOrder property )
%
% EXAMPLE:
% figure;
% plota(randn(1,10... |
function y = extractingVW(numOfClusters , DirPath, descriptorChoice)
clc;
run([pwd ,'\..\Libs\VLFEAT\toolbox\vl_setup' ]);
disp('loading features');
descriptor = load( [DirPath , '\' ,'VLFeatSample', descriptorChoice , 'Features.txt' ]); %loading txt
disp('creating centroids ');
%run kmeans
[descriptorCentroids, Ax] ... |
function output2 = controlla_differenza_link (a2,a3,a4)
%FUNZIONE UTILIZZATA PER IL MAIN PER OTTIMIZZARE I LINK
if ( ((a2-a3)>0) && ((a2-a3)<=4) &&...
((a3-a4)>=0) ) %definisco la mia scrematura, voglio che il link 2 sia
%maggiore del link 3 e che i due non abbiano lunghezze troppo diverse
check=... |
function [tform, movingRegistered, mp, fp] = cpregister(moving, fixed, tform_type)
% Control point rigid registration pipeline
%
% Input:
% fixed, moving (images for registration)
% Output:
% tform (transformation matrix)
% movingRegistered (registered ... |
%% Chapter 4 - How does a dictation machine recognize speech?
% This is a companion file to the book "Applied Signal Processing",
% by T.Dutoit and F. Marques, Springer 2008.
%
% It is supposed to be run cell-by-cell, using the cell mode of
% MATLAB 6 and later versions. Search for "what are cells" in the
% p... |
function [ empMean, empCov ] = calculateClassStats( XTrain, YTrain )
%calculateClassStats
%
% Takes as input a matrix of features and corresponding classes that the
% features map to. For each class in the training data computes
% the empirical mean and covariance matrix.
%
% empMean for class i is empMean(i,:)
%... |
function trainCG(pres)
% get features and labels
[f,y] = sampleDetector(@detector,pres);
f=f'; y=y';
% normalize features to unit variance
fstd = std(f);
fstd = fstd + (fstd==0);
f = f ./ repmat(fstd,size(f,1),1);
% fit the model
fprintf(2,'Fitting model...\n');
beta = logist2(y,f);
% save the result
save... |
function [phasehist,phasebins]=stan_ephys_stats_phasehist(LFP_DATA,NORMALIZE,THRESH)
%
%
%
%
if nargin<3 | isempty(THRESH)
THRESH=100;
end
if nargin<2 | isempty(NORMALIZE)
NORMALIZE=0;
end
[options,dirs]=stan_preflight;
phasebins=[-pi:pi/4:pi];
phasehist=zeros(1,length(phasebins));
% get n spikes
for i=1:length(L... |
function c = linewrap(s, maxchars)
%LINEWRAP Separate a single string into multiple strings
% C = LINEWRAP(S, MAXCHARS) separates a single string into multiple
% strings by separating the input string, S, on word breaks. S must be a
% single-row char array. MAXCHARS is a nonnegative integer scalar
% specifying... |
function v = pathintspeed(SStab,p1,p2)
%
% v = pathintspeed(SStab,p1,p2)
% SStab = [depth,soundspeed]
% use negative p1 or p2 for a surface bounce
%
v = [] ;
N = 50 ; % number of interpolation points to use between p1 and p2
if nargin<3,
help pathintspeed
return
end
if length(p1)~=length(p2),... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.