text stringlengths 8 6.12M |
|---|
function ret=lpctrack(x, fs)
%[filename,filepath]=uigetfile('*.wav');
%filename = '../helloworld.wav';
%[x fs]=wavread([filename]);
%x=VAD(x);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%取共振峰
%对语音信号预处理-预加重(截止高频,抑制低频电源干扰50HZ)
B = [1,-0.9375];
A = [1];
xx=filter(B,A,x);
wp1 =540;
ws1 =480;
rp1 = 0.11;
rs1 = 40;
[N1,wn1... |
function res = main()
sample_frequency = 8000;
filter_amount = 33;
fbanks = filterbanks(300,sample_frequency/2, filter_amount, 256);
prueba1(fbanks);
prueba2(fbanks);
prueba3(fbanks);
|
% Preocedure for Patch recovery
%
% Reference: The Superconvergent Patch Recovery and a Posteriori Error
% Estimates. Part 1: THE RECOVERY TECHNIQUE - O. C. Zienkiewicz & Z. Zhu
% INTERNATIONAL JOURNAL OF NUMERICAL METHODS IN ENGINEERING, VOL. 33,
% 1331-1364 (1992)
function [sigma,gravity] = PatchRecovery(x,y,st... |
function [ w] = c_means( imggray )
imgg = double(imggray);
[r,c] = size(imgg);
%c2=averagefilter2(imgg);
%deviation = standardDev(imgg, c2);
arr = imgg(:);
%arr = [imgg(:)];
[center,U,obj_fcn] = fcm(arr,2);
v = U(2,:);
w = v<0.4;
if (sum(w(:))<=(r*c)/2)
w = imcomplement(w);
end
%p = reshape(U(2... |
function [cues,R] = findaudit(R,stype,mincue,maxcue)
%
% [cues,R] = findaudit(R,stype,mincue,maxcue)
% Find all entries in an audit R with sound type stype. stype maybe a
% string or a cell array of strings. If stype is a cell array then all
% cues with sound type matching one of the strings in stype ... |
%%%%%% determination of flattening
clc
close all
clear all
global GM
global R
GM=3.986005e+14;
R=6378137.0;
%%%%% data input
pos=dlmread('positions.dat','',1)';
vel=dlmread('velocities.dat','',1)';
figure
plot3(pos(2,:),pos(3,:),pos(4,:))
el=Cart2Kep(pos(2:4,:),vel(2:4,:),pos(1,:));
figure
plot(el(4,:))
title... |
%% Colony Area - measures the area (in pixels) of the colony
% Matlab Colony Analyzer Toolkit
% Gordon Bean, June 2013
%
% Usage
% ------------------------------------------------------------------------
% colsize = ColonyArea().quantify(plate, grid, position) % OR
% colsize = ColonyArea().quantify(colony_box, binary_c... |
function [AprodB]=matrixArrayProd(A,B)
% Gives the matrix product of two array of matrices
%
% [AprodB]=matrixArrayProd(A,B)
%
% AprodB: array of matrix products
% A: array of first factors
% B: array of second factors
% Gets the number of matrices in the arrays
NA=size(A,3);
NB=size(B,3);
% S... |
% Fit synapse model to depression/recovery data.
% Fit over multiple frequencies
% Least squares fit to data is calculated and returned.
% BPG 31-8-11 & 5-3-21
function f = fit_syn_dynfrec(x)
global Pv0 P1 tauf trB trH trR D tauD spt100 spt200 spt600 ndat100 ndat200 ndat600
Pv0=x(1);
trH=x(2);
trR=x(3);... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
% Matlab Code supplementing the paper
% A biomechanical approach to infer size-based functional response in aquatic and terrestrial systems
% by Portalier, Cherif, Fussmann, Loreau
%
% Frontiers in Ecology and Evolution
%
... |
%scripts to produce example images
%%--
i = 1033;
xlocal = xl(:,i);
ylocal = yl(:,i);
xglobal = xg(:,i);
yglobal = yg(:,i);
heatmap = squeeze(pred(:,:,:,i));
image = squeeze(eval_img(i,:,:)./255);
save 'example7.mat' xlocal ylocal xglobal yglobal heatmap image
%%---
figure;
i=7;
x=[0 95;0 95];
y=[0 0;95 95];
z=[... |
function [sum] = integrate_tangential(p_a,p_b)
%UNTITLED18 Summary of this function goes here
% Detailed explanation goes here
length = p_b.length;
int = @(s)((-(p_a.x_center - (p_b.xa - sin(p_b.beta) .* s)) .* sin(p_a.beta) + ...
(p_a.y_center - (p_b.ya + cos(p_b.beta) .* s)) .* cos(p_a.beta)) ./ .... |
function pdfsave(handle,name,varargin)
%Saves a image to a pdf, as well as a figure. Places it in the picture
%folder, with resized pages to fit actual figure. Can set options using
%varargin
set(handle,'Units','centimeters','PaperUnits','centimeters',varargin{:});
pos = get(handle,'pos');
set(handle,'PaperPosition',... |
function [binCentres binEdges data nBin] = binData(X,Y,bin)
% USE: [binCentres binEdges data nBin] = binData(X,Y,bin)
%
% Take (X,Y) data pairs and segregate them into bins spaced along the X
% axis. X and Y must have the same size and be real. BIN may be a
% scalar or a 1D vector. If BIN is a scalar, it is the number ... |
clear;
close all;
warning off
addpath(genpath('PVLib'))
power_load = readtable('Konocti_Load.csv');
power_load = table2array(power_load(:,3));
calc_power_generation
solar_range = 10:80; %solar capacity, MW
battery_range = 10:200; %battery capacity, MWh
life_cycle_cost = zeros(200,80);
for solar = solar_range
for ba... |
function y = d_tauOmega(V,tau_mu,V1,V2)
%Returns the derivative of the tau_omega(V) function, evaluated at V.
%
% y = d_tauOmega(V,tau_mu,V1,V2) returns the tau_omega(V) derivative at V, given
% parameters V1 and V2
y = (tau_mu/(2*V2)) * d_sech((V-V1)/(2*V2));
end |
function y = csv_get_averages(m, max, columnindexes)
if (nargin ~= 3)
disp('the function requires 3 arguments')
return
end
% want to take each element and divide by max score
% so each element in the row should be inverted and then
% you can multiply the two vectors so you get a percentage in each one, but
... |
load recorded_8000Hz;
lpc(y, 8000); |
function eigenValues = Jacobi(A,tol)
%%A=[1 3 4;3 2 8;4 8 3];
n=size(A)(1);
temp_A=abs(A);
for i=1:n
temp_A(i,i)=0;
end
temp_vector=reshape(temp_A,1,numel(temp_A));
max_value=max(temp_vector);
while ... |
%% Fourier Mode Input BOUNDARY Honeycomb Spectra
% clear
%% set grid size
mx = 9; % increase this for large (m,n) edges
my = mx;
%% set up honeycomb lattice
a = 2;
q = 4*pi/(a*sqrt(3));
k1 = q*[1;sqrt(3)]/2;
k2 = q*[1;-sqrt(3)]/2;
k3 = k1+k2;
%% different lattices
a1=1;b1=0; % zigzag
% a1=1;b1=1; ... |
function vec_rot(v,theta)
v_th = rot(v,theta);
figure(1)
quiver(0,0,v(1),v(2),0,'r');
labelstr1 = sprintf('%2s','$v$');
text(v(1),v(2),labelstr1,'FontSize',24,'interpreter',...
'latex','color','r');
hold on;
quiver(0,0,v_th(1),v_th(2),0,'b');
label... |
function A = transpose_grid(B);
%TRANSPOSE_GRID Redistributes a dmat by transposing its grid.
% A = TRANSPOSE_GRID(B) creates a dmat A that has the same contents as the
% dmat B, except that the grid for A's map is the transpose of the grid for
% B's map. The contents of B are automatically redistributed to ... |
%% Camera Estimation from a Calibration Object
function [X_norm, T] = Norm3Dpoint(X)
%% Number of Points
no_pts = size(X, 2);
%% Normalize points for estimation (isotropic scaling)
% move centroid to zero
Centr = mean(X(1:3, :), 2);
X_cent = bsxfun(@minus, X(1:3, :), Centr);
% change mean distance to sqrt(2... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Hamza Bourbouh <hamza.bourbouh@nasa.gov>
% Notices:
%
% Copyright @ 2020 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration. All
% Rights Reserved.
%
% Disclaimers
%
% No Warranty: T... |
function v = velocity(d,v0,p0)
v = (0.8).*v0.*log((p0 + 0.31)./d);
v = v.*(v < 7) + 7.*(v > 7);
end |
classdef (Abstract) SimulationObject < matlab.mixin.SetGet
%SIMULATIONOBJECT Summary of this class goes here
% Detailed explanation goes here
properties
SimRelTime = duration(0, 0, (0:60:48*60*60)')
end
methods
end
end
|
function TestLoadAllPics()
global screen
texts = LoadAllPics(0);
vbl = Screen('Flip', screen.w);
% Get 1sec random jitter (60 frames per sec)
S1 = RandStream('mcg16807', 'Seed', 1);
jitter = randi(S1, 3, 1, 60)-2;
clear S1
imSize = 400; % half the size of each image
m... |
function [T,I,Y]=perfusionResponseP2X4StackDeMix5alt(y0,ton,toff,Ttot)
ode=modelODEP2X4StackDeMix5alt(ton,toff);
[T,Y]=ode15s(ode,[0 Ttot],y0,odeset('NonNegative',1:33));
I=getTotalCurrentP2X4StackDeMix5alt(Y);
end |
subplot(3,2,1);
scatter(X(:,2),X(:,1),'filled');
title('Classes distribution');
xlabel('Hb A1 (g/ dL)');
ylabel('RBC (x 10^12/L)');
subplot(3,2,2);
scatter(X(:,3),X(:,1),'filled');
title('Classes distribution');
xlabel('Ht (%)');
ylabel('RBC (x 10^12/L)');
subplot(3,2,3);
scatter(X(:,4),X(:,1),'filled');
title('Class... |
function output = translate(obj,translation)
obj.origin = obj.origin + translation;
output = obj;
end |
function exportCSV(app)
%EXPORTCSV exports all input and output data to csv, txt or dat
% User can choose path and filename in a opening prompt
%
% input:
% app: app: GUI-data variable
% user input
filter = {'*.csv'; '*.txt'; '*.dat'};
[name, path] = uiputfile(filter, 'save_csv', 'mango_drying_data');
%0 = acti... |
function plusOneFrame_Callback(hObject, eventdata)
global vid_fig_hand;
global vid_obj;
curr_frame = get(vid_fig_hand.frameEdithandle, 'String');
curr_frame = str2num(curr_frame);
framePlusOne = curr_frame +1;
updateFrameFunction(framePlusOne, vid_obj);
end |
function [p] = lrpredict(all_theta, X)
predictions = sigmoid(X * all_theta');
[k, p] = max(predictions, [], 2);
end
|
%% Dataset loading
clear all
clc
[trainImages,~,trainAngles] = digitTrain4DArrayData;
numTrainImages = size(trainImages,4);
figure
idx = randperm(numTrainImages,20);
for i = 1:numel(idx)
subplot(4,5,i)
imshow(trainImages(:,:,:,idx(i)))
drawnow
end
%% Structure and Training of ConvNet
layers = [ ...
... |
function [a,b,c,maska,maska_krajena,barva,foky_rg,rg_odstranene,rg]=predzpracovat(soubor,net)
addpath('../funkce')
% soubor='E:\foky\na_clanek\pomdata\data_000.tif';
% soubor='E:\foky\na_clanek\trenovani_site_jadra\trenovaci_data_jadra\149data.mat';
%predzpracovat''':"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!... |
function [residual, g1, g2, g3] = KM_dynamic(y, x, params, steady_state, it_)
%
% Status : Computes dynamic model for Dynare
%
% Inputs :
% y [#dynamic variables by 1] double vector of endogenous variables in the order stored
% in M_.lead_lag_incidence; see t... |
function [S,I,R,N] = DiseaseStep(S,I,R,S0,I0,R0,a,b,h,nSteps)
%DISEASE STEP:
% Runs one step of he disease and spits out S, I, R, and N
%Set first rows to the given values S0, I0, and R0
if nSteps==1
S(1, :)=S0; %Set first row of S to the S0 array
I(1, :)=I0; %Set the first row of I to all equal the constan... |
clc;clear;close all
%% finite_p
figure( 'Name', 'finite_r' );
data = load('finite_r.txt');
r = data(1:end,1)/1;F = data(1:end,2)/4.5;%free air = 4.405
E = F - 1;%E_s = lambda*E F_s = 1+lambda*E
lambda = E/E(1);
h = plot(r,F,'-ok','MarkerEdgeColor','k','MarkerFaceColor','k','MarkerSize',5,'LineWidth',1);hold on
axis([0... |
clear, clc, close all
%% Real-Time Audio Stream Processing
%
% The Audio System Toolbox provides real-time, low-latency processing of
% audio signals using the System objects audioDeviceReader and
% audioDeviceWriter.
%
% This example shows how to acquire an audio signal using your microphone,
% perform basic... |
%% Initialization
set(0,'DefaultFigureWindowStyle','Docked')
addpath('../')
%% Read the file
dir_fileName = 'data/direct_43284.txt';
Data_dir = ReadBL11File(dir_fileName);
fileList=ls('data/CH*');
nFile = size(fileList,1);
for jj=(nFile):-1:1
Data_spec(jj) = ReadBL11File(['data/' fileList(jj,:)]);
end
NEXAFS_TEY_... |
alphas_psi=interp2(scale_X,scale_Z,radial_XZsmall_map',alphas_pos_x,alphas_pos_z,'nearest');
% correct the particles that are out of simulation domain
% by giving them a position randomly in the initial distribution
%outcast=[find(alphas_psi>=scale_X(end-2));find(alphas_pos_z>=scale_Z(en... |
function error = diff_gx_error(x,h)
error = abs(diff_gx(x,h) - pi.*cos(pi.*x));
end |
function new_obj = analysis__pev_spect(obj)
time_windows = [-1000:50:1000-150];
time_windows(2,:) = [-850:50:1000];
% time_windows = [-1000:150:1000-150];
% time_windows(2,:) = [-850:150:1000];
time_windows = time_windows';
freq_windows = [0:10:110];
freq_windows(2,:) = [10:10:120];
freq_windows = freq_windows';
f... |
function cluster = ...
configMatlabClusterObject(cluster, scheduler, submitArgs)
% Written by
% Alessandro Motta <alessandro.motta@brain.mpg.de>
% Cluster scripts are located in `../../clusterScripts`
scriptDir = fileparts(fileparts(fileparts(mfilename('fullpath'))));
scriptDir = full... |
function slipmoments = simulate_slipping(timevector)
dt = mean(diff(timevector));
durationSlip = 0.2;
t = 0:dt:durationSlip;
y = -200*(t.^2) + (100.*t);
slipmoments = zeros(size(timevector));
slipTimeBegin = round(length(timevector)/2);
slipTimeEnd = slipTimeBegin + length(y)-1;
slipmoments(slipTimeBegin:slipTimeEnd)... |
function z=dcwf(varargin)
%DCWF Return the default color matching function.
% Z=DCWF assigns the default color matching function to Z. DCWF is purly a
% convenience funtion and can be replaced by OPTGETPREF('cwf').
%
% See also: OPTGETPREF
% Part of the OptProp toolbox, $Version: 2.1 $
% Author: Jerker ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% INPUT:
% img = grey scale image
% a1, a3 -> real values such as: 0<a1<1 e a3>1
%
% OUTPUT:
% Ims = binarized image
% topt = optimum threshold
%
function [Ims, topt] = SAHOO(img,a1,a3)
% Use greyHist to determine the grey level histogram of the image
H = hist(img(:),0:255);
% Calculate... |
%vel of drone, x,y,z position errors rover to drone - predictors
%output is posn. of rover - response
%response is 0 to 1.6 m/s increase and 1.6 to 0 decrease during time
%period
%-----pre processing------
clc;
clear all;
close all;
rc = load("landing.mat",'GPS','POS');
%GPS laty -8 , longx -9 , spd - 11 , ... |
function dn = backprop(da,n,a,param)
%TANSIG2.BACKPROP Backpropagate derivatives from outputs to inputs
% Copyright 2012-2015 The MathWorks, Inc.
dn = bsxfun(@times,da,param.alpha*(1-(a.*a)));
end
|
function out = vertcat(varargin)
for w=1:nargin
if isa(varargin{w},'hderiv')
ndiff = size(varargin{w}(1).dV,2);
nvector = size(varargin{w},2);
nvalue = size(varargin{w}(1).dV,1);
break
end
end
cont = 0;
for w=1:nargin
if isa(varargin{w},'hderiv')
f... |
function [t, x, v, a] = lineSim(time, motor, numMotors, currLim, mass, fric, vi, dia, ratio)
% A function to simulate the maximum performance of an electic vehicle
% along a line. USES METRIC UNITS
eqMotor = motor;
eqMotor.freeCurr = numMotors .* eqMotor.freeCurr;
eqMotor.stallTorque = numMotors .* eqMotor.stallTorque... |
% Before trying to construct hybrid images, it is suggested that you
% implement my_imfilter.m and then debug it using proj1_test_filtering.m
% Debugging tip: You can split your MATLAB code into cells using "%%"
% comments. The cell containing the cursor has a light yellow background,
% and you can press Ctrl+Enter to... |
function strClassString = ConvertIntegerCodeIntoClassString( iIntegerCode )
%
switch iIntegerCode
%
case 1
strClassString = '+1';
%
case 2
strClassString = '+2';
%
case 3
strClassString = '+3';
%
case 4
strClassString = '+4';
%
case 5
strClassString = '+5';
%
case 6
strClassS... |
function newDict = update_SymSkew(data,dict,alpha,SPGD_opts)
%UPDATE_SYMSKEW Update the two-fold dictionary via SGD
%
% INUTS
% data - {} LDS data
% dict - {} LDS dictionary
% alpha - [] Sparse codes
%
% OUTPUTS
% newDict - {} Updated dictionary
% implemented by Wenbing ... |
classdef Etape < matlab.mixin.Copyable
properties
¨PositionInitiale
VitesseInitiale
PositionFinale
VitesseFinale
end
methods
function obj = Etape(positionInitiale, vitesseInitiale)
obj.PositionInitiale = positionInitiale;
obj.VitesseIn... |
function [xx,tt] = mycos(ff,fs,dur)
tt = 0:1/fs:dur;
xx = cos(2*pi*ff*tt);
end |
function yp=Generator(t,y,tc,H,flag)
%%
if nargin<3, tc=0.15;end
if nargin<4, H=6;end
if nargin<5, flag=true;end
Pm=1;
Pemax=1.5557; % 1/sin(pi*40/180), 40 degrees
Vret=0.75;
Vend=1;
delta=y(1);
w=y(2);
if t>tc+0.5,
V=Vend;
elseif t>tc,
V=Vend;
%V=Vret+(t-tc)*(Vend-Vret)/.5;
elseif t<0,
V=1;
else
... |
clc;
clear all;
close all;
i=[45,85,12,16,72,46,76,32,95,48,87,74,96,45,84,67,97,35,71,64,72];
for j=1:21
thingSpeakWrite(749352,i(j),'WriteKey','J36AQM0MB743UTNG')
pause(15)
end
|
function tRegularizedSignal = ...
RegularizeBidimensionalSignal( ...
tOriginalSignal, ...
tKernelEvaluationFunctionHandle, ...
fRegularizationParameter, ...
afKernelParameters, ...
bBeVerbose ) % optional
%
%
if( nargin == 4 )
%
bBeVerbose = false;
%
... |
%***************Staggered Grid************************************8
clear all;
close all;
imax=200; %no of grid points in y direction
jmax=200; %no of grid points in x direction
L_x=30;L_y=30;
dy=L_y/(imax);
dx=L_x/(jmax);
dt=0.005;
%%%%%%%%Special treatment of the domain
%absolute coordinate system
%defined for only p... |
function [u] = denoise(ff, dt)
Total = 2;
u = double(ff);
[m, n, k] = size(u);
for i = 1 : k
f = double(ff(:,:,i));
for t = 0:dt:Total
u_xx = u(:,[2:n,n], i) - 2*u(:,:,i) + u(:,[1,1:n-1], i);
u_yy = u([2:m,m],:, i) - 2*u(:,:,i) + u([1,1:m-1],:, i);
u(:,:,i) = u(:,:,i) + dt... |
% see http://fvt.simulkade.com/posts/2015-05-11-tracer-flow-porous-media.html
% Written by Ali A. Eftekhari
% Last checked: June 2021
Nx=50;
Ny=50;
Lx=1.0; % (m)
Ly=1.0; % (m)
% physical values
D_val=1.0e-9; % (m^2/s)
mu_val=1e-3; % (Pa.s)
poros=0.2;
perm_val=1.0e-12; % (m^2)
clx=0.05;
cly=0.05;
V_dp=0.6;
perm= field2d... |
close all
clear all
%% m script written on January 17, 2014 to make scatter plots of the wave height
%% comparisons between NDBC buoys
%% Buoy Info Cell Arrays
buoy.name={'44008','44097','44025','44065','44009','44014','44066',};
%% find all combinations of buoys
c = combnk(1:length(buoy.name),2);
%% determine the ... |
function [Ie] = edge_map(I)
Iv=convolution_image(I,[ones(7,3),zeros(7,1),ones(7,3)]);
Ih=convolution_image(I,[ones(7,3),zeros(7,1),ones(7,3)]);
Ie=max(cat(3,Iv,Ih),3);
figure,imshow(Ie);
end |
% go to the database and extract 1 million random vlad codewords
profile on
count = 1;
n_movies = 101;
projected_vlads_to_cluster = zeros(128,10000);
n_codewords = 64;
INPUT_PATH = '../PROCESSED_DATA/DB-MPEG1/movie'
for i=1:10000%size(projected_vlads_to_cluster,2)
i
m = randperm(n_movies); m = m(1);
main_folder_pa... |
%Simulates the car's dynamic behavior during the figure 8 test
function steeringSim(B,L,Rmax,b,m,path)
%Establish physical parameters
global currentPoint;
W = m*9.81;
a = L-b;
Iz = 0.650*m*a*b;%0.650 is yaw dynamic index
C = 170*180/pi;
steerRatio = 5;
Vx = 6;
Wf = b*... |
[x, fs] = audioread('C_01_01.wav');
[LPF_b, LPF_a] = butter(4, 50 / (fs / 2));
%Set BandPass Filter and operate
%N=1
[BP1_b, BP1_a] = butter(4, [200, 7000] / (fs / 2));
y1 = abs(filter(BP1_b, BP1_a, x));
enve1 = filter(LPF_b, LPF_a, y1);
n = 1:length(y1);
dt = n / fs;
f1 = (200 + 7000) / 2;
sin1 = sin(2 * pi * f1 * dt)... |
clear all
close all
clc
N = 500;
for x = 1: N
t(x) = x;
y = sin(0.05*x);
if y > 0, v(x) = 2;
elseif y<0 v(x) = 0;
else v = 1;
end
end
figure(1)
plot(t,v,'linewidth',2)
|
% Stats parameters
st.stat_lim = [0 0.6]; % window in SEC for stats
st.bsln_type = 'relchange';
st.bsln_lim = [-0.2 0]; % window in SEC for baseline correction
st.n_boots = 1000; % Repetitions for non-parametric stats
st.alpha = 0.05;
% FT Stats parameters
cfg_stat = [];
cfg... |
function y = testerSR()
fileID = fopen('squareOroot.txt','w');
for i = drange(1:10000)
p=mySquare(myRoot(i));
err=i-p;
if(err>=1 || err<=-1)
fprintf(fileID,'%5.5f %5.5f %5.5f\n',i,p,err);
end
end
fclose(fileID);
|
function [surfaces] = hideOuterSphereSurface(surfaces)
surfaces.sphereS1.s.FaceAlpha = 0.0;
surfaces.sphereS1.s.EdgeAlpha = 0.0;
end
% function [surfaces] = hideInnerSphereSurface(surfaces)
% surfaces.sphS2.FaceAlpha = 0.0;
% surfaces.sphS2.EdgeAlpha = 0.0;
%
% end |
clear all
path = get_path;
parameters = get_parameters;
experiments = get_experiment_list;
animal = [601:642 301:325]; %[501:538 551:568 571:588];
MUA = zeros(1, length(animal)); beta = MUA; gamma = MUA; age = MUA;
%% load stuff
for n = 1 : length(animal)
experiment = experiments(animal(n));
canale = 0;
... |
function [idx] = idx_kmeans(X, k)
% This function partitions the data into `k` clusters according to the K-Means algorithm.
%
% Input:
% ------------
% - X
% the data set to partition.
%
% - k
% number of bins (clusters) to partition the data set.
%
% Output:
% ------------
% - idx
% a vector specifyi... |
function [ channel ] = BestIO()
% Get the best arragement of inlet and outlet
% anti clock the IO from the T(1,2) and get Tqueue
size=101;
edge_length=25;
Tavg=AverageT();
channel=initialChannel(5);
Tqueue=zeros(1,size-1);
index=1;
% the first row
for i=2:4:(size-1)
Tqueue(in... |
%Ejercicio 4a
%A = [0 1 2;1 0 1;2 1 0];
%q = [1;1;-1];
q = [1;1;1];
A = [1 1 1; 1 2 3; 1 3 6];
TOL = 0.1^10;
for i=1:10
sigma = 25;
error = 1;
it = 0;
w = q;
w1 = q;
for k=1:i
w0 = w1; %save the 3d oldest one
w1 = w; %save the 2nd oldest one... |
function handles = osc_export_solutions_light(osc_message,handles)
% OSC_EXPORT_SOLUTION_LIGHT - Export current solution set in text file
%
% Usage: handles = osc_export_solutions_light(osc_message,handles)
%
% Check that a session is opened
if isempty(handles.session)
error('orchidee:osc:osc_get_attribute_domain... |
function [out_sfs,out_thets,out_x0,out_y0,nx,ny,r2mask,best_weights,t_best] = getPopulationMeasures(weights,gabor_params,r2,numweights,RF_size)
%Pick 'best' frame for each unit as defined by the frame with the most
%variance
sfs = squeeze(gabor_params(:,:,7));%Normalise to deg per pixel
thets = squeeze(gabor_params(:,... |
% Copyright (c) 2012 Howard Hughes Medical Institute.
% All rights reserved.
% Use is subject to Janelia Farm Research Campus Software Copyright 1.1 license terms.
% http://license.janelia.org/license/jfrc_copyright_1_1.html
classdef Measurement < handle
properties
Quantity
Exponen... |
a=[1 -1.5 0.7];
b=[1 0.5];
c=[1 0.2 0.1];
s2=0.1;
thi=idpoly(a,b,c,'nk',1)
ut=sqwave(100,15);
et=randn(100,1)*s2;
y=idsim(thi,[ut et]);
|
close all;clear all;clc;
% x1 = [0;1;0;1;];
% x2 = [0;0;1;1;];
% y = [1;0;0;1;];
x1 = [0];
x2 = [1];
y = [0];
%% Initilizing with Random Weights
data = randperm(20)-10;
W11_1 = data(1); W12_1 = data(2); b11_1 = data(3);
W21_1 = data(4); W22_1 = data(5); b21_1 = data(6);
W11_2 = data(7); W12_2 = data(8); b11_... |
function cellTracks = extractTracksInCell(tracks,posCell)
nCondition = length(tracks);
if nCondition == 1
nTrack = length(tracks.trackTXY);
for iTrack = 1:nTrack
trackRecord = tracks.trackTXY{iTrack};
xy(iTrack,1:4) = [trackRecord(1,2:3),trackRecord(end,2:3)];
end
InCellStart = inpol... |
function [] = Rec_func(word,recordnum)
% word: Word to be recorded.
% recordnum: Number of records for each word.
% e.g. Record 'Stop' for ten times types "Rec_func('Stop',10);" in command window.
%
% Process:
% (1) Create a folder named the word to be recorded at the path of the Rec_func.m file.
% ... |
%% PREPARE IMAGE REGISTRATION for spotChSimilarity based on shift in brightfield
function [strregframech1,regframech2,framech1,framech2,CellObject]=prepRegImages(BFImage,p)
if ~exist('p.CSplit')
p.CSplit=1;
end
if ~exist('p.bitDepth')
p.bitDepth=12;
end
if ~exist('p.topbottomcut') || ~exist('p.leftr... |
function varargout = Prepa81(varargin)
% PREPA81 M-file for Prepa81.fig
% PREPA81, by itself, creates a new PREPA81 or raises the existing
% singleton*.
%
% H = PREPA81 returns the handle to a new PREPA81 or the handle to
% the existing singleton*.
%
% PREPA81('CALLBACK',hObject,eventDa... |
function [stateDeriv, accelX, outputData] = vehicleModel(Car, stateVar, speed, curvature, throttleOrBrake)
% *************************************************************************
% FUNCTION NAME:
% vehicle model
%
% DESCRIPTION:
% This function contains the vehicle model
%
% INPUTS:
% Car - car data ... |
function color_rgb = orange
color_rgb = {'color', [1.0, 0.64705, 0.0]};
end |
%
% Classe CCatego
%
% Pour travailler avec des classements de niveaux et catégories
%
% STRUCTURE CATEGO ACTUELLE
%
% catego(1,niveau*,1)
% .nom -> nom du niveau
% .ess(n) -> 1 si l'essai n est encore disponible dans ce niveau
% .ness -> Nb d'essai encore disp... |
%preamble
clear all; close all; clc;
%load data
load('noisy.mat')
%call function plot best fit line
[M,B,R_2]=my_least_square(x,y)
%For loop for the fit line
for idx=1:length(x)
y_hat(idx)=M*x(idx)+B;
%end for loop
end
plot(x,y_hat,'r')
|
function result = Train_and_Predict_on_CASIA_ProCRC(X_train,Y_train,X_test,Y_test)
folds = 5;
indices_shuffled = randperm(20);
m = size(X_train,1);
fold_index = zeros(m,1);
for i = 1:m
fold_index(i) = ceil(find(indices_shuffled == ceil(i/12))/4);
end
%% load data
%-t... |
clc;
clearvars;
% function [Iter,Vx, Vy, Tole] = newton(data,step)
step = 1;
maxIters = 20; % Max Iteration bound.................
data = case14; % Load case file ............................
... |
%% this function is used to estimate the Gibbs free energy when two
%different salinity solutions are mixed. The Gibbs free energy is a
%validation of spontaneous reaction. the inputs consists of concentration
%of solution A and B (for two component system), volume ratio, and
%operating temperature. The reaction is oc... |
function result = ex_memoryGuidedSaccadePlusDots(e)
% ex file: ex_memoryGuidedSaccadePlusDots
%
% File for FEF experiment where we show dots for a revcor during the
% memory-guided saccade task
%
% XML REQUIREMENTS
% angle: angle of the target dot from the fixation point 0-360
% distance: the distance of the ta... |
clc;
% define number of runs
r = 1000;
% define number of points in data set
N = 100;
Nout = 1000;
% define point set size per run in order to identify the disagreement
% probability
NP = 1000;
doplot = 0;
sum_Ein = 0;
num_Ein = r;
sum_Eout = 0;
num_Eout = r;
while r > 0
% define target function
f_xy = ... |
function tbxStruct = demos
% DEMOS Demo list for Shark.
% Version 2.1
% Giampiero Campa 20-Dec-2001
if nargout == 0, demo blockset; return; end
tbxStruct.Name='Shark';
tbxStruct.Type='Blockset';
tbxStruct.Help={
'6DOF Nonlinear Underwater Vehicle Model'
};
tbxStruct.DemoList = { ' Ope... |
function drag = drag_locube(mach)
% Drag of a lo cube (i.e. a cube whose corner is facing toward the
% front). Drag function as a function of the Mach number, with the
% relationship digitized from Fig. 17 (p. 16-14) or
%Hoerner, S.F., 1965, Fluid Dynamic Drag: Vancouver, WA,
% published by the ... |
S = t1;
waveletFunction = 'db8';
[C,L] = wavedec(S,8,waveletFunction);
%% Calculation The Coificients Vectors
cD1 = detcoef(C,L,1); %NOISY
cD2 = detcoef(C,L,2); %NOISY
... |
classdef MClustData < handle
% Settings used in MClust
%
% ADR 2012/12
%
% contains data used in MClust that does change on a tetrode to tetrode
% cycle
properties(Constant)
maxClusters = 98;
end
properties(Access = public)
% constants
... |
function varargout = dple_out(varargin)
%DPLE_OUT Get DPLE output scheme name by index.
%
% {char} = DPLE_OUT()
% char = DPLE_OUT(int ind)
%
%
%
%
%.......
%
%::
%
% DPLE_OUT()
%
%
%
%Get output scheme of DPLE solvers.
%
%
%
%.......... |
%@(#) ssavesubset7.m 1.1 06/03/22 09:12:21
%
%function ssavesubset(infil,utfil,ifilt);
function ssavesubset(infil,utfil,ifilt);
load(infil)
%khot=khot(ifilt);
lastcyc=lastcyc(ifilt);
%burnup=burnup(ifilt);
crax=crax(ifilt);
crab=crab(ifilt);
crnx=crnx(ifilt);
crnb=crnb(ifilt);
maxqx=maxqx(ifilt);
maxqb=maxqb(i... |
%alinkjaccard(A,k)
function clustering=alinkjaccard(A,k)
D=pdist(A,'jaccard');
Z = linkage(D,'average');
clustering=cluster(Z,k);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.