text stringlengths 8 6.12M |
|---|
% Enum for the type of metric
%
% Author : Jonathan EDEN
% Created : 2016
% Description :
classdef WorkspaceConnectivityType
enumeration
% Points
GRID
% Rays
end
end
|
clear all; close all; clc
% Make tone
if 1
freq=300; % Hz
duration=0.5; % in seconds
fs=44100;
t=1:duration*fs;
t=t/fs;
toneClip=sin(2*pi*freq*t);
if 1
%cosine-squared ramp
ramp=10; % ms
omega=(1e3/ramp)*(acos(sqrt(0.1))-acos(sqrt(0.9)));
tt=0:1/fs:pi/2/omega;
tt=tt(1:(end-1));
edge=(cos... |
function run_online_tracking(cfgfile,testdata,savedata,...
doPEG,numPursuers,posPursuersX,posPursuersY,figname,moviefile)
% Copyright (c) 2003-2005 Songhwai Oh
global gvs G
% E.g. run_online_tracking('cory330-testbed.cfg','MAGMHOPRPT_1202005_1',[],0,[],[]);
% run_online_tracking('RFS36wired.cfg','.... |
# ex_curve02.m
# Tested on Octave 4.2.2 with nurbs 1.3.13
# Housekeeping
clear all;
# Load "nurbs" package (install it via "pkg install -forge nurbs")
pkg load nurbs
# Control points and knot vectors for a 3rd degree curve
ctrlpts = [05 10 20 35 45 50; 05 20 35 35 20 05];
kv = [0.0, 0.0, 0.0, 0.0, 0.333333, 0.666667... |
function ER = ArcieroModel_obj(x, Control, Anemia, Dob)
CPP = [40, 60, 80, 100, 120];
ATP = Control.Tv_mid;
Dbar_mid_control = Control.Dbar_mid(1:5);
D_est_Control = ArcieroModel(x, CPP, ATP);
ATP = Anemia.Tv_mid;
Dbar_mid_anemia = Anemia.Dbar_mid(1:5);
D_est_Anemia = ArcieroModel(x, CPP, ATP);
ATP = Dob.Tv_mid;... |
allPhonemes = {'p' 't' 'k' 'pcl' 'tcl' 'kcl' 'dx' 'm' 'n' 'ng' 'nx' 's'...
'z' 'ch' 'th' 'f' 'l' 'r' 'y' 'pau' 'hh' 'eh' 'ao' 'aa' 'uw' 'er'...
'ay' 'ey' 'aw' 'ax' 'ix' 'b' 'd' 'g' 'bcl' 'dcl' 'gcl' 'q' 'em' 'en'...
'eng' 'sh' 'zh' 'jh' 'dh' 'v' 'el' 'w' 'h#' 'epi' 'hv' 'ih' 'ae'...
'ah' 'uh' 'ux' 'oy' ... |
function fy = grad_y(f, dx)
%UNTITLED6 Summary of this function goes here
% Detailed explanation goes here
d = size(f);
dimx = d(1);
dimy = d(2);
fy = zeros(dimx, dimy);
for j = 1:dimx
for i = 1:dimy
if i == 1
fy(i,j) = fwd_diff(f(i+2,j),f(i+1,j),f(i,j),dx);
elseif i == di... |
% FUNCTION: loadImage(file, mX, mY, border, verbose)
%
% This function loads an image, rescales it based on mx & my, adds a border, and
% returns the new image
% v0.0 - Initial version
function MPP = micronsPerPixel(file)
% Get the microns-per-pixel values:
XMLfile = file;
XMLfile(end-2:end) = 'xml';
text = f... |
clear;
clc;
close all;
data = readtable('iris.txt');
data.Properties.VariableNames{1} = 'sepal_length';
data.Properties.VariableNames{2} = 'sepal_width';
data.Properties.VariableNames{3} = 'petal_length';
data.Properties.VariableNames{4} = 'petal_width';
data.Properties.VariableNames{5} = 'species';
x1 = t... |
% function [ AERstream ] = aer_r( AERstream )
lengthStr = size(st_vid);
bits = 9;
rowSize = height;
colSize = width;
figure(1);
image = zeros(rowSize,colSize);
imagesc(image);
colormap(gray);
for ii = 1:size(AERstream,1)
% row = bin2dec(AERstream(ii,1));
% col = bin2dec(AERstream(ii,2));
% event = bin2dec... |
f=4;
t=0:0.002:2
s=square(2*pi*f*t)
s(find(t>=0 & t<0.25))=-7;
s(find(t>=0.25 & t<0.5))=-5;
s(find(t>=0.5 & t<0.75))=-3;
s(find(t>=0.75 & t<1))=-1;
s(find(t>=1 & t<1.25))=1;
s(find(t>=1.25 & t<1.5))=3;
s(find(t>=1.5 & t<1.75))=5;
s(find(t>=1.75 & t<2))=7;
figure(1)
plot(t,s),grid
xlabel('Timp [s]'),ylabel('Amplitudin... |
x=-3:0.01:3;
y=f(x);
plot(x,y);
grid on |
function [fileName,pathModa]=generateNIIFileName(rec)
%GENERATENIIINFORMATION Generates the geometric information necessary to
%write NII files
% [MS,MT]=WRITEDATA(REC)
% * REC is a reconstruction structure. At this stage it may contain the
% naming information (rec.Names), the status of the reconstruction
% ... |
% ADVISOR Data file: FC_CI250.M
%
% Data source: Max Torque Curve and Fuel Economy at Max Torque from Caterpillar published spec sheet DM4840 02.
% Remaining efficiency estimated based on other ADVISOR maps. Efficiency points are estimated by scaling
% with FC_CI205.m as the base engine case.
%
% Data confidence le... |
fdr = 0.05; % False discovery rate for multiple comparison
dataf = 'classes'; % Which data to use: 'classes' or 'subclasses'
yrs = 1980:2011;
nyr = numel(yrs);
folder = ['../data/',dataf];
obsfitness = dlmread([folder,'/rowSums_1980-2011_4.tsv'],'\t',0,1);
codes99 = textread([folder,'/ipc_class_description_4.tsv'],... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% GALERKIN SPECTRAL METHOD TEST %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% set up some PDE variables
alpha = 1;
m = 128;
a = -20;
b = 20;
% the gri... |
%% maxSum iterative
% idea: add another loop with correlations laterally
% cycle between vertical and horizontal chain!
addpath datasets/image
folder = 'datasets/image';
imageMatrix = imread([folder '/lena_std'],'tif');
imageMatrix = rgb2gray(imageMatrix);
trueMatrix = double(imageMatrix);
N = 256; %8bit
M = l... |
%% Initiate
rosshutdown
% !!! REMEMBER TO CHANGE IP BASED ON HOST !!!
setenv('ROS_MASTER_URI','http://127.0.0.1:11345')
setenv('ROS_IP','192.168.1.107')
rosinit('http://192.168.80.128:11311','NodeHost','192.168.1.107');
% Substribe to odometer and laser scanner.
laserSub = rossubscriber('/scan');
odomSub = rossubsc... |
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
%NNCOSTFUNCTION Implements the neural network cost func... |
%first we divide the whole impulse function to 4 different-length impulse
%functoins of 4th order, and then we mutiply each impulse funciton with
%different value to change its amplitude. Finally, we add them together.
function y = equalizer(x,G1,G2,G3,G4)
h1 = butter(4, 1/5);
h2 = butter(4, [1/5 2/5]);
h3 = butter(4... |
function jacobian = calculateWarpingJacobian(warped_pointclouds, pointclouds, pose, K)
% calculate the warping jacobian matrix
%
% INPUT:
% warped_pointclouds: a matrix of size [num_pixels, 3]
% pointclouds: a matrix of size [num_pixels, 3]
% pose: the pose for the warping
% K: the intrinsic matrix of the camer... |
function txyzCalibrated = calibrateCompass(txyz)
[~, compassCalibrationData] = loadCalibrationData();
correctionMatrix = compassCalibrationData.correctionMatrix;
N = size(txyz(:,1));
if size(txyz, 2) == 4
txyzCalibrated = zeros(size(txyz));
for i=1:N
calibrated = corre... |
function gain = lock_in_gain(fre)
% lock-in filtering function at 100us time constant
% see /rota/Analysis/PS/osc2011/LockIn
pp = [ -8.6883e-19 3.02828e-16 -4.29819e-14 3.02891e-12 -8.6027e-11 -2.39079e-09...
3.02678e-07 -1.21324e-05 0.00027199 -0.00374675 0.0331762 -0.248256 1.63534];
a0 = 5.1312;
ga... |
function [sys] = minrealr(sys,varargin)
%MINREALR Relative minreal
% Cancel out poles and zeros based on relative distance rather than
% absolute distance. This is currently implemented for siso only
if(~all(size(sys)==1))
% for k = 1:size(sys,1)
% for l = 1:size(sys,2)
% sys(k,l) = minreal... |
%We assume u(k) = 0. We also let B = 0 and D = 0
A = [ 1 5 12.5; 0 1 5; 0 0 1];
B = [ 1 1 1]' ;
C = [1 0 0] ;
D = 0 ;
Q = 0.1; R = 900 ;
x0 = [1 1 1];
t = [ 0 : 100]' ; %we assume 101 time steps.
u = zeros( 1, 101); % this is the zero excitation
sys = ss( A, B, C, 0, -1); % ss generates the space-state model... |
function [screenIndex] = YouDidNotCollectTheCannonBall_TryAgain(taskParam, screenIndex, Data, ~, txt)
%YOUDIDNoTCOLLECTTHECANNONBALL_TRYAGAIN This function tells participants
%that cannon ball was not caught and that he/she should try again
%
% Input
% screenIndex: indicates current screen of instruction phas... |
% author : Ashwin de Silva
% iris plot wrapper
close all;
clear all;
% get the excel file path
[FileName,PathName] = uigetfile('*.xls','Select the Excel Sheet');
%get the sheet name
prompt = {'Enter patient 1 sheet name:','Enter control 1 sheet name:',...
'Enter patient 2 sheet name:','Enter control 2 sheet n... |
% Function that returns the list of folder with Data
% input (path): address of the main data folder.
% output (folderNames): Complete list of .CSV file in folder
% Example:
% path = fullfile('./Data/');
% folderNames=FindFolders(path)
% More examples: https://github.com/vasanza/Matlab_Code
% Read more: https://va... |
function [MCC,SPE,SEN,CC,PPV]=sta(bp1,stru,bp_true,F,aln)
if(aln==1)
co=0;
for i=1:length(bp_true)
co=co+isthere(bp1,bp_true(i,:),1);
end
else
co=0;
for i=1:length(bp_true)
bp1(i)
co=co+isthere(bp1,bp_true(i,:),0);
end
end
TN=0;
TP=co;
FP=length(bp1)-co;
FN=length(bp_true)-co;
SEN=TP/(TP+FN);
SPE=TN/(TN+FP);
PPV=... |
% ADMM with linearization for the primal problem
function [X, iter, out] = gl_ADMM_primal(x0, A, B, mu, opts)
% default parameters
if ~isfield(opts, 'maxit'); opts.maxit = 5000; end
if ~isfield(opts, 'ftol'); opts.ftol = 1e-8; end
if ~isfield(opts, 'gtol'); opts.gtol = 1e-10; end
if ~isfield(opts, 'rho'); opts.rho ... |
function processed_data = crefavg2(data,ChanTotal,nChan,groupSize)
% processed_data = crefavg(data,nChan,groupSpan)
% Process the data to do Common Reference Averaging (CRA) i.e. subtract the median from each channel across all time from itself and then subtract the median at each time point across all channels from ev... |
clc
clear
[lb,ub,dim,fobj] = Get_Functions_details('F1');
%inicilize population
Leader_score=inf;
No_Units=3;
U_size=10;
Unit=[];
Unit_Cap=[];
convergence_curve=[];
max_iterations=200;
spirit_power_factor=100/max_iterations;
decreament_factor=spirit_power_factor/100;
decreament_factor=spirit_power_factor/100;
curren... |
function [ dist ] = mousedist( x, y )
dist = sqrt(x^2 + y^2);
end
|
R_vs_MFPT = fit(R,MFPT,'poly2');
R_vs_MFPT_T = fit(R,MFPT_T,'poly1');
R_vs_MFPT_E = fit(R,MFPT_E,'poly1');
figure()
f1 = plot(R_vs_MFPT,R,MFPT);
set(f1,'MarkerSize',16);
set(f1,'LineWidth',1.5);
set(f1,'Color','r');
hold on
f2 = plot(R_vs_MFPT_T,R,MFPT_T);
set(f2,'MarkerSize',16);
set(f2,'LineWidth',1.5);
... |
function [D,Gamma,err,gerr,varargout] = ksvd(params,varargin)
% 31/12/2016 Perform cleardict (clear dictionary) after computing
% RMSE.XY,etc. Otherwise, the RMSE.XY will fluctuate violently.
% 18/10/2016 Store training error of common dicts and unique dicts together.
% 30/09/2016 Store all the information in varia... |
function setupAtmospheric
%SETUPATMOSPHERIC Sets up the Atmospheric Toolbox.
%
% SYNTAX:
% To install the toolbox, add the following to lines to your startup.m:
%
% cd('c:\your_toolbox_location');
% setupAtmospheric();
% Copyright 2013, The MITRE Corporation. All rights reserved.
%==========================... |
function [EDT,T10,T20,T30,T60,C80,D50] = Acustic_parameters(Soft_signal,original_Signal,Method_T60)
%%
% ...
% [EDT,T10,T20,T30,C80,D50] = Acustic_parameters(Soft_signal,original_Signal,Method_T60):: Funcion con elementos de entrada
% Funcion que calcula parametros acusticos segun Norma señala... |
%this function calculates factorial of number given as input
function fact = factorial(n)
fact = 1;
while n >= 1
fact= fact*n;
n=n-1;
end |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% _ _ _ %
% | | __ _ _ __ ___ | |__ _-(")- %
% | | / _` | '_ ` _ \| '_ \ `%%%%% %
% | |__| (_| | | | |_| | |_) | _ // \\ %
% |_____\__,_|_| |_| |_|_.__/_| |__ ___ %
% | | / _` | '_ \/ __| %
% ... |
function folderTestSplit(folder_name, split, file_name)
% find the raw data file in the given folder
raw_data = findMatchingFiles(folder_name,'data_');
% should load as set_c
load(raw_data{1});
melTestTrainSplit_2(set_c,split,folder_name,file_name);
end |
function T = draw2T(X, width, length, height, arena)
Tup = drawT(X + 180, width, length, height, 1, arena);
Tdown = drawT(X + 0, width, length, height, 0, arena);
T = cat(1, Tup, Tdown); |
% Routine 1.2
n=5000; % number of passersby
p=100/n; % probability of a sale
clear E; % clear the variable E
for m=85:105 % buy m papers
pk=(1-p)^n % ... |
function makeTexture_CheckerBoard
%generate checkerboard texture
global screenPTR screenNum
global Gtxtr Masktxtr %'play' will use these
%clean up
if ~isempty(Gtxtr)
disp(Gtxtr)
Screen('Close',Gtxtr); %First clean up: Get rid of all textures/offscreen windows
end
if ~isempty(Masktxtr)
Screen('Clo... |
function [ Fvect ] = FdeN( M,Yint,Nvect )
%FDEN
% Cette fonction renvoie F(N) en fonction de N pour des valeurs
% de N comprises dans le vecteur Nvect
sz=size(Nvect);
Fvect = zeros(1,sz(2));
for i=1:sz(2)
L = floor(M/Nvect(i));
[Gtrend,Ltrend] = tendanceGlobale(Nvect(i),L,Yint);
... |
%%
fDir = autoDir;
fPaths = recursiveSearch(fDir,'ext','.mat');
options = struct('disable',0,'handedness',1,'bouts',1,'bootstrap',0,...
'slide',0,'regress',0,'areathresh',1,'save',1,'raw',{'speed'});
%%
fprintf('\n');
for i=1:numel(fPaths)
fprintf('processing file %i of %i\n',i,numel(fPaths))
load(fPa... |
lenna = load('lenna.mat');
lenna = lenna.x_le;
[lenna_x, lenna_y] = size(lenna);
rand_matrix = rand(lenna_x, lenna_y);
salts = find(rand_matrix >= 0.1 & rand_matrix <=0.2);
salted_lenna = lenna;
salted_lenna(salts) = 255;
peppers = find(rand_matrix >= 0.6 & rand_matrix <=0.7);
salted_and_peppered_lenn... |
x = linspace(0,1,128);
ylow = linspace(0,0,128);
yhigh = linspace(0,0,128);
xlow = 1 - 2 * x
for i = 1:128
if (xlow(i) < 4/11.0)
ylow(i) = (121 * xlow(i) * xlow(i))/16.0
elseif (xlow(i) < 8/11.0)
ylow(i) = (363/40.0 * xlow(i) * xlow(i)) - (99/10.0 * xlow(i)) + 17/5.0
elseif (xlow(i) < 9/10.0)
ylo... |
function image_stat = compute_image_statistic(image_values, statistic_function)
if strcmp(func2str(statistic_function), 'fraction_NaN_voxels')
valid_idx = find(image_values);
else
valid_idx = find(~isnan(image_values));
end
if isempty(valid_idx)
image_stat = [];
else
image_stat = statistic_function(image_values(... |
% xinput set-prop 12 306 1 0
function varargout = annotate(varargin)
% ANNOTATE MATLAB code for annotate.fig
% ANNOTATE, by itself, creates a new ANNOTATE or raises the existing
% singleton*.
%
% H = ANNOTATE returns the handle to a new ANNOTATE or the handle to
% the existing singleton*.
%
% ... |
clear all
% This demo loads
addpath(genpath(pwd))
% NX = 256;
% NY = 256; % If NX and NY are defined, then we are going to zero-filled the k-space (this is used for the deep learning data prep).
p.filename = ['/bmrNAS/people/yuxinh/highres_brain/Exam5908/30Apr19_Ex5908_Ser6'];
% This variable is the path where the... |
nconn = size(linelist, 2);
tmp = [linelist.c];
Cent(:,1) = tmp(1:2:end);
Cent(:,2) = tmp(2:2:end);
for i=1:nconn
D = [(1:size(Cent,1))' sqrt((Cent(:,1)-linelist(i).c(1)).^2 + (Cent(:,2)-linelist(i).c(2)).^2)];
D = sortrows(D,2);
nodes = D(:,1);
G{i} = nodes(1:5);
end... |
function [GeneClasses RxnClasses modelIrrevFM] = ModifiedpFBA(model, varargin)
% Parsimoneous enzyme usage Flux Balance Analysis - method that optimizes
% the user's objective function and then minimizes the flux through the
% model and subsequently classifies each gene by how it contributes to the
% optimal solution. ... |
function data = binmatfile(fname, varname, clm)
% See also matbinfile.
data = matbinfile(fname, varname, clm); |
function [mov,reader] = readBehMovieFrame(movie,time)
% reader = the behavior movie struct; t = the current time in *seconds*
movies = [];
reader = movie.reader;
for i = 1:length(movie.reader) %loop over loaded movies
type = movie.readertype;
switch type
case 'seq'
%convert time to a frame ... |
%****************************************************
% matlab script to focus ERS-2 signal data
close all
clear all
%
% range parameters
%
rng_samp_rate = 1.896e+07;
pulse_dur = 3.71e-05;
chirp_slope = 4.1779e+11;
%
% azimuth parameters
%
PRF=1679.902394;
radar_wavelength=0.0566666;
SC_vel=7125.;
%
% compute the range... |
function dx = inverted(t,x)
a=newfis('Inverted Pendalum');
a=addvar(a,'input','error (e)',[-pi/2 pi/2]);
a=addmf(a,'input',1,'NL','trimf', [-inf -pi/2 -pi/4]);
a=addmf(a,'input',1,'NS','trimf', [-pi/2 -pi/4 0]);
a=addmf(a,'input',1,'Z','trimf', [-pi/4 0 pi/4]);
a=addmf(a,'input',1,'PS','trimf', [0 pi/4 pi/2]);
a... |
function [acorr,kmin]=gutautocorr(X,k)
% gets autocorrelation with SVD removed
% for Buchwald-Guthrie (1992) style estimation
% of minimum run length for significance
% X is an N x T matrix (difference waveforms
% within one group and pooled over both samples
% for two groups)
% usage: [acorr,kmin]=gutautocorr(X... |
classdef (Abstract) AbstractModel < handle % Model
properties
dim % dimension of the input space X (determined from x_mean)
trainGeneration % # of the generation when the model was built
trainMean % mean of the generation when the model was trained
trainSigma ... |
function [ d ] = chinese_remainder(phases, frequencies)
phase_error_tolerance_radians = 0.2;
max_nanoseconds = 200;
peaks_separation = 2000; % (2ns)
seconds = [0:1e-12:max_nanoseconds * 1e-9];
gaussians = zeros(length(frequencies), length(seconds));
gaus_stdev = phase_error_tolerance_radians ./... |
function saveGraph(path, hxlabel, hylabel, ratio)
% The function saveGraph(path, hxlabel, hylabel, ratio) makes the plot look
% nice and increase font size etc.
hx = xlabel(hxlabel);
hy = ylabel(hylabel);
set(gca,'fontsize',14,'fontname','Helvetica','box','off','tickdir','out','ticklength',[.02 .02],'xcolor',0.5*[1 ... |
% function color_space_3D_viz_2D
%%
clear
clc
%% Constants
JND = 2.3; % Delta_E
%% Inputs
dE = JND * 1; % delta_E color resolution in Lab space; 2.3 = 1.0 JND
spacing = 1; % px, between sections
border = 1; % px, around sections
ba... |
function collpased_op = collapseClasses(MappingCell, ip)
collpased_op = nan(length(ip),1);
for i = 1: size(MappingCell,1)
collpased_op(ismember(ip, MappingCell{i,2} )) = MappingCell{i,1};
end
end |
function show_coef_mag(coef,Nbands)
coef=abs(coef);
N=size(coef);
for ia=1:N(1)/Nbands
for ib=1:N(2)/Nbands
coef((ia-1)*Nbands+1, (ib-1)*Nbands+1)=1;
end
end
for ia=1:N(1)
for ib=1:N(2)
if coef(ia,ib)<1, coef(ia,ib)=1; end
end
end
%coef=log(coef);
%coef=sqrt(coef);
coef=coef.^(0.7);
coef... |
classdef DiffusionAbstract2d < NdgPhysMat
%DIFFUSIONABSTRACT2D Summary of this class goes here
% Detailed explanation goes here
properties ( Constant )
%> number of physical field [ C, tau1, tau2 ]
Nfield = 3
%> number of variable field
Nvar = 1;
%> index of va... |
function vars = lrb_data(validate_data, visualize_data)
% Dataset:
% Lamantia & Rakic 1990b
% Data:
% Macaque pre- and post-natal callosal data
%
% Figures:
% Figure 3:
% Figure 15:
%
% Tables:
% Table 1:
% Table 3:
%
% Notes:
% Reported no shrinkage, so no corrections are made here.
if ~exist('val... |
%% Blood Pressure and Oxygen Percentage Analysis
% Functions:
% - Directly compares the oxygen percentage averages
% for each state (rest, left, and right) and for
% each trial (both Motor Imagery and Motor
% Execution)
% Inputs:
% - all oxygen percentage values
% - discrete blood pressure value for each parti... |
function FCsliding = compute_slidingWindow_FC(data,wlen,overlap,winType)
% Computes sliding window dynamic functional connectivity
% Vibha Viswanathan, 3 March 2017.
% INPUTS:
% data: input timeseries of size m x n, where m is the number of timeseries
% and n is the length of each timeseries in samples
% wlen: length... |
function[o]=obj(x,y)
%o=x^2+y^2+10*cos(2*pi*x);
o=x*exp(-(x^2+y^2));
end |
function [keep psf] = psfsupp(psf, levels)
%PSFSUPP2 Rougly (based on thresholding) determines 'support' (significant pixels) of the given PSF.
%
% levels - decreasing values of thresholds (relative to the maximum value, as if 'psf' is fully stretched [0,1] image).
% Pixels with value grater than levels(1) are base... |
% net = a neural net (e.g. net = feedforwardnet(5)
% examples = input examples (x)
% returns NN prediction (1004x1)
function prediction_labels = testANN(net, examples)
predictions = sim(net, examples.');
prediction_labels = NNout2labels(predictions);
end |
function [sol,error,costos]=cholesky(A, b)
% sol es vector solución
% error es el error final
% A matriz del sistema
% b vector del sistema
[n,m]=size(A);
costos = 1;
for k = 1 : n
A(k,k) = sqrt(A(k,k));
A(k+1:n,k) = A(k+1:n,k)/A(k,k);
costos= costos+5;
... |
function [ y,Phi ] = Zhang_RandomDemodulator( s,R )
% RANDOMDEMODULATOR Compress the signal s using Random Demodulator
% Based on algorithm proposed in "Beyond Nyquist: Efficient Sampling of Sparse Bandlimited Signals"
% input s(W*1) is the original signal in frequency domain
% input R(1*1) is the sampling rate. Specia... |
function [r1 r2 r3] = dcm2angle( dcm, varargin )
% DCM2ANGLE Create rotation angles from direction cosine matrix.
% [R1 R2 R3] = DCM2ANGLE( N ) calculates the set of rotation angles,
% R1, R2, R3, for a given direction cosine matrix, N. N is a 3-by-3-by-M
% matrix containing M orthogonal direction cosine matr... |
load([project.paths.processedData '/processed_data_word_level.mat'],'D','W');
load([project.paths.processedData '/GMM_configs/GMM_scores_' num2str(project.gmmUBM.gmmcomp) '_10_mwv_mfc.mat']);
load('SPIC_text.mat', 'Oindex_comb');
load('C:\Users\SMukherjee\Desktop\behaviourPlatform\MNI\sankar\spic\dual_eng\surrogate_tr... |
function mean_amps=process_stim_calcAmps(filename_h)
f_mat = dir([filename_h '*.mat']);
for i =1:length(f_mat)
S=load(f_mat(i).name);
[D_x,D_y,D_z]=size(S.Data);
amps=zeros(D_z,1);
aligned_trace=zeros(D_x,D_z);
figure;
hold on;
for j=1:D_z
aligned_trace(:,j)=smooth(S.Data(:,1,j)-S.ba... |
clc; clear; close all
clc;
clear;
close all;
%%%
% set names of query image and target image
sdog_folder = './SampleDogs/';
dbdogs_folder = './CroppedDogDB/';
origindogs_folder='./DogDataBase/';
rowDogs = {};
for r = 1:1:45
rowDogs = [rowDogs ['dog', num2str(r)]];
end
d1=zeros(45,1);
d2=zeros(45,1);
d3=zeros... |
clear; clc;
h = 0.1;
eps = 0.01;
T = 0:h:400;
X = zeros(2,size(T,2));
X(1,1) = 2;
X(2,1) = 2/3;
for k = 1 : size(T,2)-1
[x1,x2] = valve(X(:,k),eps);
X(:,k+1) = X(:,k)+h*[x1;x2];
end
plot(T,X(1,:),T,X(2,:));
|
function p = panel(varargin)
% p = panel(...)
%
% construct a panel as the root panel of the current figure,
% destroying any existing panels associated with that
% figure. any axes associated with those existing panels are
% also destroyed.
%
% p = panel(fig, ...)
%
% as above, but for a specified figure.
... |
% function [raw, summary] = tmv_mottling(filepath, area, histstate)
%
% Purpose: To calculate data of the mottling of a leaf in a picture, with a
% standard included to calculate real areas.
%
% Define variables:
% Input variables:
% filepath: the combined file name and path name of the image file to
% ... |
function [data] = tab_import(filename,columns)
%tab_import imports tab delimeted file, filename, with columns number of
% columns. Complements tab_export.m
%Michael Hutchins - 9/12/11
switch nargin;
case 1;
get_column=true;
case 2;
get_column=false;
end
if... |
function lv = l_invt_ds(E,A,B,C,D)
%L_INVT_DS Left Invertibility Structure of Descriptor Systems
%
% lefts = l_invt_ds(E,A,B,C,D)
%
% returns the left invertibility structure of a descriptor
% system characterized by (E,A,B,C,D).
%
% See also L_INVT.
if nargin==5
... |
function varargout = Protodrive2GUI(varargin)
% PROTODRIVE2GUI M-file for Protodrive2GUI.fig
% PROTODRIVE2GUI, by itself, creates a new PROTODRIVE2GUI or raises the existing
% singleton*.
%
% H = PROTODRIVE2GUI returns the handle to a new PROTODRIVE2GUI or the handle to
% the existing singleton*.
%
... |
% Software: Gaussian Jordan Elimination Algorithm
% Author: Hy Truong Son
% Position: PhD Student
% Institution: Department of Computer Science, The University of Chicago
% Email: sonpascal93@gmail.com, hytruongson@uchicago.edu
% Website: http://people.inf.elte.hu/hytruongson/
% Copyright 2016 (c) Hy Truong Son. All r... |
%Questo script si occupa dell'estrazione delle features da XTrainD e XTestD
tic
fmax=51;
%% pwelch
%Trovo il massimo a cui filtrare
kk=XTrainND{1}(:,1);
[ppkk,fkk]=pwelch(kk,[],[],[],fs);
idx=find(fkk<fmax);
max1=max(idx); %valore della riga che corrisponde a circa 60Hz
pwelchTrainN = cellfun(@(x)pwelch(x,[],[],[],fs)... |
function [ output_args ] = readWatersHDF(file)
%readWatersHDF - import the data from an HDF file created from a Waters Raw
%file. Hopefully it will be quicker than using the Waters library each
%time...
% Read in the easy bits, such as TIC / totPts / xy2D
totInt = h5read(file,'/totInt');
totPts = h5read(file,'/totPts'... |
function [sediment_bc] = update_sediment(mylake_temp_results, mylake_params, sediment_params, effective_depth)
%update_sedimets function convert BC values for sediment module (different Units)
% [Water-column units] ------> [Sediments units]
% for dissolved species - concentration BC
% for solid - Neuman... |
clear;
close all;
clc;
x=[1,2,3,4,6];
x=x';
y=log(x);
d=[1,1/6];
type='d1';
xx=5;
yy_true=log(5);
yy=myspline(x,y,xx,type,d);
err=yy_true-yy
|
function cell_ent=calcentropy(cell_probs,N)
entrop=cell(N,1);
for n=1:N
entrop{n}(:,1)=zeros(size(cell_probs{n},1),1);
end
for nn=1:N
for ii=1:size(cell_probs{nn},1)
if cell_probs{nn,1}(ii,1)==0 && cell_probs{nn,1}(ii,2)==0
entrop{nn}(ii)=1;
elseif isnan(cell_probs{nn,... |
function b = num2cellstr(a)
b = cellfun(@num2str,num2cell(a),'UniformOutput',0); |
function A = area_S(S)
S_p = [S(2:end,:);S(1,:)];
A = sum(S(:,1).*S_p(:,2) - S(:,2).*S_p(:,1))/2;
end |
% Fathead Minnow Hypothalamic-Pituitary-Gonadal Axis Model
% Genereted using Efecttopedia ver.1.055 in-silico model settings interface
clear;
% Define data structures for exchange with Effectopedia.
global INPUT MODPAR OUTPUT
INPUT = struct (... %Model input data structure
'Tested_Subst_Measured_Log_Conc', [-4.0, ... |
% $Header: svn://.../trunk/AMIGO2R2016/Postprocessor/Post_Plot/AMIGO_plot_sens_2d.m 2220 2015-09-29 08:10:57Z attila $
index_theta=[inputs.PEsol.index_global_theta inputs.PEsol.index_local_theta{iexp}];
index_theta_y0=[inputs.PEsol.index_global_theta_y0 inputs.PEsol.index_local_theta_y0{iexp}];
n_theta=inputs.PEsol.n_... |
function [yMax, yMin]= modUncert(m,n,alpha,x)
d=numel(m.Theta);
randTheta = 0.5 - rand(d, n);
tmp=m;
yPred=[];
for k=1:n
colRandTheta=randTheta(:,k);
DeltaThetaK= colRandTheta/ norm(colRandTheta)*chi2inv(alpha,d);
tmp.Theta = m.Theta + m.Variance^(1/2)*DeltaThetaK;
yPred=[yPred, ev... |
% 7/26/13
% quadLoad.m
% Simulation of quadrotor with cable-suspended load, assuming the cable remains taut
% Dependancies: calculateInputs1.m, calculateInputs2.m, calculateDerivatives.m, desiredTraj.m,
% integrateMode1.m, integrateMode2.m, animateQuadLoad.m
% putvar.m (http://www.mathworks.com/matlabcentral/fileexch... |
function x_map=optimisation_bayes(y,phi,psi,m,n)
N=m*n;
% PRIORS
% loi de Laplace normalisée
ur = rand(N,1)-0.5; % pour une loi symétrique
ui = rand(N,1)-0.5; % pour une loi symétrique
x1_r= -2 * sign(ur).* log(1- 2* abs(ur));
x1_i= -2 * sign(ui).* log(1- 2* abs(ui));
sigma2_1=rand(1,1);
w_1=rand(1,1);
alpha0=1;
alph... |
function ret=SelectionSort(inputs)
%选择排序 P16练习2.2-2
for i=1:length(inputs)-1
min = i; %最小值默认为第一个
for j=i+1:length(inputs)
if inputs(j)<inputs(min) %找到比当前最小值更小的值
min=j; %更新最小值下标
end
end
temp=inputs(i); %进行交换
inputs(i)=inputs(min);
inputs(min)=temp;
e... |
function stims = init_stimuli(p)
% createListLengthStimuli - creates stimuli used for an experiment with a
% given rat. These stims are seen in every session. Stims are composed in
% pairs, such that one stim is presented for study while the other remains
% novel. Relative recognition of these two stimuli will eventual... |
function cutoff = sgof(p, alpha)
% SGOF - Runs Sequential Goodness of Fit for FWER correction.
%
% This function executes the algorithm developed by Carvajal-Rodriguez et al to correct for multiple comparisons
% during statistical hypothesis testing. It works by comparing the uncorrected number of significant value... |
%% Problem 1
clc;
clear all;
close all;
[t,Y] = ode15s(@funode,[0:0.1:20],[1 0]); %solving diff equations defined in function funode
[t,Y] %from results we can see the steady state occurs at
plot(t,Y) %ploting y1 & y2 Vs temp(t) |
x = randn(1,100);
a = mean(x);
b = var(x);
p =@(e)1/((2*pi*b)^1/2)*exp(-((e-a).^2)./(2*b^2))* length(x);
hist(x);
hold on
fplot(p, [min(x) max(x)]);
%Distributia experimentala coincide cu graficul densitatii de
%probabilitate.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.