text stringlengths 8 6.12M |
|---|
clc, clearvars, close all
%% 1) Load the file 'voiced_a.wav' and consider only a 300ms frame.
% Plot the magnitude of the frequency response of the frame
[s,Fs] = audioread('voiced_a.wav');
dur = 0.3;
s = s(1:dur*Fs,:); %entrambi i channel L e R, è una matrice
% s = sin(2*pi*((1:dur*Fs)-1)*101/Fs); % just a check... |
%% Looping all the functions I made to analyze all images and save data
rootfolder = pwd;
numimg = length(dir(strcat(rootfolder, '\cell masks'))) - 2;
cy3_spotStats_files = dir(fullfile(strcat(rootfolder,'\AnalysisJu\SpotStats\cy3'), 'cy3_Pos*_spotStats.mat'));
cy5_spotStats_files = dir(fullfile(strcat(rootfolder,'\A... |
function DrawLineListOnImageSc(img, linelist, labels)
% display image
figure, imshow(img, []), hold on;
for i=1:size(linelist,2)
if(labels(i) == 1)
val = linelist(i).prob;
if (val > ls_mid)
b = (val - ls_mid) / l... |
%% SWC between DMN & TPN in BOLD Signals
%% CHANGELOG
% Written by Josh Grooms on 20140729
%% DEPENDENCIES
% SPM
% - AAL toolbox
% - MarsBar ROI toolbox
%
% @boldObj
%
% where
% xcorrArr
%% NOTES ON ANALYSIS
% - Garth & (Chang 2010) both reverse normalized the AAL labeled brain to individual space... |
%% Construct Test of Interbank Market
% Policy and technology
varrho= 0.10 ; % Reserve Requirement
barlam= 1.5 ; % Efficiency interbank market
eta = 0.2 ; % Bargaining
omega = 0.08 ; % Average size of shock - interbank
% Policy Parameters
imonmu_ss=varrho;
i_m_ss =0.02 ;
isp_ss =0.01 ;
% Vector of Variables... |
global MPI_COMM_WORLD;
load 'MatMPI/MPI_COMM_WORLD.mat';
MPI_COMM_WORLD.rank = 90;
Alluxio_Row_mv_version3;
|
%% clear workspace
clear
clc
close all
%% initialization
Init
%% load model
modelName = 'Model1';
wasModelLoaded = bdIsLoaded(modelName);
if ~wasModelLoaded
load_system(modelName);
end
%% set inputs
bankingON = 0;
slipstreamON = 0;
init_vel = 0.01;
force1 = 1250;
force2 = -700;
stepTime = 15;
steer = 0;
Fx_input_c... |
%% Copyright (C) 2014 Hui Chen
%%
%% This program is free software; you can redistribute it and/or modify it
%% under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 3 of the License, or
%% (at your option) any later version.
%%
%% This program is distribute... |
function RunExperimentNatScenes(input,settings,experiment,ExpType);
% RunExperimentNatScenes(input,settings,experiment,ExpType);
%
% Gert Van den Bergh 25/9/2009
%
% Function to display Natural scene stimuli
TimeDuration = (6*16.666+10*16.666)/1000; %Time = 6 frames 16.7ms image + 10 frames 16.7 off
NofCycles = 10;
... |
function [layers, Ein] = batch_descent(layers, eta, x_data, y_data)
% layers is a multidimensional structure with .w (weights) members
% eta is a real number value and is used as the learning rate
% x_data is 3xN
% y_data is Nx1
num_layers = length(layers); % number of la... |
% SeniorProject - MatlabPlotter
% Shawn Venti
%% Clear environment, read in all files in directory
close all
clear all
filePath = '~/Documents/UNH/Senior/SeniorProject/data/clap/good/';
%filePath = '~/Downloads/';
cd(filePath)
files = dir('*.csv');
numFiles = length(files);
x = {};
y = {};
z = {};
time = {};
Fs = {... |
function v=lorenz_RHS(u,theta);
v(1)=theta(1)*(u(2)-u(1));
v(2)=u(1)*(theta(2)-u(3))-u(2);
v(3)=u(1)*u(2)-theta(3)*u(3);
|
function state = PD_load_state_code()
state.LFPcue_appear = 100;
state.LFPspace_release = 200;
state.LFPscreen_press = 300;
state.LFPspace_press = 400;
end
|
%
% 模型为60类的训练模型--11个view-多multi
%
% 保存特征到文件夹的版本
% 选择不同层的特征+PCA+进行liblinear实验
%
clc
clear
% run(fullfile('G:\chenjun\ntu_rgbd\dynamic','matconvnet-1.0-beta23\matconvnet-1.0-beta23', 'matlab', 'vl_setupnn.m')) ;
imdb = load('exp\ntu_multisubject_view1\imdb.mat') ;
opts.train.train = find(imdb.images.sets==1) ;
opts... |
function [ hfig ] = plot_gamma_tau( pricer , tau )
%PLOT_GAMMA_TAU 画gamma~tau的图
% ---------------------
% 沈杰,20160124
% 吴云峰,20160129,增加了不改变原有值的方法
% cg,20160302,修改了默认横轴的值, 加画当前点,略改标题
%% 预处理
% TODO: 相关预处理
% 将旧的变量进行保存
copy = pricer.getCopy();
% 横轴tau默认值
if ~exist( 'tau' , 'var' )
longend = ceil( pricer.tau * 10 ) ... |
clear all; home;
%% Load the data
%dataSetFolder = fullfile(fileparts(which(mfilename)), '..' , '..', 'data', 'set-2', 'roll-and-tilt-at-45-90');
%dataSetFolder = fullfile(fileparts(which(mfilename)), '..' , '..', 'data', 'set-2', 'rotate-ccw-around-x-pointing-forward');
%dataSetFolder = fullfile(fileparts(which(mfile... |
% // TI File $Revision: /main/3 $
% // Checkin $Date: November 1, 2010 13:05:07 $
% // =====================================================================================
% // This software is licensed for use with Texas Instruments C28x
% // family DSCs. This license was provided to you prior to installing
% //... |
clear all
%HD recall of reactive behavior
%data format - columns for each feature/channel of data
%====Features and Label===
%% select = 0 for regular, select = 1 for known condition tracking in training
select = 0;
% few_all = 0 for the extra bundling vector to be a permuted version of the
% xor of 2 features (better... |
clear all;
close all;
%% Warunki początkowe
u0 = 0;
v0 = 0;
y0 = 0;
%a1 = 0.3; %|a|<1
%a2 = 0.3;
%b0 = 0.1;
%b1 = 0.1;
c1 = 1;
c2 = 1;
c3 = 2;
g0 = 2;
g1 = 1;
err = [];
%% Zmienne operacyjne
N = 1000;
%___________________
u = randn(N,1);
u2= zeros(N,1);
for i=1:1:N
u2(i)=u(i)^2;
end
v = gen(u,c1,c2,c3,g0,g1);
%v =... |
clear
clc
%% TEST TYPE (modify here)
CameraType = 'SR4K'; % 'SR4K' | 'SENZ3D'
WithMovement = 'N'; % 'Y' | 'N'
ChangeType = '0NoChange10'; % ['0NoChange1' to '0NoChange10']
% 'S' | 'D' | '1' | '2' | '3' | '4' | '5'
% 'SH' | 'SV' | 'Fist'
positionScaling = 10;
%% GLOBALS (DO NOT MODIF... |
clear all;
close all;
plotdb = 0;
nDataSet = 10;
Percent = .5;
PosPortion = [1,5:5:50];
Sigma = [0.01:0.01:0.2]%[.01:.04:.1,.1:.2:0.9,1,1.1:.2:2,2:.5:4];
MdlDir = '/Users/yueweiyang/Documents/study/duke/independent study/fall 2017/matlab/multiple instance learning/result/mdl/noise0.30/';
AUC_miSVM_t = 0;
AUC_SVM_t = ... |
function [u, v, p] = advance_in_time(u,v,p,fx,fy,t,dt)
% Solves Navier Stokes...
% u, v : velocities
% p : pressure: used as initial guess for solver
% fx, fy : is background force functions
% t : current time
% dt : time-step
% Fixed point iterations. This should probably... |
classdef FlangerEffect < handle
properties
delay;
mix = 1; % [0:1]
d = 0;
end
methods
% Constructor
function o = FlangerEffect()
o.delay = ModDelay(0,5);
% o.delayL = ModDelay;
% o.delayR = ModDelay;
end
function... |
function experiment = TivaroVstmStair
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%% PARAMETERS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%usefull for data analysis
experiment.identifier = 'T... |
function [S_new,index,index2,index3,index_psd,index_n] = remesh_2D(S,P)
new_S = S(1:P.index2(1),:);
aux = size(new_S,1);
i = 1;
while i <= aux - 1
dd = sqrt((new_S(i+1,1)-new_S(i,1))^2 + (new_S(i+1,2)-new_S(i,2))^2);
if dd < P.low
new_S(i+1,:) = [];
if i... |
%matlap intialization
% image=imread('Fish.jpg');
% MAXS=20;
% threshold=0;
function [output_image,conv_image_1sig,conv_image_5sig,keypoints]=sift(image,MAXS,threshold)
%enforcing the image to double + preallocation if array of images
image=double(image);
image_log =zeros(size(image,1),size(ima... |
%for cancer cell
%the army energy is counted(the result may be negative)
function r=neighbor_t(A,k)
ind=find(A>0);
sz=size(A);
r=zeros(sz);
for i=1:length(ind)
r(ind(i))=-((A(ind(i)+sz(1))+k-1)*((A(ind(i)+sz(1))<(-k+1)).*(A(ind(i)+sz(1))>-k))+(A(ind(i)-sz(1))+k-1)*((A(ind(i)-sz(1))<(-k+1)).*(A(ind(i)-sz(1))>... |
%This function checks to see if the given variable named varName exists in
%the .nc file named fName. Assumes fName is in current directory or is a
%filepath to the nc file.
function exists = nc_variable_exists(fName, varName)
%get raw ncdump string
[~, ncdump] = system(['/opt/local/bin/ncdump -h ', fName]);
%find ... |
%% fn_4Dview
% Navigation inside 3D, 4D or 5D imaging data.
%
% This function is quite powerful; unfortunately however some bugs need to
% be fixed.
%
%% Syntax
%
% fn_4Dview(option1,optionArgs1,...)
% varargout = fn_4Dview(action,actionArgs)
% fn_4Dview('demo')
%
%% Description
%
% Type |fn_4Dview demo| to execut... |
function xyz = xyz_data_read ( input_filename, point_num )
%*****************************************************************************80
%
%% XYZ_DATA_READ reads data from an XYZ file.
%
% Discussion:
%
% The number of points in the file can be determined by calling
% XYZ_HEADER_READ first.
%
% Licensing:
%
... |
%% get_id_EoL
% gets id in Encyclopedia of Life
%%
function id = get_id_EoL(my_pet, open)
% created 2021/08/01 by Bas Kooijman
%% Syntax
% id = <../get_id_EoL.m *get_id_EoL*>(my_pet, open)
%% Description
% Gets identifier for Encyclopedia of Life
%
% Input:
%
% * my_pet: character string with name of a species
% * o... |
# -*- octave -*-
function [aa,bb]=spec
M=40;
N=100;
dt=0.01;
f0=10.1;
aa=[];
for i=1:100
[a,f_off]=sim_spec(M,N,dt,f0);
bb=a;
aa(end+1,:)=mean(mod(diff(a),1));
endfor
endfunction
function [a,f_off]=sim_spec(M,N,dt,f0)
t=[0:M*N-1]*dt;
x=exp(i*2*pi * f0*t);
x+= randn(size(x)) * 0.1;... |
function [centers,radius1]=irisDetection(Im)
bw2=edge(Im,'canny',[0.05 0.09],1);
%figure;imshow(bw2);title('Canny Edge detection');
rmin=50;
rmax=122;
[c,r]=imfindcircles(bw2,[rmin rmax],'ObjectPolarity','bright','sensitivity',0.95);
if(size(c,1)==2)
centers=c(1,1:2);
radius1=r(1);
else
cent... |
function parameterOK=VTD_Landscape_Model_Fitting_v3_Constraints(paramvalue,paramnumber)
%This function is to check that the parameters take the allowed values.
parameterOK=1;
if paramnumber==1
%WNT
if paramvalue<0
parameterOK=0;
end
elseif paramnumber == 2
%FGF
if paramv... |
function Bn = box_splines(n)
% Opis:
% box_splines izracuna vse skatlaste zlepke tipa 1, za
% katere velja i+j+k=n
%
% Definicija:
% Bn = box_splines(n)
%
% Vhodni podatki:
% n stopnja skatlastih zlepkov
%
% Izhodni podatek:
% Bn celica velikost (n-2)*(n-2), skatlasti zlepek
% ... |
function plsig2000
% % close all
fig10 = figure;
set(fig10,'Position',[182 150 1131 813]);
marker = ['o';'p';'v';'s';'d';'^';'h';'<';'x';'>';'+';'*'];
color = [[0.90 0.10 0.10];[0.10 0.90 0.10];[0.10 0.10 0.90];...
[0.75 0.25 1.00];[1.00 0.75 0.25];[0.15 0.30 0.70];...
[0.10 0.80 0.30];[0.25 0.7... |
clear all
%% Uses seed maps to assign contiguous variants and vertices to functional networks for each state, in the same vertices in the other state, and in the same vertices across subjects
%
% This script assigns contiguous variants (and vertices) to functional
% networks based on the similarity between the varian... |
function stats = ReconstructPosition(positions,spikes,phases,varargin)
%ReconstructPosition - Bayesian reconstruction of positions from spike trains.
%
% Instantaneous positions are reconstructed using a Bayesian algorithm.
% Instantaneous population firing rates can be estimated either over fixed time
% windows, or o... |
%clear all
%close all
clc
%% Load or Create M_2D
% specific options
opt.m.shape_model = {'psm-real-concat'};
% shared options
Shared_Model_Helen
%% Create F_2D
% specific options
opt.n_f = ... % # of mass shape eigenvectors
{6, ...
4, ...
3};
opt.n_r = ... % # of local shape eigenvectors
{3, 2, 1; ... |
function [events_pid nodeTypes ] = aggregatePerProc(proc_events, fields)
% aggregate events from multiple sessions on the same processor together.
tic
fprintf(1, 'aggregate events into pid based and relabel sessions\n');
% group by pid first
events_pid = aggregateRows(proc_events, fields, {'pid'});
... |
function out = invfourier(inp)
% 1912.12302.B7
global lambda;
global beta;
lb=lambda;
%n=gpuArray(-lb:lb-1);
n=-lb:lb-1;
out=zeros(1,4*lambda);
%out=zeros(1,4*lambda,'gpuArray');
for m=-2*lb:2*lb-1
idx=m+2*lb+1;
aa=sum(exp(-(pi.*1i.*m.*(n + 0.5))./lb).*inp(lb+1:3*lb));
out(idx)=aa;
end
out=out... |
function [updated_nOperators112,updated_nOperatorsINEM,updated_Lines112,updated_LinesINEM,updated_FE112,updated_FEINEM,updated_FEINEM112,not_attended,call_idx,transport_line_idx, updated_state_vars]=setup(Operators112,OperatorsINEM, Lines112,LinesINEM,FilaDeEspera112,FilaDeEsperaINEM,FEINEM112,Type, idx, duracao, state... |
% world frame is robot base frame
clc;
clear;
close all;
dbstop if error;
set(0, 'DefaultFigureRenderer', 'opengl');
total_time = tic;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global icp_dir;
global tool_F_T_tcp;
global w_T_part;
global part_position;
global part_orientation;
global origina... |
% Coding and Minimizing a Fitness Function Using the Genetic Algorithm
% https://kr.mathworks.com/help/gads/examples/coding-and-minimizing-a-fitness-function-using-the-genetic-algorithm.html
%% GA 1D: Matlab
FitnessFunction = @simple_fitness;
numberOfVariables = 1;
[x,fval] = ga(FitnessFunction,numberOfVariables)
%% ... |
%Initial weights and bias
iW=2;
iB=2;
%Parameters
input=1;
target=0;
Numepoch=500;
learningRate=0.15;
%Initialization of variables
w=iW;
b=iB;
epoch=linspace(0,500,500);
weight=zeros(1,Numepoch);
bias=zeros(1,Numepoch);
cost=zeros(1,Numepoch);
%Training process using gradient descent
for i=1:Numep... |
%% read data table
clear;
fid1 = fopen('921_eq_info_simple.txt');
%data format:code,Int,Dist,Vgal,NSgal,EWgal,Long,Lat
c = textscan(fid1,'%s %f %f %f %f %f %f %f');
fclose (fid1);
%% 01. plot Taiwan map
clear;
load Tai_coast
fid1 = fopen('921_eq_info_simple.txt');
%data format:code,Int,Dist,Vgal,NSgal,EWgal,Long,L... |
%% Feature Selection
%--------------------------------------------------------------------------
%
% Feature selection is the process of selecting a subset of relevant features
% for use in model construction. This script addressess two major feature
% selection methods − Filter and Wrapper. While the filter method r... |
%% test coupling
clear all;
Config();
format longg
clear all; close all;% clc
Sys.HBharms = 1:3;
Sys.freq = 1;
% Sys.OverSampling = 4;
Mtrl = GetMtrlParamsFFT(Sys);
int = 1;
idx = 1:2:max(Sys.HBharms);
E = int*ones(floor(Mtrl.nHarms/2)+1,1);
a = 10;
b = 5;
c = 1;
%%% generic implementation
Mtrl.f... |
clear
clc
a1 = -2.062e+7;
a11 = -2.097e+8;
a12 = 7.974e+8;
a111 = 1.294e+9;
a112 = -1.95e+9;
a123 = -2.5009e+9;
a1111 = 3.863e+10;
a1112 = 2.529e+10;
a1122 = 1.637e+10;
a1123 = 1.367e+10;
Q11 = 0.1;
Q12 = -0.034;
Q44 = 0.029;
C11 = 1.78e+11;
C12 = 0.964e+11;
C44 = 1.22e+11;
k0 = 8.854e-12;
P0 = 0.18;
elec0 = 3.21e... |
function problem = buildproblem(I, J, X, C, m, n, r, lambda)
% PROBLEM = BUILDPROBLEM(I, J, X, C, M, N, R, LAMBDA)
%
% Build a structure describing a low-rank matrix completion problem, to be
% used with RTRMC.
%
% Inputs:
%
% I, J, X, C: Column vectors of equal length such that the k-th known entry
% of th... |
classdef ConicalLandRunup2d < SWEWDPreBlanaced2d
properties(Constant)
%> wet/dry depth threshold
%> gravity acceleration
% gra = 9.8
%> initial water depth
h0 = 0.32
%> island central
x0 = 12.5
y0 = 15
%> island length
L ... |
function isFeature = isFeatureInConf(configurationFile,feature)
conf = read_configuration(configurationFile);
isFeature = false;
i = 1;
while isFeature == false && size(conf,2) > i
if strcmp(conf{1,i},feature)
isFeature = true;
end
i=i+1;
end
end |
function drawMaxRunup( obj )
% bctype = [...
% enumBoundaryCondition.ZeroGrad, ...
% enumBoundaryCondition.ZeroGrad, ...
% enumBoundaryCondition.ClampedDepth, ...
% enumBoundaryCondition.ZeroGrad];
%
% % M = 150;
% N = 1;
% mesh = makeUniformQuadMesh(N, [0, 25], [0, 30], 250, 300, bctype);
% %mesh = ob... |
clear all;
%Read first sheet or KDD Training+ from NSL-KDD Dataset Processd with R
[KDD_Training_p_num_5class_target,KDD_Training_p_txt_5class_target,~] = xlsread('F:\Documents\MATLAB\Data\KDD\NSL-KDD Dataset\Processd with R\Training_p-R.csv');
%Read seecond sheet or 20% KDD Training+ from NSL-KDD Dataset Processd wit... |
classdef sVBM_participant
%sVBM_participant Summary of this class goes here
% Detailed explanation goes here
properties
PIDN
Fullpath
Datapath
Group
Timepoint
Deltatime
BaselineROIVolumes
BaselineTissueVolumes
%
... |
%% Create variant maps in X minute increments with odd numbered sessions for test split-half using rest data
%
% This script requires CIFTI timeseries that have been converted to the
% surface (numvertices x timepoints), temporal masks for "high-quality"
% data points (timepoints x 1 binarized files), the output struc... |
% function PopulationCoding
figure_width = 11.4; % cm
figure_hight = 11.4; % cm
figure('NumberTitle','off','name', 'WMPopulationCoding', 'units', 'centimeters', ...
'color','w', 'position', [0, 0, figure_width, figure_hight], ...
'PaperSize', [figure_width, figure_hight]); % this is the trick!
dir_strut = dir(... |
function im = align_face( im, nPoints, target_nPoints, crop )
% Align faces with an affine transform
% im = align_face( im, nPoints, target_nPoints, crop )
% im: image
% nPoints: source landmarks
% target_nPoints: target landmarks
% crop: crop the resulting image (e.g., [1 1 224 224])
im = affine_transfor... |
%% RunSHM
clear all
close all
clc
%% Generate data for Simple Harmoinc Oscillator
M = 5; % mass in KG
K = 0.2; % spring constant
Fext = 1; % external force magnitude
tf = 1000; % time span
gMode = 2; % graphic mode
sigma = 0.04; % standard deviation
[t,y,ytilde,u,X] = SimpleHarmonicOsc(M... |
function TDemin = DeminSeries(T,WinSz)
TDemin = NaN(WinSz-1,1);
for istop = WinSz:length(T)
istart = istop - WinSz + 1;
TDemin(end+1)= T(istop) - min( T(istart:istop) );
end
return
end |
clear all
close all
ind = 1;
for jj=1:131
url = ['http://www.hemnet.se/salda/bostader?item_types%5B%5D=bostadsratt&location_ids%5B%5D=898716&page=' num2str(jj)];
html = urlread(url);
a = strfind(html,'"item sold result normal"');
for ii=1:length(a)
if ii<length(a)
... |
clc;
addpath('lib');
addpath(genpath('textures'));
%Lectura archivos de prueba
test=dir('textures/test');
testname = extractfield(test,'name');
testname=testname(3:end-1);
%%
%Numero bins
k=16*4;
%Carga del banco de filtros y textones
load('bt.mat');
%Creacion vector anotaciones verdaderas y representaciones
datat... |
%MÉTODO DEL PUNTO MEDIO
% - Introduzca la ecuación diferencial : 'Dy=y-(x^2)+1'
% - Introduzca la condición y(a)=b : 'y(0)=0.5'
% - Introduzca la función de trabajo : y-(x^2)+1
% - Introduzca la condición inicial : 0.5
% - Introduzca el valor de a : 0
% - Introduzca... |
function n = LoiGeometrique(p);
n = 0;
while LoiBernoulli(p) == 0;
n = n + 1;
end; |
%% Range of movement of Shoulder in Lateral Box Transfer
% Code AUTHOR: Yaiza Benito Molpeceres. DATE: January-May 2020.
% Adapted to Octave by Guillermo Asín Prieto
% Exoskeleton trials segmentation: 54, 55, 56, 62.
% Five phases shown in figure 1:
% 1: Subject picks up the box in the sagittal plane (idxO1:idxF1... |
function [G1, G2, G3] = bispectrum_grad_from_harmonics(a_lms, B, W, L1_list, L2_list, L3_list, L_list, m_list, s_lens, blk_id)
% Compute the three terms in the gradient of the bispectrum. Uses
% precomputations done in precomp_B_factors_script.m.
% See reconstruct_from_clean_autocorrs_script.m for example usage.
%
% I... |
function [Dtot,dx,dy,dn,Dx,Dy,Dn] = ZTEDISSIPATION(U,P,QuadMats,MESH)
%ZTEDISSIPATION Calculates the energy dissipated over a cycle of
%data provided
% USAGE:
% [Dtot,D] = ZTEDISSIPATION(U,T,MESH);
% INPUTS:
% U : (NnxNcyc) Displacements
% T : (NnxNcyc) Tractions
% MESH : Structure containing interface... |
function [cursor,ax,limsAx] = MouseInAxes(fig)
axesHandles = findobj(fig,'type','axes') ;
ax = [] ;
cursor = [] ;
limsAx = [] ;
if (~isempty(axesHandles))
for i = 1:length(axesHandles)
cursor = axesHandles(i).CurrentPoint(1,1:2) ;
limsAx = axis(axesHandles(i)) ;
isIn = (cursor(1... |
function out1 = hess_grf_ceq_heel1719(in1,toe_th,dmax,cmax,k,us,ud)
%HESS_GRF_CEQ_HEEL1719
% OUT1 = HESS_GRF_CEQ_HEEL1719(IN1,TOE_TH,DMAX,CMAX,K,US,UD)
% This function was generated by the Symbolic Math Toolbox version 8.4.
% 23-Jun-2020 09:33:53
out1 = 0.0;
|
% outputs the velocity at the periapsis of a hyperbolic trajectory
% based on V_inf (hyperbolic excess velocity)
% Damon Printz
function [Vp] = hyperbolic_periapsis (mu, Rp, Vinf)
Vp = sqrt(Vinf^2+2*mu/Rp);
endfunction
|
function [Rpeaks,HeartRate,R_series,RR] = rpeak1(ecg,fs)
N = length(ecg);
m = 1;
for j = 1:fs:N-fs
PeakMax(m) = max(ecg(j:j+fs));
m = m+1;
end
[hn,xout] = hist(PeakMax,16);
[C,I] = max(hn);
PeakM = xout(I);
R_series =0;
h= 1;
k = 1;
t=1;
Rpeaks = 0;
HeartRate= 0;
% f... |
function BLUR_IM = vuRecursiveGaussianBlur(X, varargin)
% vuRecursiveGaussianBlur performs a convolution with an appoximated
% Gaussian Kernal
%
% SYNTAX:
% BLUR_IM = vuRecursiveGaussianBlur(X)
% BLUR_IM = vuRecursiveGaussianBlur(X, options)
%
% OPTIONS & DEFAULTS:
% sigma = 5 (5% width of X)
% ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DFBAlab: Dynamic Flux Balance Analysis laboratory %
% Process Systems Engineering Laboratory, Cambridge, MA, USA %
% July 2014 %
% Written by... |
clear all %clear all variables
close all %close all figure
clc %clear screen
p =[0 0 0; 0 0 1; 0 1 0; 0 1 1; 1 0 0; 1 0 1; 1 1 0; 1 1 1]; %input vectors (input patterns)
t =[0 1 1 1 0 0 0 1]'; %target output
w = [0.5 0.5 1]; %initial weight
b = 1; %initial bias
%plot input, target, and initial weight(line wp+b =0)
%s... |
function compare_perim(w,tign_new)
%w = read_wrfout_tign(f), f - wrfout file
%tign_new = squish(w) - analysis or inital estimate to compare against perimeter
%subset the fire domain to make it easier to work with
red = subset_domain(w);
%% find which fire and data locations to use
% sim = input_num('Patch [1] or ... |
%{
This function will calculate
the fitness of all the images
within the population.
%}
function [Y] = calculateFitnessImage(X,TargetImage)
% First grab the dimansion of the cell
%containing the images.
[~,cX,~] = size(X);
%Improving fitness task 2.2.
for i = cX
X{1,i} = meanfilter2(X{1,i});
end
Tar... |
clear;
a = imread('input.png');
sg = 10.0;
hwk = round((2.5*sg) -0.5)
w = zeros((hwk*2)+1,(hwk*2)+1);
for r = 1:size(w,1)
for c = 1:size(w,2)
x = r - hwk -1;
y = c - hwk -1;
e = -((x^2)+(y^2))/(2*sg^2);
w(r,c) = exp(e);
end
end
norm = (w / sum(w(:)));
figure('name', 'Visua... |
input_path = './input/';
output_path = './output/';
% MB
paramMB = getParam();
paramMB.use_backgroundness = false;
% MB+
paramMBplus = getParam();
paramMBplus.verbose = true; % to show run time for each step
% Geodesic
paramGeo = getParam();
paramGeo.use_backgroundness = false;
paramGeo.use_geodesic = true;
paramMBD... |
function [Beta,bestChannels,paramZscore,DC_train,Y] = fusion_classifier_offline(training,varargin)
%TEST_CLASSIFIER extract features that will be used later by the
%classifier
% YPREDICTED = TEST_CLASSIFIER(TRAINING,TESTING). training and testing
% are structures where the temporal features(training.features.tempo... |
% The MIT License (MIT)
% Copyright (c) 2018 Moritz Nakatenus
%
% 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, including without limitation
% the rights to use, copy... |
function [STG_data] = func_getSTG_forData(STG_all,data_all_new)
global num_celltype;
% [nSmp,N] = size(data);
% STG_data = zeros(nSmp,nSmp);
% Dvals = zeros(nSmp,1);
% for i=1:nSmp
% vect = data(i,:);
% val = getState2Int(vect,N);
% Dvals(i) = val;
% end
nSmp = size(d... |
function ss = inprod(fdstr1, fdstr2, Lfdobj1, Lfdobj2, rng, wtfd)
% INPROD Computes matrix of inner products of functions.
% If both functions have the same B-spline basis, both Lfdobj's are
% numeric, there is no wtfd argument, and the ranges are the same,
% the inner products are exact, and compute... |
%*************************************************************************%
%Receiver Design function - roles:
%Calculate for each reciver the w_i vector
%Input: H_i(matrix - NXM),M(scalar),Receiver_type(scalar),Noise_var(scalar),i(scalar).
%Output:w_i.
%*****************************************************************... |
% Setting things up
g = [intercept X(1:5,:)' shares_hat];
site = delta - g*b;
beta = [b(1:6); beta_final; b(7); 1];
%%
% Calculating Welfare for 30% increase in walleye catch rate at all sites
lakes = 100;
index_start = 0;
EU_0 = zeros(n,1);
for i = 1:n;
index = index_start + 1;
z = [interc... |
function [colonyIdx, colonyOutIdx, colonyState] = specifyColonyInsideLattice(lattice, colonyRadius, nSides, quadrantCut)
%% function to specify colony inside lattice
% colonyIdx: pixels in colony.
% colonyOutIdx = pixels outside colony
% colonyState = binary matrix:- 1:colony.
if nSides == 0
colonyState = ones(si... |
function [px, py] = hessian_detector(I, sigma, tresh)
[Ixx, Iyy, Ixy] = gaussderiv2(I, sigma);
I_hess = sigma ^ 4 * (Ixx .* Iyy - Ixy .^ 2);
I_hess = nonmaxsuppression2D(I_hess);
I_hess = I_hess > tresh;
idx = find(I_hess);
[py, px] = ind2sub(size(I), idx); |
function [default_geodir,default_meshdir] = default_directories(type)
env=fc_vfemp1.environment();
switch type
case 2
default_geodir=[env.Path,filesep,'geodir',filesep,'2d'];
default_meshdir=[env.Path,filesep,'meshes',filesep,'2d'];
case 2.5
default_geodir=[env.Path,filesep,'geodir',filese... |
function WYHydroForecast(Date)
global Plant CurrentState DateSim TestData
hydroforecast = false;
for i = 1:1:length(Plant.Generator)
if strcmp(Plant.Generator(i).Type,'Hydro Storage')
hydroforecast = true;
end
end
if isfield(Plant,'WYForecast')
nY = length(Plant.WYForecast);
prevForcast = Plant... |
function kx = kernel2(x, xKern, theta)
% KERNEL Compute the rbf kernel
q = size(x,2)/2;
n2 = dist2(x(:,1:q), xKern(:,1:q));
m2 = dist2(x(:,q+1:end), xKern(:,q+1:end));
rn = theta(1)/2;
rm = theta(2)/2;
kx = theta(3)*exp(-(n2*rn + m2*rm));
|
%start new session
clear
% Store audio file named : 'audioSample.wav'
% Sampling frequency : fs
% Sampling period : ts
% Audio file values : x
% Training set : train_set
% Training set interval : [start_sample , end_sample] sec
% # of q levels
% (i.e. resolution level): qlev
[x, fs] ... |
function status = CIR_MLE2(roll_expand,SD,MA,offset,itemName, itemType,mode)
cHeader = {'Date' 'cir_kappa' 'cir_theta' 'cir_sigma' 'cir_leakage' 'cir_kappa_sd' 'cir_theta_sd' 'cir_sigma_sd' 'cir_kappa_z' 'cir_theta_z' 'cir_sigma_z' };
textHeader = strjoin(cHeader, ',');
delimiterIn = ','; %use , as delimit... |
clear all; clc; close all;
% Extract 1 Radar Frame
path_get_frame = 'Radar_frame_samples/three_ped_walking_in_circle/';
frameID = 100;
Frame = load(strcat(path_get_frame, 'Frame_',num2str(frameID), '.mat'));
Frame = Frame.FRAME; %(sampleIdx, virtualantennaIdx, chirpIdx) (128, 8, 128)
% Radar Frame Structure Details... |
Jt = (Mp*(Lr^2)+Jr)*(Jp+.25*Mp*(Lp^2))-(.5*Mp*Lp*Lr)^2;
% State Space Representation
A = [0, 0, 1, 0;
0, 0, 0, 1;
0, (1/(4*Jt))*((Mp^2)*(Lp^2)*Lr*g), (1/Jt)*(-Jp*Dr-.25*Mp*(Lp^2)*Dr), (1/(2*Jt))*(-Mp*Lp*Lr*Dp);
0, (1/(2*Jt))*((Mp^2)*(Lr^2)*Lp*g+Jr*Mp*Lp*g), (1/(2*Jt))*(-Mp*Lp*Lr*Dr), (1/Jt)*(-Dp*Mp*(Lr... |
%{
Preprocess graph
Get largest WCC
%}
clear
%g = 'collabo';
g = 'collabo2';
%g= 'wiki';
%g = 'gnutella';
if strcmp(g, 'collabo')
load('ca-HepTh.mat')
A = Problem.A;
G = graph(A);
n = G.numnodes;
conn = conncomp(G);
to_remove = zeros(n,1);
for node = 1:n
if conn(node) ~= 1
... |
function fn_disp(varargin)
% function fn_disp(varargin)
%---
% displays each argument in an improved ergonomic way
% Thomas Deneux
% Copyright 2004-2012
for i=1:nargin, disp(varargin{i}); end |
% Create a plot showcasing the effect zero-padding has on the spectra,
% and where the original samples will be in the zero-padded spectra
N = 8;
I = 8;
fc = 400;
dt = 1 / fc;
stopTime = 0.02;
t = 0:dt:stopTime-dt;
f = 177;
signal = cos(2 * pi * f * t) + 1j * sin(2 * pi * f * t);
zero_padding = zeros(1, (I-1)*N);
... |
clear;
% close all
set(0,'DefaultFigureWindowStyle','docked'); % makes figures dock into the same window
set(0,'DefaultFigureWindowStyle','docked'); % makes figures dock into the same window
set(0,'defaultAxesFontSize',14)
set(0,'defaultLineLineWidth',2)
% Recording output
outputFolder = 'decodingOnAnticipationSessio... |
function plot_raw_file(fid)
here = pwd; % mfiles folder
basedir = here(1:(end-6)); % substract the mfile folder
head = chi_get_calibration_coefs(basedir);
[data, ~] = raw_load_chipod(fid);
cal = chi_calibrate_chipod(data, head)
CreateFigure;
[ax, ~] = create_axes(... |
function hpatch = fillmm(envmm,x)
% hpatch = fillmm(envmm,x) plots filled polygonal region
% for a function whose envelope is specified by ymin,ymax pairs
% in the structure envmm
% The x coords are given by x
if (nargin==1)
x = 1:size(envmm.min,2);
end
yy = [envmm.min flipdim(envmm.max,2)];
xx = [x flipdim(x,2)];
hpa... |
function fourierFit = fourierApprox(values)
dt = pi / 160;
t = 0:dt:(length(values)-1)*dt;
fourierFit = fit(t',values','fourier8');
plot(fourierFit,t,values)
% figure
% subplot(2,1,1)
% plot(t,values)
% legend('Original',...
% 'Location','SouthEast')
% subplot(2,1,2)
% plot(fourierFit)
% legend('Reconstructe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.