text stringlengths 8 6.12M |
|---|
function set_paper(paper_orientation,paper_type,updatePaperSize);
% set_paper : set default paper orientation
%
% set_paper('landscape')
% or
% set_paper('portrait')
% or
% set_paper('portrait','a3')
% or ...
%
%
if nargin==0
paper_orientation='landscape';
end
if nargin<2
paper_type='a4';
end
if nargin<3
updatePaper... |
%*****************************************************************
% Description: show the saptial maps.
% The function is adapted from the GIFT toolbox
% (http://mialab.mrn.org/software/gift/index.html) and some functions
% and data involved are provided in the folder named "SMshow"
% Usage:
% SMd... |
function [indivs,flag,families] = catastrophes(indivs,catast,families)
flag = 0;
A = unique(indivs(:,4));
B = (rand(size(A,1),1)< catast); % 1 = to be wiped out
catast_patch = A(B);
% AA = hist(indivs(:,4),A)';
% BB = logical((AA > 5 & AA < 15).*(rand(size(AA))<0.3));
% catast_patch = A(BB);
% A = unique(indivs(:,... |
function visualise_samples(idx_best,data,dim,t,ig_best,N,idx) % Draw the split line
r = [-1.5 1.5]; % Data range
subplot(2,2,1);
if dim == 1
plot([t t],[r(1),r(2)],'r');
else
plot([r(1),r(2)],[t t],'r');
end
hold on;
plot(data(~idx_best,1), data(~idx_best,2), '*', 'MarkerEdgeColor', [.8 .6 .6], 'MarkerSize', 1... |
%第9章_程式流程控制
%關係運算子
clear;clc
4<12 %回應1代表true(結果成立)
%回應0代表false
x=3;
y=5;
fprintf('x>y is %d \n',x>y) %回應1代表true(結果成立)
%回應0代表false(結果不成立)
fprintf('%d = %d is %d \n',x,y,x==y) %回應1代表true(結果成立)
%回應0代表false(... |
function [values_spec,n,RandStruct]=getval_spectra(P,Q,labelconditions2,label1,s,w,win_size,same_nr_types,N,random_hfo,rand_first_run,tr)
if same_nr_types==1
n=N;
else
n=min([length(P.(labelconditions2{1}).(label1{w}){s}) length(P.(labelconditions2{2}).(label1{w}){s})...
length(P.(labelconditions2{3... |
%main
%clear, clc, close all
tic
figure
axis([-3 3 -3 3 -3 3])
grid on
pos = 0;
temp = [45*pi/180 45*pi/180 -45*pi/180];
Ax1 = [0 0];
Ay1 = [0 0];
Az1 = [0 0];
Ax2 = [0 0];
Ay2 = [0 0];
Az2 = [0 0];
Bx1 = [0 0];
By1 = [0 0];
Bz1 = [0 0];
Bx2 = [0 0];
By2 = [0 0];
Bz2 = [0 0];
Bx3 = [0 0];
By3 = [0 0];
B... |
function [C, sigma] = dataset3Params(X, y, Xval, yval)
%EX6PARAMS returns your choice of C and sigma for Part 3 of the exercise
%where you select the optimal (C, sigma) learning parameters to use for SVM
%with RBF kernel
% [C, sigma] = EX6PARAMS(X, y, Xval, yval) returns your choice of C and
% sigma. You should co... |
function smpl = slicesample(siz,number,a,b,nflips,nheads)
smpl = [];
w = 0.01*rand(1,siz);
u = 1;
x = (0.5).*ones(1,siz);
for i = 1:number
% if(mod(i,100)==0)
% i
% end
smpl(i,:) = x;
p = Beta_ExpLogPosterior(nheads,nflips,x,a,b,'explog');
up = rand(1,1)*p;
r = rand(1,1);
xl = x - r*w;
xr = x + ... |
function Update_Status_Figure(Obj,freqData)
% figure(Obj.StausFigure.H); % do not bring figure to front, this is slow...
Obj.StausFigure.p1.YData = Obj.StausData(:, 1);
Obj.StausFigure.p2.YData = Obj.StausData(:, 3);
Obj.StausFigure.p3.YData = Obj.StausData(:, 5);
Obj.StausFigure.p41.YData = Obj.StausData(:, ... |
clc; close all; clear all
% init random seed to reproduce randomness
% rng(42)
% call with some parameters
img = randi(500);
sigma = 0.04;
[b, u0] = denoisingLoadData('BSDS500', img, true, 'Cauchy', sigma);
h = size(u0, 1); % image height
w = size(u0, 2); % image width
c = size(u0, 3); % number of channels
figure(... |
%fitness_selection.m Computes the fitness of each member of the population
%as a function of their makespans using the selected method.
function probability = fitness_selection(makespan_mat, invert, method)
if method == "minMaxLinear"
probability = fitness_minmaxLinear(makespan_mat, invert);
elseif me... |
%
%Program will pad inputImage on each side by numberOfPixelsToPadBy
%
%input real valued images only
%
%Created by Brady Sheehan
%
function result = pad_image_nonsquare(inputImage, left, right, top, bottom)
newSizeMatrix = zeros(size(inputImage, 1) + top + bottom, size(inputImage, 2) + left + right);
... |
function d = Difference2(x,m,td,fun,Cw,y0,twd)
%--------------------------------------------------------------------------
%Returns the sum of squares of the difference between data points and trial
%solution at time points for which data is available.M minimisation of this
%difference leads the the optimised so... |
function outTable = table(obj, varargin)
% TABLE Method to cast a TableResult into a MATLAB table
% Returns an empty table for an empty TableResult
% Copyright 2018 The MathWorks, Inc.
% get a cell array of cell arrays of all obj properties
allPropNames = arrayfun(@properties, obj, 'UniformOutput', false);
% get the ... |
function regenerateTestClasses()
% Regenerate all test classes, replacing them with empty templates.
answer = questdlg('This will delete all of the current unit tests and replace them with empty templates. Are you sure you want to continue?');
if ~strcmpi(answer,'yes')
fprintf('Exiting, n... |
function rho = compute_bhattacharyya_coefficient(p,q)
sqrt_q = sqrt(q);
sqrt_p = sqrt(p);
rho = sum(sqrt_q .* sqrt_p);
end |
function show_annot(label_file, data_dir, offset)
% show_annot(label_file, data_dir, offset)
% Function to display annotations.
% label_file -- a Matlab matrix containing a structure "labels" and a matrix
% "skeleton_annotation"
% data_dir -- a directory containing data batches devel01, ... valid01, ...
% offset: a n... |
function [f, idle] = Encode_embedded_protocol_(q)
% BK's Note on Oct 5, 07
% This is used for Save_sequence_ (which is only NICstream),
% for the revision today, q.modes will have actual "mode" --i.e., reference E
% for BP. Therefore, it will be no longer a scalar for BP.
% (There is no change for MP)
% For B... |
% Generate Bistability File
clear
clc
tic;
InFolder='In/';
InFolderRead='In/Out/';
OutFolder='Out/';
BeadSize=0.01;
ParticleSize=0.01;
BeadNumber=1e3;
ParticleNumber=0;
Rsystem=6.0;
procedure=1;
selfavoidyes=0;
% Rfinalpool=Rfinal:(0.2-Rfinal)/n:0.2;
Rfinalpool=[1.0];
n=size(Rfinalpool,2)-1;
sizefactor=1; %sy... |
load training_data
%% initialize parameters for the neural network
input_layer_size = size(training_data,2);
output_layer_size = 10;
layer_size = [input_layer_size,500,250,30,output_layer_size];
theta = dnnRandInitializeWeights(layer_size);
[W,b] = dnnParamToStack(theta,layer_size);
lambda = 4;
%% training using mini... |
function [U, W] = uq_quadrature_nodes_weights_smolyak(Levels, Types, Parameters,polyAB)
% UQ_QUADRATURE_NODES_WEIGHTS_SMOLYAK(LEVELS,TYPES,PARAMETERS,POLYAB):
% return the Smolyak quadrature nodes Xi and weights Wi for polynomial
% of type TYPES{:} up to level LEVELS(:). PARAMETERS is mandatory only
% wh... |
[numDataPoints, ~] = size(plottingData);
sampleEigData1 = zeros(30,1);
sampleEigData2 = zeros(30,1);
sampleEigData3 = zeros(30,1);
for i = 1:30
sampleEigData1(i) = sampleEigSet{i}(1);
sampleEigData2(i) = sampleEigSet{i}(2);
sampleEigData3(i) = sampleEigSet{i}(3);
end
%Compute theoretical Eigenva... |
%%% Model of Scranton & Vasseur 2016 (Theor Ecol.)
%%% Developped by Picoche & Barraquand 2017
%%% Main for community assembly
clc
clear all
close all
dir_output='invasion';
%%%%%% Parameters
global S tau0 mu_tau sigma_tau tau_min tau_max a_r_tau0 E_r k A m thresh_min tspan r invasion_time
S=60 %number of species (6... |
clc; clear all; close all;
x = [1 2 3 4 5];
h = [1 2 3];
l1 = length(x);
l2 = length(h);
x = [x zeros(1,l2-1)]
h = [h zeros(1,l1-1)]
l = l1+l2-1;
y = [];
for(n = 1:l)
y(n) = 0;
for(k = 1:n)
y(n) = y(n) + x(k)*h(n-k+1);
end
end
c = conv(x,h);
disp(x);
disp(h);
disp(y);
disp(c);
su... |
function [X] = RecCirS_CSCoding(m,n, aTV2D, aTV3, aW2D, aW3, picks,T,Mask,B,PYR,NN,TVtype, opts,PsiT,Psi)
% [X] = RecCirS_3DCS(m,n, aTV2D, aTV3, aW2D, aW3, picks,Mask,B,TVtype, L1type, opts,PsiT,Psi,XRange)
% Recovery from Circulant Sampling using 3DCS
% min aTV2D*(\|G_1\|_1 + \|G_2\|_1 + \beta_1\|G_1 - D_1 I - b_1\... |
function xf = filterFreq( x, H, dim )
% function filterFreq( x, H, dim )
% filtering signal with H filter
% input:
% x - vector or matrix to transform
% H - filter in frequency domain
% dim - dimestion of filtering if x is a matrx
% output:
% xf - filtered signal
%
% Meng Wu
% 2014
if nargin <... |
%% MANAGE workspaces
close all; % close all figures
clear all; % clear the workspace
clc;
path_oomao = '/home/omartin/Projects/SIMULATIONS/OOMAO/mfiles/'; % the oomao path
path_workspace = '/home/omartin/Projects/PEPITO/'; % the simulation folder path
path_res= '/home/omartin/Projects/PEPITO/Results/'; % the simulatio... |
function R = simple_model(pIn, d)
% ODE Predator-prey interaction model (no longer so "simple")
%% Parameters
% Scaling constants
sT = pIn.param.sT;
sL = pIn.param.sL;
% Convert parameter values, according to scaling constants
p = convert_params(pIn,d);
% Define simulation type
p.param.sim_type = pIn.param.sim_typ... |
% Produces data for figures S3.
% How does the geodetically constrained core density and moment of inertia
% compare to the geochemically predicted?
lib_amp_Bertone_2021 = 39.03;
dlib_amp_Bertone_2021 = 1.1;
[C_m, dC_m] = fn_get_C_m(lib_amp_Bertone_2021, dlib_amp_Bertone_2021);
C_m = (C_m + [-dC_m 0 dC_m]);
rho_sulf... |
function drawVerticalSection( x, y )
%DRAWVERTICALSECTION Summary of this function goes here
% Detailed explanation goes here
end
|
function [A,R,w_jk,mu_jk,sigma_jk,extra] = gmm_hu(I,M,options)
%GMM_HU Summary of this function goes here
% Detailed explanation goes here
beta1 = 5;
beta2 = 5;
rho1 = 0;
rho2 = 0;
eta = 0.05;
A_gt = [];
fix_A = 0;
fix_w_k = 0;
fix_sigma_jk = 0;
fix_mu_jk = 0;
convergence_thresh = 0.002;
shrink_size = 2;
max_num_... |
% function z0 = CalcZ0(xLim)
%迭代求解积分的上下限 【x1 xMid x2】和 水面方程截距
%即可得到水面方程
clear
[A, B, H, volume,~,~,~,~,thetaL,thetaR] = setValue();
stepAngle = 20;
lenX = length(1:stepAngle:179);
z0 = zeros(lenX,1);
xLimData = zeros(lenX,3);
x1 = sqrt(H/A);
x2 = -sqrt(H/A);
xMid = sqrt(H/A);
Angle = [15 50 125 178]*pi/180;
for i = 4... |
function []=view_image(predicted_y)
% The following code can be used after the execution of an algorithm
% Let "cl_label" be the px-dimensional vector, whose i-th element is the label
% of the class where the i-th vector in X has been assigned
% The code below, helps in depicting the results as an imag... |
function [traces_lick_time, traces_lick_frame] = setLickTraces(alldata, outcomes)
%
% OUTPUT: Cell array of size numTrials x 1. Each cell is a vector of licks
% (0:no lick, 1:center, 2:left, 3:right licks) for a given trial.
%
% traces_lick_time: each sample is 1ms. Sample 1 is the start time of
% trials in bcont... |
function [hFig,hAx] = pwDistanceMatrix(cellNames,pwDistMat, varargin)
%pwDistanceMatrix. generates
%% Parse input.
p = inputParser;
p.addRequired('cellNames',@(x) iscell(x) && size(x,1)==1);
p.addRequired('pwDistMat',@(x) isnumeric(x) && issymmetric(x));
p.addParameter('LabelColors',[1,1,1],@(x) isnumeric(x));
... |
function d=lat2dist(lat1,long1,lat2,long2)
%convert to radians
lat1 = lat1*pi/180;
long1 = long1*pi/180;
lat2 = lat2*pi/180;
long2 = long2*pi/180;
R = 6371; % Earth's radius in km
delta_lat = lat2 - lat1; % difference in latitude
delta_lon = long2-long1; % difference in... |
function vector = divPolinom(polinom, a)
b = polinom(1);
vector(1)=b;
for element = polinom(2:numel(polinom))
b = element + b*a;
vector(end+1)=b;
end
end |
classdef unitRegistry < containers.Map
properties (SetAccess=private)
xmlfile % path to xml file
prefixes = {} % cell string of prefix keys
dimensions = {} % cell string of dimension keys
units = {} % cell string of unit keys
constants = {} % cell string of constant keys
... |
function [outdata, Ps] = gen_img(Azel_Data,DT1,DT2,app)
addpath ..\Photo_Determination\
load(strcat(app.sao_dir.Value,'\SAODATA.mat'));
FOV = app.fov.Value;
intensity = app.intensity.Value ;
intensity_max = app.sao_max.Value + 3;
hozpixel = app.heig... |
#
# A Trip Down Fourier Lane
#
# Clear any pre-existing variables
clear;
# Allow for immediate printf output (good for debugging)
more off;
N = 32;
two_pi_N = 2 * pi / N;
k = [0 : N - 1 ];
n = [0 : N - 1 ];
#
# Plot complex exponential points on the unit circle
#
W_N = complex(zeros(1, N));
for _k_ = 0 : N - 1
... |
function[y]=Der2Orden4(a,h)
y=(8(Der1Orden2(a+h,h)-Der1Orden2(a-h,h))-(Der1Orden2(a+2*h,h)-Der1Orden2(a-2*h,h)))/(12*h);
function[y]=f(x)
y=x*exp(x); |
%SYSTEMPERFORMANCE computes metrics on the overall system performance
%
% [T, Equiv_FPS_Rate] = systemPerformance(elapsed_1,elapsed_2, elapsed_3, elapsed_4)
% computes metrics on the overall system performance of the automated
% robotic microscopy system.
%
% INPUTS:
% elapsed_1 = 1xnFramesLeft array that... |
% this program demonstrates the fact that the result produced by the optimal
% set algorithm is not the optimal configuration which may imply the non-convextivity
% of the optimization problem.
% generate spring data
box1_vertices_x = [0,0,1,1];
box1_vertices_y = [0,1,1,0];
box1_spring_length = 3;
box1_edge_spring_nu... |
function [ r ] = RM( x,y,z )
x=pi*x/180;
y=pi*y/180;
z=pi*z/180;
r=[1 0 0; 0 cos(x) -sin(x); 0 sin(x) cos(x)]*[cos(y) 0 sin(y); 0 1 0; -sin(y) 0 cos(y)]*[cos(z) -sin(z) 0; sin(z) cos(z) 0; 0 0 1];
end
|
function [residual, g1, g2, g3] = US_SW07_rep_static(y, x, params)
%
% Status : Computes static model for Dynare
%
% Inputs :
% y [M_.endo_nbr by 1] double vector of endogenous variables in declaration order
% x [M_.exo_nbr by 1] double vector of exogenous variables in declaration order
% ... |
function [Cd, S] = CdRocket(h, U, Ma)
visc = viscosity(temp(h)); % [dynamic, kinematic]
L_rocket = 2; % meters
L_nosecone = 0.2; % meters
L = L_rocket + L_nosecone;
D = 0.1016; % = 4 inches
R = D/2;
Re = U*L/visc(2);
% approach #1 using (Mach << 1) Cp approximation
Cp = 1.28; % Cd for a flat pl... |
function u_clean_rawFolders(subjects, fileStruct)
%% Initialize
% Get a list of subject folders
sub_foldernames = f_CA_filenames(fileStruct.paths.raw, 'dir');
%% Clean Out the Folders
for i = subjects
% Get a list of the functional folder names
functional_foldernames = u_filenames(sub_foldernames{i}, 'ep... |
function [ k ] = getBins( x,c )
s=std(x);
n=numel(x);
b=(24*sqrt(pi))^(1/3)*s*n^(-1/3);
k=ceil(c*(max(x)-min(x))/b);
end
|
function plotSoln(t,q0,q1,dq0,dq1,u,current, power, Fx,Fy,KE,PE,marker)
if nargin < 13
marker = 'k-';
end
subplot(3,3,1); hold on;
plot(t,q0,marker)
xlabel('t')
ylabel('q0')
subplot(3,3,2); hold on;
plot(t,q1,marker)
xlabel('t')
ylabel('q1')
subplot(3,3,4); hold on;
plot(t,dq0,marker)
xlabel('t')
ylabel('dq0')
... |
clear; clc; close all;
[x,Fs] = audioread('som.wav');
t = ((0:length(x)-1)*(1/Fs))';
X = fft(x)';
wk = 2.*pi.*(0:length(x)-1)/length(x);
wk(wk>pi) = wk(wk>pi)-2*pi;
X = [X(wk<0) X(wk>=0)];
wk = [wk(wk<0) wk(wk>=0)];
F = (wk./(2*pi)).*Fs;
figure(1);
subplot(2,1,1);
plot(t,x,'--','Color','b');
hold on... |
%Vector with times
% for k=1:length(ti)-1
% caco=ti(1,k);
%
% if max(caco>S{1})&& (caco<E{1});
% end
% end
function [chec,chec2,checQ]=no_ripples(ti,S,E,ro,signal_array,signal_array2,signal_arrayQ)
% Find times with no ripples
caco=ti;
cao=signal_array;
cao2=signal_array2;
caoQ=signal_arrayQ;
for L=1:len... |
function obj = plot(obj,varargin)
Args = struct('LabelsOff',0,'GroupPlots',1,'GroupPlotIndex',1,'Color','b', ...
'VAng',0,'Events',0,'XShift',[],'PSparse',0,'MeanStd',0);
Args.flags = {'LabelsOff','VAng','Events','PSparse','MeanStd'};
[Args,varargin2] = getOptArgs(varargin,Args);
if(~isempty(Args.NumericArguments... |
function [avgfluor,stdfluor]=averagedirections(fluordata)
fn=fieldnames(fluordata);
for k=1:5
try
if isnan(fluordata.(fn{k}))
avgfluor.(fn{k})=NaN;
stdfluor.(fn{k})=NaN;
else
avgfluor.(fn{k})=nanmean(fluordata.(fn{k}));
stdfluor.(fn{k})=nanstd(fluordata.(fn{k}));
end
... |
%an example for reading and playing MOCAP data
skel=acclaimReadSkel('./data/13.asf');
[channels,skel ]=acclaimLoadChannels('./data/13_39.amc',skel);
skelPlayData(skel,channels,1/120) |
% LTASS: Computes long-term average speech spectrum via FFT
% Usage: mag=ltass(w,rate,twin,thop,nfft);
% w: input waveform
% rate: sample rate in Hz (default 10000 Hz)
% twin: frame length in ms (default: 10 ms)
% thop: frame update in ms (default: 5 ms)
% nfft: FFT window length (default: 256 samples)
function mag=lt... |
classdef correctxaxis
properties (Constant = true)
menuitemName = 'correctxaxis';
menuitemText = 'Correct X Axis';
menuitemMultiSelection = true;
end
methods (Static)
function menucallback(Parent,SelectedItems)
for i = 1:numel(SelectedItems.Variables)
Parent.SpectraList.correctxaxis(SelectedItems.Var... |
function [new_masks] = midline_remove(brains, masks, cond)
n = size(masks, 3);
if cond==1
new_masks = zeros(size(masks));
else
new_masks =masks;
end
for i = 1:n
brain = brains(:,:,i);
mask = masks(:,:,i);
if sum(mask(:)) && sum(brain(:))
img ... |
addpath('../util');init
addpath(genpath([VLIB 'Mid/Boundary/SketchTokens']))
P_DIR = [VLIB '../Piotr'];
addpath(genpath(P_DIR))
opts={};
dfs={'nClusters',150, 'nTrees',25, 'radius',17, 'nPos',1000, 'nNeg',16000,...
'negDist',2, 'minCount',4, 'nCells',5, 'normRad',5, 'normConst',0.01, ...
'nOrients',[4 4 0], 'si... |
function head_correction(inputfolder)
% This program takes in a folder containing two neutral tongue contour
% files. One must have 'C1_' (Contour 1) somewhere in its names. The other
% must have 'C2_' somewhere in its name. The program will find the optimal
% transformation of C2 such that it aligns as well as it... |
%% Description
% Simulates low ratio acceleration of the 2018 Baja car using the Briggs
% and Stratton Model 19 engine. Compared with experimental data, this
% script aids in determining the independent effective mass and independent
% effective moment of inertia of the Baja car.
%% Definitions
% * Independent effec... |
function drawFrame(q)
x = q(1);
y = q(2);
theta= q(3);
r = 0.1;
cx_x = x + r*cos(theta);
cx_y = y + r*sin(theta);
cy_x = x + r*cos(theta+pi/2);
cy_y = y + r*sin(theta+pi/2);
hold on
plot(x,y,'r*')
hold on
plot([x cx_x], [y cx_y],'r-')
hold on
plot([x cy... |
function out1 = hess_grf_ceq_heel2020(in1,toe_th,dmax,cmax,k,us,ud)
%HESS_GRF_CEQ_HEEL2020
% OUT1 = HESS_GRF_CEQ_HEEL2020(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:57
out1 = 0.0;
|
function larger_display2(A,mag)
A=double(A);
[H,W]=size(A);
B=zeros(mag*H,W);
for ia=1:mag
B(ia:mag:mag*H,:)=A;
end
C=zeros(mag*H,mag*W);
for ia=1:mag
C(:,ia:mag:mag*W)=B;
end
%figure; imshow(C/max(max(C)))
figure; imshow(C)
|
function [closestHistogram,spikeRate,binSpikes,relevantTIC,nRelevant,roundSpikePhase,neuronMostFrequentPhase,neuronMostFrequentPhaseCount,frequentPhaseProbabilityForNeuron,nNeurons,spikesPerChannel,HTabs,HTangle,FDsequence,HTsequence,timeSequence,data,FD,HT] = calcPhaseAndSpikeStatistics(ignoreSample,window_tot_ms,star... |
function CoGs = CoGPositions(xB,yB,theta,s1,phi1,s2,phi2,g,k1,k2,L_sp0,L_mB,mB,IB,m1,m2)
%COGPOSITIONS
% COGS = COGPOSITIONS(XB,YB,THETA,S1,PHI1,S2,PHI2,G,K1,K2,L_SP0,L_MB,MB,IB,M1,M2)
% This function was generated by the Symbolic Math Toolbox version 7.1.
% 14-Jan-2017 01:12:21
t2 = phi1+theta;
t3 = phi2+th... |
function p = DetectProb(prediction_Map, Birth, state, i, para)
% (c) Hyowon Kim, 2019
% (c) Hyowon Kim, 2019 (Ph.D. student at Hanyang Univerisy, Seoul, South Korea, emai: khw870511@hanyang.ac.kr)
% Usage: this code generates detection probability
% For BS
p(1).detection = para.P_D*ones(prediction_... |
function a2_detect_particles
% makes [frame_num x_coordinate y_coordinate] data file
s_raiz = 'a';
umbral_1 = 50; % binarize threshold
umbral_2 = 255; % only detect umbral_1<=...<=umbral_2
area_1 = 25; % area threshold
area_2 = 250;
elipse = 0.85; % eccentricity value
dir_1= '.\tracking_outp... |
function configureDataTipsFromUserData(fig)
if nargin == 0
fig = gcf;
end
dcm_obj = datacursormode(fig);
set(dcm_obj,'UpdateFcn',@datatipfn);
function txt = datatipfn(empt, event_obj)
if ~isvalid(event_obj.Target), txt = ''; return; end
ud = event_obj.Target.UserData;
... |
function [weights_i1,weights_12,weights_23,weights_34,weights_45,weights_5o ] = concatenate_weights( input_nodes,hidden_nodes_1,hidden_nodes_2,hidden_nodes_3,hidden_nodes_4,hidden_nodes_5,output_nodes,ga_list )
%Function concatenates list of weights into matrices
counter = 0;
rows_i1 = input_nodes;
columns_i1 = h... |
function [UJ, CJI]=oper_fe1D(i, UI, C, rho, dx, eta0, eta1)
r= eta0;
A0=[1 r*dx (r*dx)^2.d0/2.d0;...
0 1 r*dx; ...
0 0 1];
B0=[1 0 0;...
0 C(i,1,1,1,1) 0; ...
0 0 C(i,1,1,1,1)/rho(i)];
r= -eta1;
A1=[1 r*dx (r*dx)^2.d0/2.d0;...
0 1 r*dx; ...
0 0 1];
B1=[1 0 0;...
0 C(i+1,1,1,1,1) 0; ...
0 0 C... |
%functionMainAudioAnalyzer: this SW executes the following files in order
%to know if a recorded monotone audio has the expected fq and power:
% - loadingAudio.m
% - audioAnalyzer.m
% - comparisonAudio.m
% - txtGeneration.m
%
%Results are displayed in a txt file called tes... |
% [1] source : Poulin P., Theil F. Prediction of pharmacokinetics prior to
% in vivo studies. II. Generic physiologically based pharmacokinetic models
% of drug disposition.
% https://doi.org/10.1002/jps.10128
% [2] source : Poulin P., Theil F. Prediction of pharmacokinetics prior to
% in vivo studies. I. Mechanism... |
%% 一次性计算,写入所有价格m2tk
% 费时多效率低
tic
SS = 2.291;
RR = 0.07;
for iT = 1:length(uTs)
for iK = 1:length(uKs)
KK = uKs(iK)/1000;
TT = (uTdatenum(iT) - tday + 1) / 365;
% 写入call的
try
c_code = call.code.data{iT,iK};
eval( ['c = l2prof.sh', c_code , '... |
function [distance, index, neighbour_fun] = distance_cal(X_temp, weights, sigma, epsilon)
for j=1:100
distance(j) = norm(X_temp - weights(j, :));
end
[value, index] = min(distance);
neighbour_fun = exp(-(distance.*distance)/(2*sigma*sigma + epsilon));
end |
% Optimal 이 Proposed 랑 다른게 있는데 실제로 다른지 확인해보는 실험
% 아무래도 이러한 버그는 distance의 중복에 의해 발생하는것 같음
% nT = nR = nS = 4에서 진행하도록 설계
clearvars;
j = sqrt(-1);
comparison = false;
nS=4; %number of streams
nT=4; %number of transmit antenna
nR=4; %number of receive antenna
%LTE-A codebook
u=[ 1, 1, 1, 1, 1, 1, ... |
function [CFG] = MOT_config(CFG, test_idx)
CFG.tests{test_idx}.long_name = 'MultiObject_Tracking';
CFG.tests{test_idx}.expected_user_input = 'mouse';
CFG.tests{test_idx}.time_experiment = 10; % length of experiment time, in seconds
CFG.tests{test_idx}.num_min_target = 4; % minimum number of targets to b... |
function clearPossible
global board;
for ii = 1:numSquares
for jj = 1:numSquares
board(ii,jj).possible = nan(numSquares,numSquares);
end
end
end |
function [trialstats]=printpupilstats(s)
fields=fieldnames(s);
trialstats=[];
for i=1:size(fields,1)
% fprintf(1,'%s ',char(fields(i)));
% if ~mod(i,7) fprintf(1,'\n'); end;
trialstats=[trialstats; getfield(s,char(fields(i)))];
end
trialstats=trialstats';
%fprintf(1,'\n');
% trialstats= [s.Trial;... |
%
% Discrete Fourier transform
% by Project Nayuki, 2014. Public domain.
% https://www.nayuki.io/page/how-to-implement-the-discrete-fourier-transform
%
%
% This file contains multiple implementations.
% Before running the code, choose one and delete the rest.
%
% --------------------------------------------------... |
function Volume = Convert_to3d(cell_array)
% Convert_to3d converts the contents of a cell array to a 3D volumetric
% image
% Inputs:
% cell array
% Outputs:
% 3D volumetric image
for i = 1: length(cell_array)
Volume(:,:,i) = gather(cell_array{i});
end
end
|
clear all; close all; clc;
root = "..//images//"; % Root directory where images are stored
images = ["atypical","typical","mid"]; % List of names of images
%%% Load image %%%
for i=1:1:length(images) % Iterate over size of image class
for j=1:1:6 % Iterate over image number (there are 6 i... |
%用BaumWelch算法训练hmm
%输入样本集以及上次hmm,返回迭代训练后的hmm
function hmm = BaumWelch (hmm, data)
%一些变量的定义
N = hmm.N;
pi = hmm.pi; %初始概率
A = hmm.A; %转移矩阵
B = hmm.B; %转移矩阵
T = length (data); %样本数量
allValue = 0;
gamma = [];
xi = [];
for i = (1 : T)
[gamma(i).x, xi(i).x] = calcGamma (hmm, data(i).x);
allValue = allValue + data... |
function b = zeroin(f,a,b)
% Zeroin(f,a,b) reduces the interval [a,b] to a tiny
% interal on which the function f(x) changes sign.
% Returns one end point of that interval.
fa = f(a);
fb = f(b);
if sign(fa) == sign(fb)
error('Sorry, f(x) must change sign on the interval [a,b].')
end... |
function names = getNames(freq)
% GETNAMES Loads the CRSP stock event - name history dataset
persistent names_d names_m
if nargin < 1 || isempty(freq)
freq = 'monthly';
end
freq = validateFreq(freq);
folder = fullfile(fileparts(mfilename('fullpath')),'data');
switch freq
case 'monthly'
if isempty(na... |
clear ;
% Trabalhando com graficos
w = 100 ;
f = w/(2*pi) ;
T = 1/f ;
fc = (15*pi)/180 ;
fb = (5*pi)/180 ;
dt = T/100 ;
t = 0 : dt : 3*T ;
y1 = 10*sin(w*t) ;
y2 = 2*cos(3*w*t+fc) ;
y3 = 1.2*cos(5*w*t+fb) ;
y4 = 10*sin(w*t)+2*cos(3*w*t+fc)+1.2*cos(5*w*t+fb) ;
subplot (4,1,1)
plot(t,y1,'r') ;
subplot (4,1,2)
plot(t,y... |
% 3) Escrever um algoritmo para realizar a filtragem com o filtro Moving Average aplicando a
% média das amostras seguintes do sinal de entrada. O filtro pode ser de qualquer tamanho.
% 5) Escrever um programa para fazer a filtragem do exercício anterior de forma recursiva.
function [z] = soma_produtos(x, y)
N = len... |
function Y = smooth(X)
%SMOOTH Summary of this function goes here
% Detailed explanation goes here
I = -2:2;
sigma = 2;
gaussian = exp(-I.^2 / (2*sigma^2)) / (sigma * sqrt(2*pi));
Y = conv(X, gaussian);
Y = Y(3:end-2);%, 'same'); |
function exportmatrix(data,filename,delimiter)
fp = fopen(filename,'w');
if length(delimiter)==2 && all(delimiter == '\t')
delimiter = ' ';
end
for i=1:size(data,1)
for j=1:size(data,2)
fprintf(fp, '%g%s', data(i,j), delimiter);
end
fseek(fp,-1,0);
fprintf(fp, '\n');
end
fclose(fp); |
clc;
clear;
close all;
center_freq = '500000000';
g = 0:5:315;
a = 5:5:35;
span = 1e6;
res_bw = 5.1e3;
delta = span/1000;
f = -0.5*span:delta:0.5*span-delta;
ind1 = find(f == 2.5e4);
ind2 = find(f == 1e5);
ind3 = find(f == 5e4);
ind4 = find(f == 7.5e4);
mean_imd3_lvl_dBc = zeros(length(a), length(g));
for jj = 1:l... |
# -*- octave -*-
function xx=down_conversion(fc)
fns=glob("wav/ThuB*wav");
# fns={"wav/ThuB_002_800_01.wav"};
fns={"/Volumes/DATA1/PERSEUS/ExternalWAVE/ThuB_002.wav"};
f0 = 800e3;
decim = 50; # 40 kHz i/q wav samples
bw = 38e3; # +- 19 kHz
osc = @(f,fs, N) exp(2*pi*i*f/fs *[1:N]');
x=... |
% regularization test for deconvolution
% tests tfunc regularized acyclic deconvolution routine
%
%
% 08/13/14
%
mics = 1;
order = 4;
winsize = 1000;
mscale = 0.1;
mshift = 0.9;
% adjust regularization parameter alpha to find optimum
alpha = 1;
[vec, lambdas, f, z, w, r] = modesynth(mics, order, winsize, ms... |
FileIO = {'C:\Users\David\Documents\MSU Research\Doctoral Work\Mechanical Testing\Radiation Recrystallization\PhD Work\Spheres\Images\';
'0001.tif';
'0050.tif';
'Spheres'};
sensitivity = .5;
% [Data]=Segmentation3D(runtype,imsize,FileIO,sensitivity,FileOutFlag,figflag)
[Data]=Segmentation3D('terminal',0,Fi... |
% c8truck_alt.m
%
% Class 8 Truck 28 V Alternator
%
% the mechanical power required by an alternator in W given
% engine mechanical shaft speed in rad/s and alternator electrical load (W)
%
% ADVISOR data file: c8truck_alt_func.m
%
% Data source: Schmidt, M., Isermann, R., Lenzen, B., Hohenberg, G.
% "Potential of Re... |
function [ in ] = lowpass_filter( in )
window=35;
% coeff=ones(1,window)/window;
coeff=normpdf(1:window,window/2,10);
coeff=coeff/sum(coeff);
if(ndims(in)==3)
for i=1:size(in,1)
for j=1:3
in(i,j,:)=filter(coeff,1,in(i,j,:));
end
end
else
for i=1:size(in,1)
in(i,:)=f... |
clf;clear all
% fc = 6
% N = 6
% t = (0:0.01:N)/(fc)
% origin_signal = cos(2*pi*fc*t)
load('./filter/FIR_LP')
load('./filter/FIR_LP_2')
down = 32
up = 32
% generate signal
len = 50
mid = ceil(len/2)
half = 10
rect = zeros(1,len)
rect(mid-half:mid+half) = 1
tri = conv(rect,rect)
% up then filter it then down sample it... |
classdef lossMSE < ILossFun
properties
toDeriv = true;
end
methods
function obj = lossMSE()
end
function y = derivOut(obj)
y = obj.toDeriv;
end
function [cost, deltas] = apply(obj, x, y)
deltas = x - y;
... |
function x_n = newtons(s, w)
thres = 10^(-8);
x_n_1 = s;
w_ = horners(x_n_1, w);
x_n = x_n_1 - (polyval(w, x_n_1)/polyval(w_,x_n_1));
diff = abs((x_n - x_n_1)/x_n) < thres;
while diff > thres
w_ = horners(x_n_1, w);
x_n = x_n_1 - (polyval(w, x_n_1)/polyval(w_,x_n_1));
... |
function [output] = delay(input,depth,delay,feedback,Fs)
% This function alters the input signal by feeding back a delay of the
% input signal.
% The depth determines how much of the delayed signal is fed back: 0-1
% Delay time is specified in milliseconds
% Feedback controls the amplitude of the signal to be fed back... |
function powerFreqBand = powerFreqBand(powerSignal,F,frequencyBand,normalize)
if nargin == 1
normalize = true;
end
fs = 1000;
powerFreqBand = zeros(length(frequencyBand)+2,size(powerSignal,2));
for j = 1 : size(powerSignal,2)
powerTotal = sum(powerSignal(:,j));
powerFreqBand(1,j) = powerTotal;
if ~norm... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.