text stringlengths 8 6.12M |
|---|
function E = gaussian_filter(raster,X,Y,r)
% Parameters
w=abs(X(1,2)-X(1,1)); %spacing of grid in the convolution
r=(r/w)*w;
%R = Matrix of correlation coefficents
%W = weight kernel
E = raster; % input raster used instead of random generated white noise error.
% correlation coefficients matrix R
m=(2*((2*r)/w))+1;... |
function ex=p_excess(clv,x)
% P_EXCESS computes the excess vector of game v w.r.t. x.
% using Matlab's PCT.
%
%
% Usage: ex=clv.p_excess(x)
%
% Define variables:
% output:
% ex -- excess vector of game v w.r.t. x.
%
% input:
% clv -- TuGame class object.
% x -- payoff vector of size(1,n).
%
% ... |
% Example:
%
% Segmentacion por movimiento, sustraccion de fondos
%
% (c) Domingo Mery (2015) - http://dmery.ing.puc.cl
% Christian Pieringer
clt
vidObj = VideoReader('secuencia_color.mov');
vidObj.CurrentTime = 0.5;
op = input('1: display, 2: edges, 3: red map, 4: median? ');
Z = zeros(288,360);
frame1 = 0... |
%%********************************************************************
%% monomials: generate all the powers of n-variable monomials
%% up to degree deg.
%% list(i,:) = powers of the i-th monomial.
%%
%% (n,deg) = (20,6), size(list) = [230230,20], 23.1% nnz.
%% (n,deg) = (50,4), size(list) = [316251,5... |
% SVM using original data input
% Copyright By Baohua Sun
% 20120409
close all
clear all
clc
%%
% GenerateProcessedDataMat
%% Training
load TrainDataMatFile.mat
% TrainingData=reshape(imData,size(imData,3),64);
TrainingData=imData;
Group = (imLabel>=5);
% SVM
svmStruct = svmtrain(TrainingData,Group,'showplot',true);
... |
clc;
clear;
I = imread('breast_ROI.png');
I = rgb2gray(I);
imhist(I);
%% 0°方向1~10距离灰度共生矩阵
% for i=1:10
% glcm0(:,:,i)= graycomatrix(I,'NumLevels',256,'Offset',[0 i],'Symmetric', false);
% end
% %归一化处理
% glcm0=glcm0/sum(glcm0(:));
% %% 45°方向1~10距离灰度共生矩阵
% for i=1:10
% glcm45(:,:,i)= graycomatrix(I,'Nu... |
% Tao Du
% taodu@stanford.edu
% April 27, 2014
% transform a point from world frame to a camera frame
% Rc and Tc are from TOOLBOX_calib
% the format of the input:
% XX: a n by 3 matrix, each column represents a 3d point in the world
% frame
% Rc and Tc: calibration results from TOOLBOX_calib
% XXc... |
% PA_MICRO_INIT
%
% Initializes Microcontroller, checks and opens graphical monitor
%
% See also PA_MICRO_GLOBALS
% 2013 Marc van Wanrooij
% original: Dick Heeren
% e: marcvanwanrooij@neural-code.com
%% Global variables
pa_micro_globals;
%% Initialize Micro
timeout = 100;
[com msg] = rs232(115200,t... |
clear all;
close all;
%单一缓冲罐理论迭
%% 缓冲罐计算的参数设置
vType = 'BiasFontInStraightOut';
isSaveFigure = 0;
useMainPaper = 1;%大论文用
coeffFriction = 0.03;
if 0
param.isOpening = 0;%管道闭口%rpm = 300;outDensity = 1.9167;multFre=[10,20,30];%环境25度绝热压缩到0.2MPaG的温度对应密??
param.rpm = 420;
param.outDensity = 1.5608;
param.Fs = ... |
%% Prepare truncatula model 2
TruncaNewNames = importdata('TruncaNamesMapping_of_shared.NewMetNames');
TruncaOldNames = importdata('TruncaNamesMapping_of_shared.OldMetNames');
for i = 1:length(TruncaOldNames)
metindex=findMetIDs(IntegratedTrunca, TruncaOldNames(i));
% _b mets do not forma... |
function [ Vq] = interp2_multi( V,Xq,Yq, method)
%INTERP2_MULTI Summary of this function goes here
% Detailed explanation goes here
[h, w, ~] = size(Xq);
[~, ~, c] = size(V);
Vq = zeros(h, w, c);
for k = 1:c
Vq(:,:,k) = interp2(V(:,:,k), Xq, Yq, method);
end
end
|
function [tSgram fSgram Sgram] = getSpectrogram(lfp,Fs)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Description:
%
%
%Input:
%
%
%Output:
%
%
%Author: Tibin John, tibintj@umich.edu
%Project directory name: /nfs/turbo/lsa-ojahmed/tibin/spikeDynamicsAnalysisTibin
%Created on... |
function color_rgb = sienna
color_rgb = {'color', [0.62745, 0.32156, 0.17647]};
end |
function SBJ05e_PHS_plot_stats_CLreg_RL(SBJ_id,proc_id,an_id,stat_id,save_fig,varargin)
%% Plot group model coeffifient TFR matrix per circular-linear regressor + R2
% Betas are outlined by significance
% R2 is plotted as separatefigure, one matrix per regressor
% Only for single channel
% INPUTS:
% SBJ_id [str... |
function yinterp = extrap1overnans(x, y, exmethod, xgrid)
%% [yinterp] = EXTRAP1OVERNANS(x, y, exmethod, xgrid)
%
% inputs
% - x: location of data points of y along the
% interpolation dimension.
% - y: vector or matrix.
% - exmethod:
% - xgrid (optional): locations where we want to... |
classdef quadrotor_agentHelper < agentHelper
%% properties
properties
% FRS info
FRS
FRS_time_step
FRS_time
FRS_N_steps
% tracking error
tracking_error_table
tracking_error_type = 'table' ; % 'none', 'constant', or 'table'
tracking... |
function [f0] = myPitchTrackHps(xb, fs)
%% Blockwise Pitch Tracking based on HPS approach
% Input:
% x: (N x 1) float vector, input signal
% blockSize: int, block size of the blockwise process
% hopSize: int, hop size of the blockwise process
% fs: float, sample rate in Hz
% Output:
% f0:... |
function distanceMatrix = calculateDistanceMatrix(mSubstrate,metric)
%MFCC
%Linear
%Shift invariant 1
%MFCCmod
sgramA = mSubstrate.STRAIGHTspectrogramOfSpeakerA;
sgramB = mSubstrate.STRAIGHTspectrogramOfSpeakerB;
fs = mSubstrate.samplintFrequency;
fftl = (size(sgramA,1)-1)*2;
switch metric
case 'Linear'
mat... |
function rw = falco_zwfs_getReferenceWave(mp)
% Computes the reference wave for the Zernike wavefront sensor using
% FALCO model
modvar.wpsbpIndex = 1;
modvar.sbpIndex = 1;
modvar.whichSource = 'star';
modvar.lambda = mp.lambda0;
mp.dm1.V = zeros(mp.dm1.Nact);
mp.P1.full.E = ones(size(... |
% Compare reconstructed indicator function for gmm 2d
rng('default');
N_list = [500; 1000; 1500; 2000; 2500; 3000; 3500;];
sigma = 100/1000;
% Number of times experiment will be repeated
reps = 100;
x0 = 0.75;
% mixing
alpha = 3;
weights = [0.5 0.5];
p1 = @(x,y) (alpha/pi) * ( 1 - (x + x0).^2 - y.^2 ).^(alpha-1) ... |
function eta = etas(n)
if n == 2
eta(1) = -1/sqrt(3);
eta(2) = 1/sqrt(3);
elseif n == 3
eta(1) = -sqrt(3/5);
eta(2) = 0;
eta(3) = sqrt(3/5);
elseif n == 4
eta(1) = -sqrt((3+2*sqrt(6/5))/7);
eta(2) = -sqrt((3-2*sqrt(6/5))/7);
eta(3) = sqrt((3-2*sqrt(6/5))/7);
eta(4) = sqrt((3+2*sqrt(... |
L = 5;
N = 1000;
x = linspace(-L,L,N)';
dx = x(2) - x(1);
trig = 1:200;
U = [100*ones(1,500) trig-200 zeros(1,300)]';
%U = [100*ones(1,100) zeros(1,900)]';
% Three-point finite-difference representation of Laplacian
% using sparse matrices, where you save memory by only
% storing non-zero matrix elements
e = ones(N,1... |
%Test script for the ARGUS method
clear; %close all;
%path added for regression methods
%Set seed for repeatability
%s = RandStream('mt19937ar','Seed',1);
%RandStream.setGlobalStream(s);
rand('seed',1)
%Set initial conditions
intialSize =5;
dim = 2;
%Set stop conditions
maxPoints = 1000;
pntsAdd = 10;
... |
function [w, obj_vec] = train_multi_linear_subgradient_primal(features,costs,lambda,w0)
%TRAIN_LINEAR_SCORER
%
% weights = TRAIN_LINEAR_SCORER(features,costs,lambda)
%
% features - Cell array of length n. features{i} is L x d.
% costs - Array of size N x L.
% lambda - Regularization constant.
%
% w - d x L
% w... |
clear all
close all
lims=[-74.5 -71 39 41.25]; % zoom out all of NJ
% lims=[-74-15/60 -73-30/60 39+30/60 40+15/60]; % zoom in on SPRK
% lims=[-74-20/60 -73-30/60 39+50/60 40+30/60]; % zoom in on BRAD
% lims=[-74-20/60 -73-30/60 39+40/60 40+20/60]; % zoom in on SPRK
% lims=[-74-30/60 -73-40/60 39+20/60 40+00/60]; % zoo... |
function [M,eval]=SelectOperater(eval1,M1,pop_size)
%%
%选择算子:选择适应度最大的作为新种群
[~,position]=sort(eval1);
for j=1:pop_size
n=length(eval1);
M(j,:)=M1(position(n-j+1),:);
eval(j)=eval1(position(n-j+1));
end |
function proteinseq = dna2protein(dnaseq,frame)
% Input a dna sequence and a reading frame and returns the corresponding
% protein sequence.
if frame ~= 1:3
proteinseq = 'error: frame has to be 1, 2 or 3';
else
dna_length = length(dnaseq);
dnaseq = dnaseq(frame:dna_length);
[ORF_length, start_pos, end_... |
function output = OriX_matt(plxTs,expo)
%function output = OriX_matt(plxTs,expo)
%PPath = pwd;
Precision = 1000;
%fd = dir([PPath '/' FileName '.xml']);
%output.expo = readexpoxml([PPath '/' fd.name]);
output.expo = expo;
%fd = dir([PPath '/' FileName '.plx']);
%fprintf('Loading PLX File\n');
%plxTs = plx_reader([PPa... |
function result = gab_task_fmri_norm_write(args)
%a small function to write a wrapper for spm_run_coreg_estwrite.m that
%coregisters a set of data with a reference image. make sure spm8/config is
%on your path to allow this to find spm_run_coreg_estwrite.m
%grab defaults for now, possibly overwrite some with args...
d... |
function [torques] = InverseDynamics(theta, thetad, thetadd, g, Ftip, Mrel, G, S)
%Computes joint torques to produce a required theta, thetad, thetadd, g
%FTip, and robot description
%Input - theta - joint angle n by 1
% thetad - joint velocity n by 1
% thetadd - joint accel n by 1
% g - gr... |
%% Choix algo
boolf=0;
resultAlg=0;
%%%%%%% CHOIX algorithme %%%%%%%%%%%%%%
while (boolf==0)
prompt='Quel algorithme choisissez vous ? (n/r) : ';
alg=input(prompt,'s');
switch alg
case 'n'
resultAlg=1;
boolf=1;
case 'r'
res... |
function [ er_rat,ind ] = fun_find_err_big( re,pr,thred )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
%% old version
% er = abs(re-pr);
% ind = max(er') > thred;
% er_rat = sum(ind)/length(re(:,1));
%% new version
er = abs(re-pr);
ind_mat = (er) > thred;
er_rat = sum(i... |
% showAvgView.m
%
% Sets magnetoPreview.m's displayMode to AvgView.
%
% JSB 11/2010
function showAvgView()
global trackingParams;
trackingParams.displayMode = 2;
|
%Question 7 -- Simulation of RGP algorithm for values of n={5,10,...,100},
%each value of n is executed 30 times and an average is returned.
T1_Property=RUN_RGP(1); %%
T2_Property=RUN_RGP(2);
%Question 8- plot Averege of T1, Averege of T2 and 0.5*x*log(x)
x=5:5:100;
y=0.5*x.*log(x);
plot(x,T1_Property,'-... |
% Tanvir Ferdousi
% Kansas State University
% Last Modified: Oct 2018
% Copyright (c) 2019, Tanvir Ferdousi. All rights reserved.
% Redistribution and use in source and binary forms, with or without
% modification, are permitted
% Averages out several properties
function [avg_props, props_half_int] = computeOutPropAv... |
function [cmResults] = moveChanges(mAdj, mInitMembership, percChange, numRuns, ccMeasures)
%
% @author: Jeffrey Chan, 2013
% generate changes, up to percChange
vertNum = size(mAdj,1);
changeNum = max(floor(vertNum * percChange), 1);
cmResults = cell(1, length(ccMeasures));
for m = 1 : length(ccMea... |
function [ArchsMin,VolArchReal]=findMinSimplex(numIter,DataPCA,algNum,NArchetypes,silent)
% numIter - number of iterations for the algorithm to find a minimal
% bounding simplex
% DataPCA - Data points after PCA
% algNum - which algorithm to run in order to find the bounding simplex:
% algNum=1 :> Sisal (defa... |
% GMM Initialization Setup
rosshutdown; clc; clear; close all; clc;
global x_h y_h z_h pitch_h roll_h yaw_h; % global variables for head
global x_1 y_1 z_1 pitch_1 roll_1 yaw_1; % global variables for quad
global inp out master thresh num_iter verbose K flag; % global variab... |
%% PREPROCESSING AND ANALYSIS WRAPPER
%clear and close everything
ccc
%%%%
% description of the dataset settings
% 1) NewBaseline: this has the window of 1024ms, and the baseline is 712-512ms. Epoched to the entrainers
% 2) NewBaseline2: this has the window of 512ms, and the baseline is 456-256ms. Epoched to the entra... |
function avg_deg = find_avg_deg(adj)
n = size(adj,1);
avg_deg = sum(sum(adj,2))/n;
end |
function [model,ll] = kernelSxtraceLogLikelihood(model,X)
% CONSTRAINTLOGLIKELIHOODLDA Constraint loglikelihood for kernel
% FORMAT
% DESC Returns loglikelihood for constraint
% ARG model : fgplvm model
% ARG X : Latent locations
% RETURN ll : Returns loglikelihood
%
% MODIFICATIONS : Guoli Song, 2018
if n... |
function fd_cell = Make_fdcell(coef,basis_cell)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function Make_fdcell
%
% A function to create a cell array of functional data objects.
%
% INPUTS:
%
% coef - a vector giving the co-efficients of the basis expansion, these
% are concate... |
function [I_out] = watershed_cell_disttr(I)
% This function applies a distance transform and watershed segmentation
% algorithm to the pre-processed colonies.
% Output: I_out = image with watersheds identified
I_perim = bwperim(I);
%% Distance transform
dist_tr = bwdist(~I);
%figure, imshow(dist_tr, []),... |
% Copyright (C) 2016-2018 Zhixian MA <zx@mazhixian.me>
% MIT License
% An example to train the granular SVM model
% Init
clc; clear; close all
% load data
load ../data/SampleSet
% Get granules
DataGranules = getGranule(X_train,Y_train);
GraNum = DataGranules.GraNum;
% Init the models
ModelGSVM = cell... |
%因果性分析,x[n]超前了
% Causal
n=-5:1:5;
x1=[zeros(1,7) 1 zeros(1,3)];
y1=[zeros(1,6) 1 zeros(1,4)];
subplot(2,1,1);
stem(n,x1);
title('1,4(g2)-1');
xlabel('x[n]=δ[n-2]')
subplot(2,1,2);
stem(n,y1);
title('1.4(g2)-2');
xlabel('y[n]=x[2n]=δ[n-1]')
saveas(gcf, "LAB1/P1_4_g2_out.png") |
% ------------------------------------------------------
% SwarmOps - Heuristic optimization for Matlab
% Copyright (C) 2003-2010 Magnus Erik Hvass Pedersen.
% Please see the file license.txt for license details.
% SwarmOps on the internet: http://www.Hvass-Labs.org/
% --------------------------------------------------... |
function Secante = Sec(a,b)
f=inline('exp(-1*(x^2))-cos(x)');
iteracion=1;
T=0.00001;
E=10;
tic
x0=a;
x1=b;
while(T<E)
x2=(x0*f(x1)-x1*f(x0))/(f(x1)-f(x0));
E=abs((x2)-(x1))/abs(x2);
if E<T
iteracion
E
toc
sol=x2
end
iteracion... |
function [y, cons] = TP_MOO_VIENA(x,motor,Inertia,loadTorque,opt)
%parametros:
dTime = 1;
time = 0:dTime:30;
timeLength = numel(time);
%% variáveis de decisão;
voltage = x(1:timeLength); % composta
frequency = x((timeLength+1):end);
dist = 0;
distArray = zeros(1,length(ti... |
function redes_neuronais_c_todas_as_pastas()
clc
diretoria1 = 'Datasets greek\\Pasta1';
d1 = dir([diretoria1 '/*.jpg']);
[~, reindex] = sort( str2double( regexp( {d1.name}, '\d+', 'match', 'once' )));
d1 = d1(reindex) ;
diretoria2 = 'Datasets greek\\Pasta2';
d2 = dir([diretoria2 '/*.jpg']);
... |
function connected = connectToCheetah()
connected = NlxAreWeConnected();
if connected ==1,
disp 'We are already connected';
else
serverName = '192.168.3.100';
disp(sprintf('Connecting to %s...', serverName));
success = NlxConnectToServer(serverName);
if success ~= 1
disp(sprintf('FAILED conn... |
clc;
clear;
close all;
img = imread('rail.jpeg');
ref = imread('child1.jpg');
%Input Image Histogram equalistaion
r = size(img,1);
c = size(img,2);
imgh = uint8(zeros(r,c));
n = r*c;
f = zeros(256,1);
pdf = zeros(256,1);
cdf = zeros(256,1);
cum = zeros(256,1);
out = zeros(256,1);
for i=1:r
for j=1:c
v... |
function [mappedcontainer] = binary_mapper(object)
%% Generic mapper function
value = {};
l = length(object);
for i=1:length(object)
array = zeros(l,1)';
array(i) = 1;
value{i} = (array);
end
mappedcontainer = containers.Map(object,value);
end
|
function [thrs,cntR,sumR,cntP,sumP,V] = edgesEvalImg( E, G, varargin )
% Calculate edge precision/recall results for single edge image.
%
% Enhanced replacement for evaluation_bdry_image() from BSDS500 code:
% http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/
% Uses same format and is fully compatible... |
clear all
clc
%该函数用以产生优化所需要的矩阵A和B
% load([name,'.mat']);
name1 = ['WS';'NW';'BA';'ER'];%WS or NW or BA or ER
name2 = ['10';'20';'40'];%10or20or40
name3 = 'L-L';%L-L or R-L or L-R
name4 = ['CI';'MI';'NI'];%CI or MI or NI
t0 = 1e-03;
t = 0:t0:(30-t0);
for n4 = 1:3
for Nmm = 0.4:0.1:1
for k = 1:4... |
function [cropped_image] = cropping (image)
%--------------------------------Image Cropping------------------------------
%
%function [cropped_image] = cropping (image)
%
% Crops a binary image to the first non black pixels all around.
%
% Inputs:
% image: The image to be cropped
%
% Outputs:
% cr... |
%%========================================
%%========================================
%%
%% Keith Bush, PhD (2018)
%% Univ. of Arkansas for Medical Sciences
%% Brain Imaging Research Center (BIRC)
%%
%%========================================
%%========================================
%% Load in path data
load('proj.m... |
function plot_lines_ca(name)
# Function for plotting Calcium lines
wname = strcat(name, '_wav_ca.dat');
iname = strcat(name, '_int_ca.dat');
wname = load (wname);
iname = load (iname);
line = ['2-5'; '3-5'; '2-6'; '3-6'; '4-6'];
line = cellstr(line);
nr = length(wname(:,1));
sz = size(wname(1,:));
if ( nr < 5 )
... |
img = rgb2gray(imread('rueda.jpg'));
level=graythresh(img);
img=im2bw(img,level);
img = ~img;
original = img;
figure; imshow(original);
EE = strel('disk',5);
img = imdilate(img, EE);
EE = strel('disk',20);
img = imopen(img, EE);
img = original - img;
figure; imshow(img);
[l,n] = bwlabel(img);
|
clc
clear
close all
library_path = '../dataset/library/';
query_contexts_data_set = '../dataset/features_dataset/';
traj_cost_data_set = '../dataset/evaluated_by_library_dataset/';
original_traj_cost_data_set = '../dataset/original_cost_dataset/';
load(strcat(library_path,'lib_contexts.mat'), 'lib_contexts');
listi... |
% Loading
load ex2data2.data;
% Sizes
TOTAL = size(ex2data2(:,1))(1,1);
COLUMNS = size(ex2data2(1,:))(1,2);
breakpoint = 70;% floor(TOTAL/2);
% Adding the one for the constant term
X = ex2data2(:, 1:COLUMNS-1);
X1 = ex2data2(:, 1);
X2 = ex2data2(:, 2);
Y = ex2data2(:, COLUMNS);
%% mapFeature: function description
... |
load 'LinearEx_OutChangeLPAI/LinearExPAI_ChangeL_DataRead_A30B26.mat';
CXXY_A30B26 = CdataXXY;
CYYX_A30B26 = CdataYYX;
load 'LinearEx_OutChangeLPAI/LinearExPAI_ChangeL_DataRead_A26B26.mat';
CXXY_A26B26 = CdataXXY;
CYYX_A26B26 = CdataYYX;
%running means
Delta_A30B26 = zeros(length(Tfinals),1);
Delta_A26B26 = zeros(len... |
function y = int_phi3_P2(f,x1,x2,x3)
%calcule l'intégrale sur l'élément Ti de f*phi1
%moyennant la quadrature de Simpson
% Ti
% |--------|--------|
% x1 xm x2
%
xm=(x3+x1)*0.5;
%
y=(x3-x1)/6*(f(x1)*phi3_P2(x1,x1,x2,x3)+4*f(xm)*phi3_P2(xm,x1,x2,x3)+f(x3)*phi3_P2(x3,x1,x2,x... |
clear;
c_f0=1.71;
c_d0=600;
T=293;
niu=2;
A=2;
volume_ratio=.5;
R=8.3144621/10^5;
r=8.3144621;
o_p_d_0=niu*R*T*(c_d0-c_f0);
delta_h_p=0:.1:o_p_d_0;
c_final=(1-volume_ratio)*c_d0+volume_ratio*c_f0;
o_p_energy=niu*R*T*((1-volume_ratio)*c_d0-volume_ratio*c_f0+(2*volume_ratio-1)*sqrt(c_d0*c_f0));
o_p_power=.5*niu*R*T*(c_d0... |
clear; close all; clc
%NOTE CONCERNING VARIABLE NAME DEFINITION:
%(condition) is used to mean both 'Normal' and 'Afib', for example:
%'(condition)-heartrate' means both Normalheartrate and Afibheartrate
%Also: Variables are created and defined in the first section they are used
%in, but may also be used any subs... |
% plot t-test results after neurosynth_rsa_HRR_groundtruth_avg.m
close all;
clear all;
%load('mat/neurosynth_rsa_HRR_groundtruth_avg_us=0.mat');
%load('mat/neurosynth_rsa_HRR_groundtruth_avg_us=0_nperms=1000.mat');
%load('mat/neurosynth_rsa_HRR_groundtruth_avg_us=0_nperms=1000_dist=euclidean.mat');
%load('mat/neuros... |
function Icurve2
axis([-2 2 -2 2])
hold on;
grid on;
[x0, y0] = ginput(10);
plot(x0,y0,'g*');
[t,y]=ode45(@ff, [x0,2], y0);
[t1,y1]=ode45(@ff, [x0, -2], y0);
plot(t,y,'r',t1,y1,'r');
function z=ff(t,y)
z=t.^2+y.^2;
end
end
|
function [xs, Ls, grads] = eval_func_at_deltas(func, x, deltas)
% function [xs, Ls, grads] = eval_func_at_deltas(func, x, deltas)
%
% evaluates func at x and at x+deltas
%
% INPUTS:
% func function which takes x as an input
% it is assumed that the first argout is the functional value
% and th... |
function [ sameNum ] = poseOverlap( filesDir )
%POSEOVERLAP Summary of this function goes here
% Detailed explanation goes here
% get the overlap weighting between consecutive poses
fileExt = '*.txt';
files = dir(fullfile(filesDir,fileExt));
pathLength= length(files);
sameNum ... |
function new_image = adapt_median_filter_cvip(imageP,wmax)
% ADAPT_MEDIAN_FILTER_CVIP - a ranked-order based adaptive median filter.
% The primary strength of the adaptive median filter is the removal of salt
% and pepper noise but also attempts to smooth other types of noise and to
% avoid the distortion of small ... |
function convert_image2surf(inputImg,outputNifti,dataEcc,dataPol,datatAreas,centerPix,display)
% Converts an input image into a surface overlay
%
% Usage:
% convert_image2surf(inputImg,outputNifti,dataEcc,dataPol,centerPix,display)
%
% Inputs:
% inputImage = '/some/image/file.png';
% outputNifti = '/some/nif... |
function candidates=find_candidates_v3(Mask,range_d,dist_pings,l_min_can,h_min_can,min_nb_sples,output,load_bar_comp)
[nb_row,~]=size(Mask);
CC = bwconncomp(Mask==1);
% [boundaries,~,~,A] = bwboundaries(Mask);
% % enclosing_boundary = find(A(m,:));
% % enclosed_boundaries = find(A(:,m));
num_can=CC.NumObjects;
c... |
%% The test scirpt to run knn
k = 1;
resource_train = load('mnist_train.mat');
train_data = resource_train.train_inputs;
train_labels = resource_train.train_targets;
resource_valid = load('mnist_valid.mat');
valid_data = resource_valid.valid_inputs;
valid_labels = resource_valid.valid_targets;
resource_valid = loa... |
function [ Features ] = getFeatures( data,k )
% ARRAY = zeros(40*32,15);
% count = 1;
% elabel = zeros(40*32,1);
%for k=1:40
Mean = zeros(1,32);
Std = zeros(1,32);
Median = zeros(1,32);
Max = zeros(1,32);
Min = zeros(1,32);
Skew = zeros(1,32);
Kurtosis = zeros(1,32);
Power = zeros(1,32);
Normal = zeros(1,32);
Data = da... |
%% Ratio sensor
clear all
close all
clc
%
g1 = 0.6; %1/hr
g2 = 0.4; %1/hr
d1 = 0.2; %/OD
d2 = 0.2;
cost = 1.2;
r=1;
ti = 3;
od_0 = 0.001;
C1 = [2.^(-11:1:1)];
C2 = [2.^(-11:1:1)];
ts_vec = linspace(0,15,20);
%% Loop over concentrations seqential eating
%
clear ts_opt_sim
od_0 = 0... |
function phi_matrix = getPhi(x,t)
phi_matrix = zeros(size(t,2),1);
for i=1:size(t,2)
phi_matrix(i) = (x(1) + x(2)*t(i)^2)*exp(-x(3)*t(i));
end
end |
%% FPTC Synchronizer
% Description: Synchronize the timing and frequency offset.
% The received TD OFDM sequence y and xp act as inputs and two outputs include
% the estimated timing n_est and the estimated frequency offset v_est.
function [n_est, v_est] = FPTC_Synchronizer(y, xp)
% Parameters
N = 2048; % FD OFDM sym... |
% MIT License
%
% Copyright (c) 2017 JM Joseph
%
% 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, modify, merge, ... |
function [t,wvNLX,rc] = DetectThreshold(lp, t,v,thresh)
EXTENDED_SPIKE_AFTER=4; %8 samples after
EXTENDED_SPIKE_BEFORE=12; % 4 samples before
rc=0;
tv_size = [size(t) size(v)];
wvNLX=[];
if size(t,1) > 1
t = t';
end
if size(v,1) > 1
v = v';
end
% zero very high - non spike - events
%v(find(... |
%seori sachs
%ss5413
%3.12.14
function output = sigGen (signal, frequency, duration, numOT, sampleRate, fileName)
%go back into each file and have error for nyquist, for fundamental, not
%for overtones
%error checking for parameters here expect for signal type (just tell them)
switch signal
case ('sine')
... |
letters = imread('Letters.jpg');
template = imread('LettersTemplate.jpg');
letters = double(letters);
template = double(template);
original = letters;
[temph,tempw] = size(template);
letters = flip(letters,1);
letters = flip(letters,2);
convolvedIm = conv2(letters,template,'same');
figure
imagesc(convolvedIm);
co... |
%% According to the shown cards, sets the
% weights between the PFC and the SMA.
% Basically these dynamic weights are
% task dependent.
% HERE THERE IS A RACE MODEL IMPLEMENTED BEFORE
% SELECTION
% On the table there are (from left to right)
% One Red Triangle
% Two Green Stars
% Three Yellow Crosses
% Four Blue C... |
%% Modeling Lung Cancer Diagnosis Using Bayesian Network Inference
% This demo illustrates a simple Bayesian Network example for exact
% probabilistic inference using Pearl's message-passing algorithm.
%% Introduction
% Bayesian networks (or belief networks) are probabilistic graphical models
% representing a s... |
%Programa - dec_lu2.m
%Decomposição LU com pivoteamento
clear all;
format long e;
A = [ 3 -4 1;
1 2 2;
4 0 -3];
b = [9; 3; -2];
tamanho = size(A);
n = tamanho(1);
x = zeros(n,1);
y = zeros(n,1);
p = zeros(1,n);
c = zeros(n,1);
%Inicializa o vetor p
for i = 1:n
p(i) = i;
e... |
function Record = importRecord(filename, dataLines)
%IMPORTFILE 从文本文件中导入数据
% RECORD = IMPORTFILE(FILENAME)读取文本文件 FILENAME 中默认选定范围的数据。 以表形式返回数据。
%
% RECORD = IMPORTFILE(FILE, DATALINES)按指定行间隔读取文本文件 FILENAME
% 中的数据。对于不连续的行间隔,请将 DATALINES 指定为正整数标量或 N×2 正整数标量数组。
%
% 示例:
% Record = importfile("C:\Users\Ziaka\source\re... |
clear; close all; clc
m=200;
u=8000;
q=1;
g=32.17;
b=100;
count=1;
h(1)=0;
for t=0:3:300
if t<=b
v(count)=u*log(m/(m-q*t))-g*t;
else
v(count)=u*log(m/(m-q*b))-g*t;
end
h(count+1)=h(count)+v(count)*3;
if h(count+1)<0;
h(count+1)=0;
end
tt(count)=t... |
ff=0.001;
fb=0.00001;
global pulse3IVM
global g1 g2 H2 L51 L52 L53 L54 L61 L62 L63 L64 L21 L22 L23 L24 L31 L32 L33 L34 L41 L42 L43 L44 k7 k9 k11 k13 k17 k19 k15 k21 k23 L11 L12 L13 L14 k2 k4 k6 k1 k3 k5 k8 k10 k12 k14 k16 k18 k20 k22 k24 E1 E2 alpha1 alpha2 alpha3 beta1 beta2 beta3 H11 H12 H13 H14 ks1 ks2 ks3 ks4 kd1 ... |
function tmp
close all
clear all
clc
% function alpha3to2
load('petancova')
%% Get roi
roifiles = [data.roi];
nroi = numel(roifiles);
fname = 'mnibrainregion.xls';
pa_datadir;
xlswrite(fname,roifiles');
[~,uroi,nroi] = getroi(data);
fname = 'petbrainregion.xls';
xlswrite(fname,uroi);
function [r... |
for obj= [ 4 6 8 10]
Result=cell(2,1);
for p = 1 : 7
objective = obj
Problem = p
run = 30;
%-----------------------------------------------------------------------------------------
C = [ ];
for i = 1:30
eval(['load D:\GDcal\NSGA-II-ENS\NSGA-II-ENSD','_',num2str(p),'_',num2str(obj),'_',num2... |
classdef Connection < handle
properties(SetAccess = private)
host
user
initQuery % initializing function or query executed for each new session
use_tls
inTransaction = false
connId % connection handle
serverId % database connection id
... |
% get all the folder names from the folder 'foldering'
source = './train';
destination = './test';
%create a folder with name
if(~exist(destination, 'file'))
mkdir(destination);
end
folderList = getAllFolderNames(source);
% get the count of folders
totalFolders = size(folderList, 1);
%get random indices for tra... |
% Parameter Estimation and Inverse Problems, 3rd edition, 2018
% by R. Aster, B. Borchers, C. Thurber
%
% return l curve parematers for truncated gsvd tegularization
% Routine originally inspired by Per Hansen's l-curve
% program (http://www2.imm.dtu.dk/~pch/Regutools/)
%
%
% [rho,eta,reg_param] = l_curve_tgsvd(U,sm,d)... |
function [t, res] = calcV(tspan, inj)
% calcV Calculates the membranous voltage.
% Input:
% tspan - The time span (s).
% inj - The amount of current to inject for getI() (pA).
% Output:
% t - An array containing the time values for each timestep the
% ode used... |
function [ J ] = calc_I( CG )
%Calculate I, given a CG offset
%s/c is 1 meter cube, approximately 200 kg
m = 200;
Ixx = 17; %kg*m2
Iyy = 18;
Izz = 22;
%off diagonal terms are zero when center of mass is through geometric center
I = [Ixx,0,0; 0,Iyy,0; 0,0,Izz];
R = norm(CG);
R2 = R^2;
J = zeros(3,3);
for i=1:3
for j... |
% pEqn.m
printf('PISO correction number:%d\n',corr)
%if (corr<4)
rUA.internal = 1./Aop(UEqnM, V);
rUA.left.type='V';
rUA.left.value=rUA.internal(1);
rUA.right.type='V';
rUA.right.value=rUA.internal(end);
rUA=setBC(rUA,constField(0,N),xC,xF,g);
rUAf=fvc_interpolate(rUA,w,xC,xF);
U.internal = rUA.internal.*Hop(UEqnM, U... |
function [] = plot_pupil_size_across_states(data,analyses)
states_vector = analyses.behavior.states_vector(analyses.behavior.states_vector~=2);
pupil_norm = data.pupil/max(data.pupil);
pupil_norm(analyses.behavior.states_vector==2)=[];
[Pupil_StateMean, Pupil_Statesem] = grpstats(pupil_norm,states_vector,{'nanmean','s... |
% RunningProportion
%
% Graph of normal probability density function, with comb of intervals.
%
% Original in R: Kruschke, J. K. (2011). Doing Bayesian Data Analysis:
% A Tutorial with R and BUGS. Academic Press / Elsevier.
% Modified to Matlab code: Marc M. van Wanrooij
close all
clear all
meanval = 0... |
function write_data_txt(dataset, data)
% create list file for video data, which is used by limin caffe
% VideoDataLayer
shuffled_idx = 1:dataset.num_video;
fid1 = fopen(sprintf('imdb/cache/%s_video_list.txt', dataset.name),'w');
fid2 = fopen(sprintf('imdb/cache/%s_roi_list.txt', dataset.name),'w');
cls_id = containers... |
function [V, idx] = extractSegmentation(I,r)
if numel(r)==1
rx = r;
ry = r;
rz = r;
elseif numel(r) == 3
rx = r(1);
ry = r(2);
rz = r(3);
else
error('numel(r) needs to be 1 or 2!')
end
siz = size(I);
[x, y, z] = findnd(I>0);
x1 =... |
clear;
clc;
close all;
t_initial=0;
y_initial=1;
t_end=3.5;
lambda=10;
[t1,y1]=forward_euler(t_initial,y_initial,t_end,100,@fcn,lambda);
[t2,y2]=forward_euler(t_initial,y_initial,t_end,20,@fcn,lambda);
y1_exact=exp(-lambda*t1);
y2_exact=exp(-lambda*t2);
fig1=figure('units','inches','position',[0,0,6,6*0.7]... |
function x = so_fft2_adj(X, N, No, scale)
% Computes the inverse scaled FTT2
%
% in:
% X[:] - 2D fourier transform of the image
% N[2] - size of image
% No[2] - size of zero padded image
% scale[:] - scale factor precomputed by nufft_init
%
% out:
% x[:][:] - inverse FFT2
% scale factor to canc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.