text stringlengths 8 6.12M |
|---|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Demo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Demo script for converting the WIDER faces database
% to a Pascal VOC devkit-style folder structure.
% Uncomment the next line and set path to WIDER root folder
% widerRootDir = 'path/to/wider/root';
% As a san... |
function [l0,l_x,l_xx,l_u,l_uu,l_ux, l_xu] = fnCost_ddr(x, u, k,R,dt)
l0 = u' *R *u;
l_x = zeros(3,1);
l_xx = zeros(3,3);
l_u = R * u;
l_uu = R;
l_ux = zeros(1,3);
l_xu = zeros(3,1);
end |
%% Create some data
x = 1:50;
y = x.^2 + -sin(1./x) + exp(0.03*x); % y(x)
% remember your dots!
z = y.*x; % z(x, y)
%% create a blank figure
figure
% close all
% closes all open windows
%% Plot the data
plot(x, y) % y vs. x
figure
plot(x, z) % z vs. x
% what do you expect to see?
%% Using subplots
subplot(3,1,1) %... |
global MPI_COMM_WORLD;
load 'MatMPI/MPI_COMM_WORLD.mat';
MPI_COMM_WORLD.rank = 84;
Alluxio_Row_mv_version3;
|
function [cpmnew,B] = cond1(cpm,E,e,B)
%{
Condition a cpm (cpm) by given evidence (E,e)
Input:
cpm: a cpm
E: 1 x Ne array of evidence variable
e: 1 x Ne array of evidence state
B: Nx x 1 cell array of basic state indicator
Output:
cpmnew: a cpm after conditioning
B: Nx x 1 cell array of basic st... |
function y = Interpolacion_lineal(x0, x, y)
N =length(x);
for k=1:N-1
if x0 >= x(k) && x0 <= x(k+1) break;
end
end
y = y(k) + (y(k+1) - y(k))/(x(k+1)-x(k))*(x0-x(k));
end |
%model Param
h=0.5; %0.5m high
g=9.8; %m/s^2
rho =1; %fluid density
A = pi*(0.00635)^2;
v_pump = 5;
T_fluid = 20;
T_fluidmin = 25;
M_amount =10;
M_min = 3.75;
%Motor Parameters
R = 2.0; % Ohms
L = 0.5; % Henrys
Km = 1; % torque constant
Kb = 1; ... |
function diagonal_loading()
track = '6ch';
addpath ../../utils;
addpath ../other_enchan;
upath=['../../../../CHiME3/data/audio/16kHz/isolated_' track '_track/']; % path to segmented utterances
epath=['../../../../CHiME3/data/audio/16kHz/estimation_steering_' track '_track/']; % path to enhanced utterances
cpath='../..... |
function [ Qkm ]= schmidt( mu, N )
%SHMIDT Расчёт полиномов Шмидта
% Расчёт полиномов Qkm (Schmidt), Rkm, Tkm - действительных - для
% поляризационных расчетов
% mu - массив зенитного косинусов угла
% N - порядок приближения (как есть в теории - т.е. считая с 0)
% если mu - вектор, то
% Qkm(Nmu, N + 1, N +... |
function compile()
localpath = fileparts(which('compile'));
fprintf(1,'Compiling library [%s]...\n', localpath);
inputs = {'mex_build.cpp', 'mex_delete.cpp', 'mex_nn.cpp'};
for i=1:numel(inputs)
err = mex('-I/usr/local/include', ...
'-I../eigen/', ...,
'-L/usr/lib/x8... |
function xdot = mechsys(t,x); % returns the state derivatives
F = 25; % Step input
M =1; B = 5; K = 25;
xdot = [x(2) ; 1/M*( F - B*x(2) - K*x(1) ) ];
|
clear; clc; close all
x1 = [0,0]; x2 = [0,10]; x3 = [10,0]; x4 = [10,10];
X = [x1;x2;x3;x4]'; x = [2,3]'; L = size(X,2);
d = (sqrt(sum((x*ones(1,L)-X).^2,1))).';
m = 0; iterN = 1000;
for dB = -10:5:60
sigma2 = (d.^2)/(10.^(dB/10));
for i = 1:iterN
r2 = (d + randn(L,1).*sqrt(sigma2)).^2;
xuL... |
% Add random cross-links on top of a perfect hierarchy
% Non-backbone edges are added with probability P(i,j)=e^(-Dij/lambda)*e^(-xij/ksi),
% where Dij is the level of the lowest common ancestor and xij is the "organizational" distance
% Source: Dodds, Watts, Sabel, "Information exchange and the robustness of organ... |
function [x_train, y_train, x_test, y_test] = load_data(file_name)
%LOAD_DATA read in data
% load_data(file_name) read in data from a .mat file in the ./data
% directory
%
% Class support for input file_name:
% char;
% name form: 'XXXX.mat'
load([file_name,'.mat']);
x_train = xtrain;
y_train = y... |
function start_strike()
clear;clc;close all;
addpath ../dataset/data_strike/
addpath ../mit_network_analysis_tools/
% 选择参数实验 1--执行 0--不执行
S_shuffle = 1; % 跳数阈值实验
sigema_shuffle = 1; % 衰减因子实验
T_shuffle = 1; % 稀疏自编码器层数实验
beta... |
function set_rfield(ips,th,R,n) %R初始磁场,n转轴方向,th旋转角度
Rmtx = rotation(n,th);
R = R * Rmtx;
z=ips.read_field_z();
y=ips.read_field_y();
x=ips.read_field_x();
[az,el,r] = cart2sph(x,y,z);
fprintf(1,'target: %g %g %g\n',R(1),R(2),R(3)... |
function c=BING(a,b)
% The input,a and b, and the output, c, are column vectors
c1=a(1)*b(1)-a(2)*b(2);
c2=a(1)*b(2)+a(2)*b(1);
c=[c1;c2];
end |
function out = algo(class, algorithm, signal, vector1, const1, const2, varargin)
if strcmp(class, 's')
mu = const1;
iterations = const2;
Hs = vector1;
A = varargin{1};
if strcmp(algorithm, 'gd')
out = GD(signal, Hs, A, mu, iterations);
end
if strcmp(algorithm, 'gdp')
out = GDP(signal, Hs, A, mu, iterations);... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Wasserstein Inverse covariance Shrinkage Estimator
% Viet Anh NGUYEN, Daniel KUHN, Peyman MOHAJERIN ESFAHANI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Linear Discriminant Analysis Application
% Leave m Out Cross Validation... |
close all;clear; clc;
cd '/Users/zymantas/TVPVARPkg/test/testAcf/'
k=10;
y=[]
a=[]
b=[];
for i=1:k
x = randn(1000,1); % 1000 Gaussian deviates ~ N(0,1)
z = filter([1 -1 1],1,x)
y = [y z]; % Create an MA(2) process
a= [a autocorr(z,'NumLags',40)]; % Inspect the ACF with 95% confidence
b=[b myautocorr(z,... |
function y = base_cal( x )
%EVL_FUC Summary of this function goes here
% Detailed explanation goes here
pi = 3.1415926;
if (x < 0)
error('error! input should be bigger than 0!');
% elseif (x == 0)
% y = 1;
elseif (x < 10)
y = exp(-0.4527 * x^0.86 + 0.0218);
else
y = sqrt(pi/x) * (1 - 10/(7*x)) * exp(... |
function numPorts = getNumOutports(blockName)
% Determine the number of block outports
%
% numPorts = getNumOutports(blockName)
%
% Return the number of output ports that blockName has
ph = get_param(blockName, 'PortHandles');
numPorts = length(ph.Outport);
end
|
% 315CA Dinu Ion-Irinel
function r = fxy (f, x, y)
% =============================================== =======================
% Approximation of the derivative with respect to x and y of f at point (x, y).
% =============================================== =======================
% if x or y is ... |
%% kalman_filter.m
function [X,P] = kalmanFilter(u,y,N,W,x0,P0)
% u - 输入参数
% y - 传感器观测到的数据
% N - 系统噪声方差
% W - 传感器测量噪声方差
% x0 - 系统状态初始值
% P0 - 系统内部误差协方差初值
% 前提假设
% 输出传感器包含高斯噪声W
F = 1;C = 1;H = 0;
NN = length(u);
K = zeros(1,NN); X = zeros(1,NN) ;P = zeros(1,NN);
for i = 1:NN
% 预测
if(i==1)
X(i)... |
function neff = nodeSensingEffectiveness(feval,x,targets,udata)
nt=size(targets,2);
neff=zeros(1,nt);
for n=1:nt
neff(n)=feval(x,targets(:,n),udata);
end |
function PIVlab_capture_devicectrl_GUI
fh = findobj('tag', 'device_control_window');
%abgefragt in main GUI werden muss:
%ac_enable_seeding1 0 oder 1
if isempty(retr('ext_dev_01_pwm'))
put('ext_dev_01_pwm',1)
end
if isempty(retr('ext_dev_02_pwm'))
put('ext_dev_02_pwm',1)
end
if isempty(retr('ext_dev_03_... |
function Cstats = makeStatsSummary(out_path, pattern, freq, location_str, loc_logic)
% Analyze complex impulse responses from measurements
% Author: Rick Candell
% Organization: National Institute of Standards and Technology
% Email: rick.candell@nist.gov
if nargin < 5
loc_logic = true;
end
if nargin < 4
locat... |
%********************************************************************
%Damage Evolution function based on non-linear damage evolution model by
%Chaboche and Lemaitre
%Author: Shruti Motiwale
%Code Status - Works well as of 04/23/2016
%Please update the code status and specify modifications
%Includes threshold for recov... |
close all
clear
clc
t = -1:0.01:1;
A = 3;
w = 2*pi*2;
y = A*sin(w*t+pi/2);
gambar1 = figure;
plot(t,y)
axis([-1 1 -4.5 4.5])
xlabel('t')
ylabel('f(t)') |
function c = cellfuncell(fun, c)
% c = cellfuncell(fun, c)
%
% Replacement for Matlab's cellfun routine that
% does not require a function that returns an integer.
%
% (c) Cedric Vonesch, 20077.10.19
for n = 1:numel(c)
c{n} = feval(fun, c{n});
end |
%% ------------------------------------------------------------------------%
% EE 569 Homework #3
% Date: Nov. 1, 2015
% Name: Faiyadh Shahid
% ID: 4054-4699-70
% Email: fshahid@usc.edu
%------------------------------------------------------------------------%
function [R,G,B]= getRGBfromlocation(img1,img2,img3,img4,im... |
function results = getCluster( clustersIn, cursor_info )
%% DESCRIPTION
% 1. INTRODUCTION
% GETCLUSTER allows to obtain the different profile as well as figures of
% merits related to a single cluster.
%
% 2. PARAMETERS:
% .required. DOCLUSTERPLOT requires 2 parameters
% clustersIn
% is a st... |
function WriteOUTPUT(Ind_No, resFolder)
%To update all the necessary items after each structure is done
%1, OUTPUT.txt
%2, Individuals
%3, Origin
%Lastly updated by Qiang Zhu (2014/02/18)
global ORG_STRUC
global USPEX_STRUC
gen = USPEX_STRUC.POPULATION(Ind_No).gen;
symg = USPEX_STRUC.POPULATION(Ind_No).symg;... |
function [] = BME772ProjectMLCalc(TP,TN,FP,FN)
accuracy = ((TN+TP)/(TN+TP+FP+FN))*100;
disp(['The accuracy is ', num2str(accuracy),'%']);
sensitivity = ((TP)/(TP+FN))*100;
disp(['The sensitivity is ', num2str(sensitivity),'%']);
specificty = ((TN)/(TN+FP))*100;
disp(['The specificty is ', num2str(specificty),'%']);
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%README:
%%By: Dr. Jose L. Rueda
%%Date: 02.03.2012
%%Edited: Alex Neagu & Jinhan Bai
%%Date: 11/05/2020
%%This is the source code for the MVMO-SHM algorithm. It will return the
%%solution resulting in the best fitness of the function fhd. Th... |
% $Header: svn://.../trunk/AMIGO2R2016/Preprocessor/AMIGO_paths_OED.m 2487 2016-02-23 14:01:49Z evabalsa $
% AMIGO_paths_OED: Generates and adds necessary paths for OED
%
%******************************************************************************
% AMIGO2: dynamic modeling, optimization and control of biological sy... |
%% Calculate transverse modes in the leads
%% Solve Schrodinger equation in cross-sectional plane for lead #1
pot_l=zeros(nl_1,1);
for i=1:nl_1
pot_l(i)=pot(c_table(i,1));
end;
t0=hbar^2/2/me/dx^2;
H_l=zeros(nl_1,nl_1);
for i=1:nl_1
H_l(i,i)=4*t0+pot_l(i);
end;
for i=1:nly_1*nlz_1-1
H_l(i,i+1)=-t0;
H... |
function penaltymat = eval_penalty(basisobj, Lfdobj)
% EVAL_PENALTY evaluates a the inner products of a linear
% differential operator L defined by LFDOBJ applied to a set of
% basis functions defined by BASISOBJ.
%
% LFDOBJ is a functional data object defining the order m
% NONHOMOGENEOUS linear differential o... |
function uninstall(varargin)
% 'mfile'
% install('name','eigs')
assert(nargin>=2)
p = inputParser;
p.addParamValue('name', '', @ischar );
p.addParamValue('verbose',false, @islogical );
p.addParamValue('full',false, @islogical ); % suppress addon <name> directory
p.parse(varargin{:});
R=p.Results;
isOc... |
function [realpos realneg]=get_cluster_permutation_ancova(data,group,covar,contidx,montecarloalpha,clusteralpha,npermutation,sTime)
% Input
% - data: cell array (1 cell per condition: channels * times * subjects
% - montecarloalpha
% - clusteralpha
% - npermutation
% - sTime
% - averageelecFlag
%% Bootstrap
% fprint... |
function TDALABconfig
global TDALABPATH;
TDALABPATH=genpath(pwd);
addpath(TDALABPATH);
global TDALABHOME TEMPFILE;
p=which('tdalab');
cd(p(1:end-8));
TDALABHOME=pwd;
TEMPFILE=horzcat(TDALABHOME,filesep,'userdata',filesep,'tdalabtemp.mat');
global XSpread YSpread ScreenWidth ScreenHeight Spread;
oldUnits=get(0,'Unit... |
clear
clc
close all
% CODE USED TO GENERATE STIMULUS SEQUENCES
Hlen = [400 200 400];
Hid = [.01 .3 .01];
lid = [.8 1 .8];
Hlen = [200 500 100 200];
Hid = [.99 .01 .99 .01];
lid = [.8 .8 .8 .8];
N = sum(Hlen);
blockN = numel(Hlen);
Hvc = zeros(N,1);
lvc = Hvc;
k = 1;
for i = 1:blockN
kinds = k:k+Hlen(i)-1;
... |
function rgb = hex2rgb(hex)
%UNTITLED7 Summary of this function goes here
% Detailed explanation goes here
rgb = zeros(3, 1);
if length(hex) == 6
r = hex2dec(hex(1:2));
g = hex2dec(hex(3:4));
b = hex2dec(hex(5:6));
elseif length(hex) == 7
r = hex2dec(hex(2:3));
g =... |
%% Crouta-Doolittle
load('matrix.mat')
% Ax = LUx = b
n = size(A,1);
U = zeros(n, n);
L = eye(n);
U(1,:) = A(1,:);
L(:,1) = A(:,1) / U(1,1);
for k = 2 : n
for i = k : n
U(k, i) = A(k, i) - L(k, 1:k-1) * U(1:k-1, i );
if i >= k + 1
L(i, k) =(A(i,k) - L(i,1:k-1) * U(1:k-1,k) )/ U(k,k);
... |
function x = my_ISTFT(X,shift,win)
% Inverse STFT
% author: Xiaofei Li
nfft = (size(X,1)-1)*2;
% synthesis window
osFac = nfft/shift;
coe = zeros(shift,1);
for i = 1:osFac
coe = coe + win((i-1)*shift+1:i*shift).^2;
end
coe = repmat(coe,[osFac,1]);
swin = win./sqrt(coe/nfft); % synthesis window
% istf... |
function [res2DforDebug,snakeOrder,deltas1D,alphaDirs1D] = GetGCKTraverseParams(width)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
widthM1 = width-1;
k = log2(width);
if (floor(k)~=k)
error('width isn''t a power of 2!');
end
tree{1} = 1; tree{2} = [1 1]; tree{2*width-1} = 1;tr... |
% Derive_HS.m
%
% Derives the heel-strike equations for Ranger
%
% Author: Matthew P. Kelly
% Date: March 20, 2015
%
%%%% NAMING %%%%
%
% a = after collision
% b = before collision
%
% q = absolute angle = orientation of rigid body
% dq = ansolute angle rate
%
% 1 = 2d position vector for a joint
% d1 = 2d velocity ... |
function [E1, E2] = computeHistError(Data1, Data2)
NBins = 100;
minVal = min([Data1;Data2]);
maxVal = max([Data1;Data2]);
% define histogram beans
X = minVal : (maxVal-minVal) / (NBins-1) : maxVal;
% compute Histograms
[H1, X1] = hist(Data1, X);
[H2, X2] = hist(Data2, X);
% normalize histograms:
H1 ... |
function tree = hw2_train_DT_recursive(train_data, depth, z, usedFeatures)
if depth == 0;
[r,c] = size(train_data);
[M,F] = mode(train_data(:,c));
tree{z} = M;
return;
else
[rowSize, columnSize] = size(train_data);
if rowSize == 1;
... |
function [ neg ] = hardNegatives(negPaths, W, b, featType, maxnum, thresh)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
featExtractor = getFeatExtractor(featType, 1);
neg = [];
for i=1:length(negPaths)
if(mod(i,20)==1)
fprintf('Hard negatives: %d/%d (%d/%d) \n', length(n... |
clc
clear all
close all
%%%% 生成数据
D = 5;N0 = 1020;xsigma = 1;esigma=1;st=1;DL=10;
d0=[3,4,5,6,7];
for m = 1:D
d(m,:)=ones(1, N0-DL) * d0(m);
end
randn('state',st);
W = [3,4,5,9,12]; % 回归系数
X00 = randn(D, N0) * xsigma; % 采集的数据序列
eps = randn(1, N0) * esigma;
for i=1:N0-DL
for m = 1: D
X(m,i)=X00(m,DL+i-... |
function radiomicsParamS = getRadiomicsParamTemplate(paramFilename)
% radiomicsParamS = getRadiomicsParamTemplate(paramFilename);
%
% Template parameters for radiomics feature extraction
%
% --------------------------------------------------------------------------------------
% INPUT:
% paramFileName : Path to JSON fi... |
clc
clear
close all
A=imread('D:\EE5175-Image-Signal-Processing\EE5175_ISP_Lab1\Lab1\lena_translate.pgm');
B=zeros(size(A));
C=zeros(size(A));
tx=3.75;
ty=4.3;
figure(1),imshow(A,[0,255])
for i=1:256
disp(i);
for j=1:256
A=imread('D:\EE5175-Image-Signal-Processing\EE5175_ISP_Lab1\Lab1\lena_transl... |
% Read an image
I = imread('testimage.png');
% Convert the image to double data type
I = im2double(I);
% Show the image and select some points with the mouse (at least 4)
%figure, imshow(I); [y,x] = getpts;
y=[182 233 251 205 169];
x=[163 166 207 248 210];
% Make an array with the clicked coordin... |
function [ratios,sigmas] = AnalyzeTestSensis(Outbreak)
% Load data set 'LowerSensis35Data.mat' to run this analysis.
% Plot results with 'PlotEntryDays.m'
mu = mean(Outbreak,3);
n = size(Outbreak,3);
sd = sqrt((mu.*(1-mu))/n);
% Ratio data points:
ratios = log2(mu(:,2:4)./mu(:,1));
% Propagate error to log ratio:
e... |
close all; clear all; clc;
load('LinearSeparable.mat', 'X', 'Y'); % X:D*N Y:N*1
n = size(X, 2);
d = size(X, 1);
H = (Y * Y') .* (X' * X);
f = -ones(n, 1);
A = [];
b = [];
Aeq = Y';
beq = zeros(1, 1);
LB = zeros(n, 1);
UB = [];
x = quadprog(H, f, A, b, Aeq, beq, LB, UB);
w = zeros(2, 1);
for i = 1:n
w = x(i) * ... |
function make_PFC_candeventtriggeredmat(thisdir,label)
disp('Start make_PFC_candeventtriggeredmat')
load(thisdir,[label '_CandEventTimes'],'other_cells','spikedata')
eval(['Event = ' label '_CandEventTimes(:,1);'])
clear([label '_replay_stnd'])
p = other_cells; clear other_cells
PFCspk = spikedata(ismember(... |
%load data1.mat;
featurefun = @(X)quadfeatures(X);
kernelfun1 = @(X1,X2)quadkernel(X1,X2);
kernelfun2 = @(X1,X2)gausskernel(X1,X2,50);
ww1 = fitlin(y,X);
ww2 = fitlinreg(y,X,25);
ww3 = fitgenreg(y,X,1e5,featurefun);
aa1 = fitdualgenreg(y,X,1e5,kernelfun1);
aa2 = fitdualgenreg(y,X,5e-3,kernelfun2);
yhat_train1 = X*... |
function CondAdLIF_STDP_ExperimentRate_Adaptation(index)
repopath = '/scratch/jmg1030/FIcurve/SOSpikingModel';
addpath(genpath(repopath))
load('/scratch/jmg1030/FIcurve/data/trainedWeights/ExperimentRate/ExperimentRate_s_10.mat');
PopParams_in = PopParams;
PopParams_in.tau_w = 100;
PopParams_in.LearningRate = 0;
Pop... |
% exm4_residue.m
% 例4:residue使用示例
% 北京邮电大学,尹霄丽
% 2018年12月
n=[4 4 4];
d=[1 3 2 0 0];
[r,p,k]=residue(n,d)
|
function fn_controlpositions(hu,ha,posa,pospix)
% function fn_controlpositions(hu,ha,posa,pospix)
%---
% set the position of controls relatively to an axes, and set the figure
% resize function to update these positions automatically
%
% Input
% - hu control handle
% - ha axes handle
% - posa position rela... |
function cs_setup(option)
%
% GUI interface to setup control strategy optimization
%
global vinf
if nargin<1
option='load';
end
switch option
case 'load'
button=questdlg('This functionality has been greatly enhanced by using the adv_no_gui scripts combined with optimization tools. Please refer to doc... |
test = absorbfrac.* Cmax
plot(time,test) |
classdef box
%BOX This defines a box within the room
% Detailed explanation goes here
%% Class Properties
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
properties (SetAccess = private)
x % X position (m)
y % Y position (m)
... |
% Tank Camera Tracking main program
% Interfaces with SwisTrack over TCP/IP localhost
% Reads in string of particle locations, angles and velocities
% Plots locations in realtime
% logs data in txt file named by date and time
% BR, 11/10/2010
%
% Currently configured for Microsoft LifeCam Studio running with
% ... |
%examTestScript.m
close all; clear sound;
clear; clc;
%%
% Test signal used for each problem
[x,Fs] = audioread('AcGtr.wav');
%% auralExciter.m Test
gain = .4; % Experiment with different values
% Use function
[ out ] = auralExciter( x, Fs, gain );
% Playback sound of processed output signal
sound(out,Fs); |
%% Setup problem
clear;
%% Generate target trajectory
freq = 5;
dt = 1/freq;
t = 0:dt:6; numTargets = length(t);
vx = 0.25 * ones(size(t));
vy = (0.075 * 2 * pi/0.75) * cos(2*pi*t/0.75);
% Target positions
x = vx.*t - 0.75;
y = 0.075 * sin(2*pi*t/0.75);
% Desired vantage points for targets
ux = zeros(... |
clc;
clear all;
io=imread('Cameraman.tif');
%io=rgb2gray(io);
Noise_Image=imnoise(io,'salt & pepper',0.1);
%imwrite(Noise_Image,'78019_09.bmp');
% Noise_Image=imread('peppers2_09.bmp');
Denoised_Image_ANN_bF=ANN_bF(Noise_Image);
psnr_ANN_bF=psnr(Denoised_Image_ANN_bF,io);
ssim_ANN_bF=ssim(Denoised_Image_ANN_bF,io);
I... |
function lf_mag = likelihood(rho, eta, gamma, alpha, timeSteps, Wset, Aset)
format long
[rho eta gamma alpha]
S = 1;
tol = 1e-13;
err = 2*tol;
runs = 1;
warning('')
while err > tol && runs < 300
if ~exist('ic','var')
ic = [];
fprintf('Using default initial condition\n')
try
r... |
function assert_hard_constraint(varargin)
type = varargin{1};
value = varargin{2};
if nargin > 2
value2 = varargin{3};
end
r = global_jess_engine();
if (strcmp(type,'fix-instruments'))
r.eval(['(assert (HARD-CONSTRAINTS::FIX-INSTRUMENTS (instruments ' value ' )))']);
elseif (strcmp(type,'or-instruments'))
... |
classdef TVRData < TExpData
%
properties
Subset
SubsetVal
SpeedThresh
SmthTimeWindow
maps1d
maps2d
Bayes
end
methods
function obj = TVRData()
obj@TExpData();
obj.SpeedThresh = 5;
obj.Smt... |
function [ mistune ] = CreateMistune( misCoef, params )
%% check the input parameters
narginchk(1,2);
if nargin == 1
defualtParams;
end
%% create and normalize the mistune matrix
mistune = rand(1,params.secNum);
mistune = mistune - mean(mistune); % make the mean value 0;
mistune ... |
function [normalizedMinDist, dtwPath, dtwTable, note]=sequenceSegmentViaDp(vec1, opt, showPlot)
%SequenceSegmentViaDp: Sequence segmentation via DP
%
% Usage:
% [minDist, dtwPath, dtwTable, note]=sequenceSegmentViaDp(vec, opt, showPlot)
%
% Example:
% waveFile='twinkle_twinkle_little_star.wav';
% wObj=waveFile2obj(w... |
Ztruncated = Z_C1( :, :);
indNoLas = find( Ztruncated(:,10) == 0 & Ztruncated(:,9) == 0);
Z = Ztruncated(indNoLas,:);
corr_given_2 = []; wrong_given_2 = [];
for i = 3:size(Z,1)
curr = Z(i,1);
curr_1 = Z(i-1,1);
curr_2 = Z(i-2,1);
if curr_1 == 1 && curr_2 == 1 ... |
function [KdTree,Size,WPmap] = BuildkdTreeFromFolder( WaveletFolder , TargetkdTreeFolder, FeatureType, ResampleSize)
%BUILDKDTREEFROMFOLDER Summary of this function goes here
% Detailed explanation goes here
% Feature types:
% 1 - Angular
% 2 - Shape COntext
if(~exist(TargetkdTreeFolder,'dir'))
mkd... |
function res = combine_results(working_path, n_samples, m_null, m_causal)
res = struct();
res.models = create_models();
res.data_generators = create_data_generators();
res.runs = cell(length(res.data_generators), 1);
for i = 1:length(res.data_generators)
res.runs{i} = cell(n_samples, 1);
for j = 1:n_samples
... |
function matClearGlobalMemory( obj )
%> @brief Function to clear the global memory allocated at the begining of the simulation
%> @details
%> Function to clear the global memory allocated at the begining of the simulation
obj.advectionSolver.matClearGlobalMemory();
obj.HorizontalEddyViscositySolver.matClearGlobalMemor... |
function dydt = CompleteHybridSystem(~,y,R_t_state,P_env, gamma_B, kappa_P, delta_P, kappa_B,alpha_I, gamma_R,delta_B, R_on, m_on, beta_on)
%R_t_state is the state of the switch, either 0 or 1
P=y(1);
B=y(2);
dydt=[ (P_env*kappa_P/(1+gamma_B*B))-P*(alpha_I*R_t_state*R_on+delta_P); % Pathogen load ODE
(kappa_... |
%%%%%%%%%%%%%%%%%%%%%%%%%%
% read noraxon data file
% Marie Moltubakk 18.5.2013
% Read noraxon data file, set first frame as time = zero, EMG+torque data treatment, resample
% Produce a new noraxon data array
% 2017 - used only by old normconversion
%%%%%%%%%%%%%%%%%%%%%%%%%%
function noraxon_prepped = read_... |
function energy = average_energy(A)
[W,H] = size(A);
sumation = 0;
for w=1:1:W
for h=1:1:H
sumation = sumation + double(A(w,h));
end
end
%energy = cast(sumation/(W*H),'uint8');
energy = sumation/(W*H);
end
|
clear;
% tpalist{1}= main('C:\Users\Hadas\Dropbox\biomedData\HR5_1\02_12_17\02_12_17_S', ...
% 'C:\Users\Hadas\Dropbox\Results9_9_17\HR5_1Analysis\02_12_17\Analysis\svmAccuracy');
% tpalist{2}= main('C:\Users\Hadas\Dropbox\biomedData\HR5_1\02_15_16\02_15_16_S', ...
% 'C:\Users\Hadas\Dropbox\Results9_9_17\HR5_1... |
function [chars] = determine_char(cond)
chars.fasting_pl_pu = cond.x(end,69);
chars.fasting_pl_pc = cond.x(end,70);
chars.fasting_pl_su = cond.x(end,71);
chars.fasting_pl_sc = cond.x(end,72);
chars.fasting_pl_p = chars.fasting_pl_pu +chars.fasting_pl_pc;
chars.fasting_pl_s = chars.fasting_pl_su... |
t = [0:0.05:2*pi];
x = cos(t);
y = sin(t);
m = -4/9;
b1 = 0.5;
b2 = 0.9;
xl=[-1:0.1:1];
yl1 = m * xl + b1;
yl2 = m * xl + b2;
hold on;
plot(xl,yl1);
plot(xl,yl2);
plot(x,y);
axis([-1,1,-1,1]);
%%
gradv = [1,1,2,-2];
vxr = 0.5;
vyr = -1;
uxj = -1;
uyj = 1;
umax = 3;
t = [0:0.05:2*pi];
x = umax*cos(t);
y = umax*sin(t);... |
function [theta, J_history] = gradientDescentMulti(X, y, theta, alpha, num_iters) %GRADIENTDESCENTMULTI Performs gradient descent to learn theta
%theta = GRADIENTDESCENTMULTI(x, y, theta, alpha, num_iters) updates theta by taking num_iters gradient steps with learning rate alpha
% Initialize some useful values
m = le... |
function final = TrainingConditionMatrix(nBlocks)
AllData = (1 : 4)';
final = [];
for j = 1 : nBlocks
final = [final;[repmat(j,size(AllData,1),1)...
, AllData(randperm(size(AllData,1)),:)]];
end
final(:, 3) = final(:, 2) * 400 ;
end |
function [error] = coTrain(odata,olabel,round,num)
i=1;
error=0;
while i~=round
%select 8 labeled data from each class
data=odata;
label=olabel;
class1=find(label==1);
[nrow,nlen]=size(class1);
tmp=randperm(nrow,8);
ls1=data(class1(tmp),:);%labeled data
data(class1(tmp),:)=[... |
function [nFF,NFF,labelconditions,label1,label2]=rat_foldernames(Rat,rat26session3,rat27session3,rat24base)
%Rat 26
if Rat==26
nFF=[
% {'rat26_Base_II_2016-03-24' }
% {'rat26_Base_II_2016-03-24_09-47-13' }
% {'rat26_Base_II_2016-03-24_12-55-58' ... |
function info = quickerDicomParse(files)
N = length(files);
curDir = cd;
cd([matlabroot strrep('_toolbox_images_iptformats_private','_',filesep)]); % path to a faster, more basic dicom parser -> new matlab
[g1, e1] = dicomlookup('SeriesInstanceUID');
[g2, e2] = dicomlookup('SeriesDescription'... |
function mashUp(song1, song2, instructions)
% Given the filenames of text files that contain two different songs and a third
% file of instructions, you will combine different lines together in a new
% text file.
% The instructions will always follow this format:
% <song # (1 or 2)>-<line #>
% The n... |
% 2019-12-08
% signal-to-noise (snr) calculation
% 2020-01-02
% took into account pll block
function [snr_estimated] = calc_snr(z, ind_a, ind_b, freq_burst_size)
index_noise = ind_a - 7 - freq_burst_size;
if (index_noise > 1) && (ind_b > 1) && (ind_a < length(z)) && (ind_b <= length(z)) %snr estimation
s = std(... |
function K = gaussKernel(X, sigma)
% ---- REFERENCE: Code for how to vectorise this gamma kernel function for computational
%efficiency (instead of looping through each data pair)
% was referenced from http://www0.cs.ucl.ac.uk/staff/M.Herbster/boston/rbf.m
temp=X*X'/sigma^2; %Computing matrix norm. Utilising symmetr... |
function Cov_Mat = Covariance_SH2017(wave_number,dt,modes,tau1,tau2,b1,b2,tildeQ1,tildeQ2,taur,taul,tauv,D)
%
% Function for computing the covariance matrix of the Stechmann & Hottovy
% 2017 (GRL) linear stochastic model.
%
%
% Inputs:
% wave_number: Wavenumber (integer)
% ... |
function [r2,r3,r4,r5,r6] = UpdateMatrices_pipeline2( R0_data_2,R0_data_3,R0_data_4,...
R1_data_0,R1_data_1,R1_data_2,...
R1_data_3,R1_data_4,x1,y1,fx,fy)
%--------------------------------------------
width = 200;
height = 200;
%--------------------------------------------
if x1 < width-1... |
% Inputs:
% RF_data is the received RF data.
% theta_d is the steering angle of the plane wave in degree, can be
% a positive or a negative value.
% z_start is the imaging depth starting point (in meters).
% z_stop is the imaging depth ending point (in meters).
% image_width ... |
function [Lout, Rout] = Invert_Reverse_HRTF (Lin, Rin,pflag)
%function [Lout, Rout] = Invert_Reverse_HRTF (Lin, Rin, pflag)
% reverses and inverts L and R magnitude spectra
% with only minimal effects on phase spectra
% based on Roian's test
if nargin < 3 | isempty('pflag')
pflag = 0;
end
if nargin < ... |
function psth = psth_func_noise2(Y,good_cluster_id,start_time_ms,first_bin_ms,last_bin_ms,t_bin_ms,noisepos,grid_root)
%psth_final = psth_func(Y,start_time_ms,grid_root)
%Add a normal description
%% Initial parameters
cond_ix = find(noisepos~=0);
num_cond = numel(cond_ix);
noisepos_ms = noisepos*1000;
edges_ms = (fi... |
function [ acc ] = calcAccuracy( cM )
% CALCACCURACY Takes a confusion matrix amd calculates the accuracy
% **************** Our code ************************
acc = trace(cM) / sum(cM, 'all');
end
|
% function CheckWMPhaseOrder
dir_strut = dir('*_RYG.mat');
num_files = length(dir_strut);
files = cell(1,num_files);
for id_out = 1:num_files
files{id_out} = dir_strut(id_out).name;
end
hw = 31;
[Lattice,~] = lattice_nD(2, hw);
NumP = 3;
bin = 40;
Coor = [-10.5*sqrt(3) 10.5*sqrt(3) 0;-10.5 -10.5 21];
LoalNeu = cell... |
function [ xp ] = Sol_Particular( A,b )
%Solución particular de
% A *x = b
% donde A es mxn, m<n y rango(A) = m.
% El método es usando la pseudo inversa de A.
M = A*A';
L = chol(M)'; % factor de Cholesky triangular inferior con diagonal positiva
z = L\b;
w = L'\z;
xp = A'*w;
end
|
classdef rlDataInstance_imu < rlDataInstance % < rlModel
% hold, load, and clean input data to be passed between
% modelinstance/featureset
properties
end
methods
function obj = rlDataInstance_imu(modelInstance)
obj = obj@rlDataInstance(modelInstance);
end
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.