text stringlengths 8 6.12M |
|---|
% #### Average Over ALL Analysis ###
% this module should be run after SMARTeCDFs.m to have all the data related
% to any individual preloaded to Matlab, it also uses CDFcomparitor.m
% function to calculate emperical CDF of any three combination of commands
% with the same basis. It will generate plot to make comparisi... |
clear all; close all;
% Simulate an experiment in which a monkey decides at which of two
% locations an orientation change occurred
% set size (N) and magnitude of change (Delta) were variable
%This code creates
tic
Nvec = 2:5;
deltavec = 10:10:90; % change magnitude in degrees
Ntrials = 10000; % number of tr... |
%生成频率选择性瑞利衰落信道
%***********************************************************
% This mfunction generates frequency selective
% Rayleigh fading
%
% FUNCTION SYNOPSIS:
% y = fade_fs(x,L)
%
% Parameter Description:
% y : output signal
% x : input sig... |
function magnitude = theta_min_func(thetaD,thetaA)
magnitude = min(abs(thetaD-thetaA),360-(abs(thetaD-thetaA)));
end
|
x_i = 1;
y_i = 2;
z_i = 3;
delta_t = 0.00001;
x_rec = 5;
y_rec = 6;
z_rec = 7;
p_i = [x_i, y_i, z_i];
xhat = [x_rec, 0, y_rec, 0, z_rec, delta_t, 0];
h = h_func(p_i, xhat, ref_data_struct);
|
function [iouAccuracy, overall] = IouCoeff(groundTruthImage, classificationResult)
% Read result image and ground truth image
noOfClasses = 12;
% These files are taken from the workspace.
[h, w, d] = size(groundTruthImage);
[h_r, w_r, d_r] = size(classificationResult);
channels = d;
... |
b,a]=butter(2,f/Fs,'low');
[d,c]=butter(2,f/Fs,'high');
a=filter(b,a,signal);
v=cumtrapz(t,a);
v=filter(d,c,v);
s=cumtrapz(t,v);
where:
f- signal frequency.
Fs- sampling frequency
signal - acceleration signal (input)
a - acceleration vector without noise (after filtering)
v,s,t - velocity, displacement and time vector... |
%% ENGR 652 - Homework 1 - Problem 1 - Vy Bui
clear, clc
I = imread('vyself.jpg');
figure, imshow(I);
C = imcrop(I,[360 160 320 320]);
figure, imshow(C);
R = imresize(C, [128 128]);
figure, imshow(R);
picture = rgb2gray(R);
save bui picture
figure, imshow(picture); |
%% Audio Source Speration using Convolutional Neural Network %%
%References:
% 1. Probabilistic Binary-Mask Cocktail-Party Source Separation in a
% Convolutional Deep Neural Network (http://arxiv.org/abs/1503.06962)
% Copyright (c) 2016, Engr Sharjeel Abid Butt, PhD Scholar, Department of Electronic Engineering,... |
function h = spl(i, num)
% Easy subplots. (e.g. easily used within loops.) Examples:
% spl 16, for i=1:16, spl, imagesc(magic(i)), end % 4x4 array
% spl([2 8]), for i=1:16, spl, imagesc(magic(i)), end % 2x8 array
% spl(16), for i=1:16, spl, imagesc(magic(i)), end % 4x4 array
% for i=1:16, spl(i,16), imagesc... |
clear;
clc;
DataPoints = [100 100;90 90;10 10;10 20;90 70;50 50] ;
disp(DataPoints);
DistanceCalc = pdist(DataPoints);
disp(DistanceCalc);
DistanceMatrix = squareform(DistanceCalc);
disp(DistanceMatrix);
%%%%%%%%%%% Defining a grouping in hierarchical clustering
GroupsMatrix = linkage(DistanceCalc);
disp(GroupsMat... |
classdef GTM_Pi < GTM
%GTM_Pi Summary of this class goes here
% Detailed explanation goes here
properties
pca = PCA_Cent();
n_ch_features = 1;
end
methods
function obj = GTM_Pi(img,rf,smoother)
obj@GTM(img,rf,smoother);
end
end
end
|
function WextdB = gene_Transfer_function_to_eardrum(FreqVector, field_type)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Free field to eardrum transfert function (frontal incidence).
% Source: ANSI S3.4-2007 Table 1
% Values at intermediate frequencies are interpolated
%
% USE:
... |
classdef Material < handle
% MATERIAL
%
% Description:
% Consistent interface for setting render properties
%
% Constructor:
% obj = Material(gObj, varargin)
%
% Properties
% gObj Handle to graphics object
%
% Methods
% unmatched = obj.set(varargin);
% Set... |
function [ sig_long, sig_short, sig_rs ] = Macd( bar, short, long, compare, type)
% 该函数输出多只股票的MACD值,以及基于MACD的交易信号和强弱信号
% macd的信号判定规则为当macd的三个输出都是正数时,sig_rs = 1;都是负数时,sig_rs = -1;
% 输入 price 为每日收盘价的时间序列;
% 输入 short 为短期移动平均的天数,默认为 12;
% 输入 long 为长期移动平均的天数,默认为 26;
% 输入compare为差值的移动平均天数,默认为 9;
% 输出 sig_long 为做多的交易信号;
% 输... |
function dydt = LDDE(t, y, yd)
% yd: y(t-yau)
a = -0.2;
b = -0.63;
dydt = a*y + b*yd;
|
function [bcoff yhat stats] = doregress(Y,X,withinter)
% Now do the regression
if withinter == 1
fprintf('Linear regression with interaction terms:\n');
stats = regstats(Y,X,'interaction');
else
fprintf('Linear regression without interaction terms:\n');
stats = regstats(Y... |
function [model,x,y,z] = fitGaussian(x,y,z,k,symmetric,threshold)
% Fit a 2D Gaussian
% Note this code needs much improving. Currently cannot fit symmetric
% thresholded Gaussian
posTol = 800; % Tolerance for spatial value
sigmaTol = 1000; % Tolerance for size of sigma value
sigma0 = 300; %... |
% Anova_Patient.m
%
% Perform unbalanced ANOVA on patient data, comparing three regions (Initial
% ROI, Growth, and Contralateral)
%
% MT Cherukara
% 9 August 2019
clear;
close all;
setFigureDefaults;
%% OPTIONS
% Choose FABBER dataset
setnum = 281;
% tstr = 'Patient 2 Uncorrected';
tstr = 'Patient 6 \kappa,\eta-Co... |
function y = fixed_point( func, initial_value, max_iteration, max_error)
% Finds the root of a function using the fixed point approach.
% Inputs are the func- tion(anonymous),initial guess, maximum number
% of iterations, and maximum absolute rela- tive error. The outputs should
% be the root and a table of ite... |
classdef a_test_class
%UNTITLED2 Summary of this class goes here
% Detailed explanation goes here
properties
gghg
end
methods(Static)
function add_1(x)
disp(x+1)
end
function add_cat(x)
disp(x+gghg)
end
end
... |
function [results]=load_data_v1()
% addpath(genpath('~/Code/VBA-toolbox'))
% addpath(genpath('~/Code/army-knife'))
% load raw data
load('../data/replication_v1/rv_fv1.mat')
load('../data/replication_v1/forceprop.mat')
for s=1:18 % lop over subjects
% initialize matrices
ratings_s = zeros(120,3);
... |
clear;clc;close all;
fid=fopen('matrix_col_1.txt');
data=textscan(fid,'%d %f');
fclose(fid);
x=data{1};
matrixcol1_y=data{2};
fid=fopen('matrix_col_max.txt');
data=textscan(fid,'%d %f')
fclose(fid);
matrixcolmax_y=data{2};
fid=fopen('matrix_row_1.txt');
data=textscan(fid,'%d %f')
fclose(fid);
matrixrow1_y=data{2};
... |
function thermIm = offsetThermalImage(imIn, refPol, refTemp);
% Function to offset FLIR A65 image with known calibration temperature
%
%Inputs:
%imIn: thermal Image (converted to deg C)
%refPol: reference polygon with location of temperature probe
%refTemp: measured reference temperature for th... |
function [ ag ] = get_aggregateresultsbyshow( agg_results, show, f_score )
%get_aggregateresultsbyshow rerun the get_aggregateresults with a filter on
%the show class,
ag = get_aggregateresults( ...
agg_results.description, ...
agg_results.results, ...
agg_results.config, ...
... |
function [ p,e,t ] = refinaMalla(g,p,e,t,estrategia,theta)
% Refina la malla [p,e,t] de la geometría g.
% Los valores de los estimadores deben estar en el archivo 'estimadores.txt'
% estrategia = 1: refina los elementos con estimador > theta*max(estimadores)
% estrategia = 2: ordena estimadores de mayor a menor, su... |
%%
%1
imgR = [255,0;0 0];
imgG = [0,255;0 0];
imgB = [0,0;255 255];
img = zeros(2,2,3);
img(:,:,1) = imgR;
img(:,:,2) = imgG;
img(:,:,3) = imgB;
img
%%
%2(a)
snr = zeros(1,8);
for i=1:8
img = bucky_images(:,:,i);
noise = zeros(50,100);
signalfreearea = bucky_images(300:350,1:100,i);
stdsignalfree = std... |
function varargout = calculator(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @calculator_OpeningFcn, ...
'gui_OutputFcn', @calculator_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin... |
clc
clear all
close all;
M= xlsread('SelResults.csv'); M(isnan(M)) = 0;
cost= M(1,2);
years= [2015:2050]; % timescale
prod= M(223:246,3:38); %total production...
elec_g=prod([1,3,2,4,5,6,7,15,8],:); %total electricity production and imports
per=elec_g./sum(elec_g)*100; %percentage of each technology
%cum=cumsu... |
% calculate rate of CH2CH(CH2)2CH3 (1-pentene) + OH -> products
% Updated 7/18/06 AEP
% Based on R. Atkinson J.P. Chem Ref Data 1992
% rate=kOH1pentene(T,M)
function j=kOH1pentene(T,M)
j=5.86e-12.*exp(500../T); |
%% This is the formula to predict prices based on correlations.
% Similar to y = mx + b, except it makes room for error.
function [y] = corrScat(X, b0, b1, e)
y = b0 + b1*X + e;
end
% assetA = [2,5,4,7,5,3,2];
% assetB = [1,3,5,6,6,7,2];
% scatter(assetA, assetB);
% hold on
% % Add least squares line. The linear reg... |
clear all
i = 1;
dataSets{i} = 'uci.yugoBreast.mat';i=i+1;
dataSets{i} = 'uciBreast.mat';i=i+1;
dataSets{i} = 'glennHousing.mat';i=i+1;
dataSets{i} = 'statlog.heart.data';i=i+1;
dataSets{i} = 'uci.pima.data';i=i+1;
dataSets{i} = 'statlog.australianCredit.data';i=i+1;
dataSets{i} = 'uci.mushroom.mat';i=i+1;
da... |
%% Convert pos with cubic (0.01, cubic length)
function draw_dist_pts(ave_final_dist_struct1, x_pos_dist, y_pos_dist, z_pos_dist,...
x_min,x_max,y_min,y_max,z_min,z_max,l1,l2, max_mi)
%% Drawing
% drawing (Wrist)
init_pos_el = cal_pos_el(0,0,0, l1);
init_el_T = [eye(3,3) init_pos_el;0... |
function varargout = k2real(y,N,y00,varargin)
%convert from k space to real space
%y comes in as a column vector, each column represent different snapshots Nt
%N is an array for the system size
%y00 is the k=0 component if missing in y, and must have the size of (1-Nt)
%mode: plot (default): show static snaps... |
function [FileNameBase,PathNameBase,filenamelist]=filelist_generator
% Code to construct a list of 9999 or less filenames
% Programmed by Rob, changed by Chris. Automatic filelist generation
% and image time aquisition added by Chris.
% Last revision: 12/25/06
filenamelistmode = menu(sprintf('How do you want to crea... |
function [condprob] = CondProbj(alpha,data,mu,sigma,c,j)
prob = 0;
for i=1:c
prob = prob + alpha(1,i)* Gauss( data , mu(i,:) , sigma(:,:,i));
end
condprob = alpha(1,j) * Gauss( data , mu(j,:) , sigma(:,:,j))/prob ;
end
|
if ~exist('optgpu', 'var'),
optgpu = 0;
end
% pcd (ML)
demo_mnist('mnist_orig',optgpu,'pcd',1000,0.01,0.005,0.3,0.05,0.0001,300,100,0.01,1,1,1,1,10,500);
% CD-percloss
demo_mnist('mnist_orig',optgpu,'cdpl',1000,0.01,0.005,0.1,0.1,0.0001,300,100,0.01,1,1,1,0,10);
% mrnn
demo_mnist('mnist_orig',optgpu,'mrnn',1000,... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 7.17: Extracción de bordes, regiones y puntos de interés
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 7.7.10 Regiones: umbrales
%%%%%%%%%%%%%%... |
function [f] = Cell_dxdT(t,x,param,x_AtC,iflag,Varstruc)
% Set variables
boxVmax=Varstruc.boxVmax; % Vmax parameters of beta oxidation
boxVmax(10)=Varstruc.Trimetazidine; % Inhibitor of mckat
Kmcpt1C16AcylCarCYT = Varstruc.Kmcpt1CarCYT; %136.0/SF; Km of CPT1
% This iteration of dxdt includes changes made to \beta-oxi... |
function KW = Comp_Kaiser(Length, Beta)
%function KW = Comp_Kaiser(Length, Beta)
%
% This function is used to compute a Kaiser window of length = Length, beta = Beta
%
%
% Inputs:
% Length = length of window to compute
% beta = window beta
%
% Output:
% KW = a column matrix of Length elements that conta... |
clear('ivec', 'jvec', 'Mvec', 'Svec')
%% FEM with b-splines order 2
% use splines of degree 2 for C1 regularity
% basis
ref_spl = bspline([0 1 2]);
phi0 = ref_spl.coefs(2,:);
phi1 = ref_spl.coefs(1,:);
Dphi0 = polyder(phi0);
Dphi1 = polyder(phi1);
%% Calculations on the reference element
% mass matrix
ptemp = po... |
function [ mmse ] = objfun( args )
%UNTITLED10 Summary of this function goes here
% Detailed explanation goes here
global timestamp wheelDispL wheelDispR xm ym trot;
[x_int, y_int, t_int] = integrate_wheeldisps(timestamp,...
wheelDispL, wheelDispR, args(1), args(2), args(3));
inds = [26, 256, 620, 920, 1230, 1... |
function [output2] = hist_equal(input_channel)
%you should complete this sub-function
% 直方图均衡化算法(input_chaneel是单通道的)
% 这里采用wiki上Histogram_equalization的算法
%0.观察到color.jpg 读入的值是uint8的矩阵,为了保证处理的精度,先将输入通道的精度提高到double
[input_channel] = im2double(input_channel);
%1.对图像基础数据计算
[Height,Width] = size(input_channel); %图像的长... |
function [IM_multivariate,IM_bivariate] = MutualInformation(X)
X = nearestSPD(X);
G = chol(X);
IM_multivariate = -sum(log2(diag(G)));
%% sum mutual information from all pairs
P = X-tril(X);
Ptr = P(P~= 0);
IM_bivariate = -sum(log2(1-Ptr.*Ptr))/8; % why 8?!
end |
% Created on
% 03-Oct-2019 15:24:25
% @author: nchahare
%% <<<<<<<<<<<<<<<<<<< description
% this is for analysing the flip data from mic 1. To browse the script, use "Go To"
% feature of the matlab to directly move to the sections
% there are following sections:
% reading file
% openning tif stack
% mark ce... |
function [imput_arr, conf_arr] = doLC(data, rand_arr, cont_ind, dist_bar)
% Linear Clustering method
[row_num, col_num] = size(data);
row_rand = rand_arr(:,1);
col_rand = rand_arr(:,2);
rand_num = length(row_rand);
imput_mat = spalloc(row_num, col_num, rand_num);
conf_mat = spalloc(row_nu... |
function gammatilde_k = getGammaTildeTest(obj,k)
% if no k is provided, return for current k:
if nargin < 2
k = obj.k_current;
end
%return gamma for given k
gammatilde_k = obj.gammaTilde_test(:,k);
end
|
function writeAllHistData(histData, NorT, outDir, checkFirst, stats, imgName, sliceNum)
% writeAllHistData.m - writes histogram data out for a batch processed group of files.
% This was created to fulfill a specific need of the Keely lab.
%
% Inputs:
% histData - list of binned data generated by the process imag... |
function CheckMultiplicationSize(A, X, B)
if(~isempty(X))
if(size(X,1) ~= size(A,2))
error('size unmatch');
end
if(~isempty(B))
if(size(X,2) ~= size(B,2))
error('size unmatch');
end
end
end
if(~isempty(B)... |
%Andrew Logue 10/2/19
%repvec test cases
testVec = repvec([],7);
disp(testVec);
|
%% Get videoBoxTable and add currentTime to each frame
% we'll take all the video-box-tables in boxTableDir, and find the
% corresponding videos in vidDir, and then for each frame, get the
% currrentTime, and add it to the table and resave it in newBoxTableDir.
clear; clc;
%% Get boxTable dir:
boxTableDir = uigetdir('.... |
% The sum of the squares of the first ten natural numbers is,
%
% 1^2 + 2^2 + ... + 10^2 = 385
% The square of the sum of the first ten natural numbers is,
%
% (1 + 2 + ... + 10)^2 = 55^2 = 3025
% Hence the difference between the sum of the squares of the first ten
% natural numbers and... |
clear all;
%close all;
clc;
%% arguments setup
ampl = 1000; % amplitude
freq = 3; % frequency
phase = 0; % phase shift
t = 0 : 0.01 : 50; % sum points = (upper_bound-lower_bound) / step_length
% Total cycle = (upper_bound-lower_bound) * freq
%% generate complex signal
... |
x=linspace(0,1);
y=ICDF(x);
p=polyfit(x,y,2);
x1=linspace(0.5,0.6);
g=polyval(p,x1);
figure
plot(x,y,'r')
hold on
plot(x1,g,'b')
hold off |
function color=gen_color(curve_idx)
colors=[];
colors{end+1}='b';
colors{end+1}='r';
colors{end+1}='g';
colors{end+1}='m';
colors{end+1}='c';
colors{end+1}='black';
colors{end+1}=[0.7 0 0.7 ];
colors{end+1}=[0 0.7 0.7 ];
colors{end+1}=[ 0.83 0.33 0];
sel_idx=mod(curve_idx-1, length(colors))+1;
color=colors{sel_idx};
... |
function tests = ADFKPSS_Data(Y, namesY, lags)
for i=1:size(Y, 2)
[~,pValue,stat,cValue,reg] = kpsstest(Y(:,i),'lags',1:12);
eval(join(['tests.kpss.', char(namesY{i}),' = [stat;cValue;pValue; reg.DWStat]']));
[~,pValue,stat,cValue,reg] = adftest(Y(:,i),'lags',1:12);
eval(join(['tests.adf.', char(namesY{... |
tic
x=[0 1 2 ];
y=exp(x);
x_inter= 0:0.05:2
pwinterpol(x,y,x_inter)
x_def= -1:1e-4:1; %Definitionsbereich
y_exp=exp(x_def); %Funktion exp
y_runge=runge(x_def); %Funktion Runge
%%Anzahl Stützstellen
zweier_potenz=[];
for i=1:7
zweier_potenz(i)=2^(i);
end
for n = 16%zweier_potenz
stuetz=[];
for i = 0: n
... |
function WriteOutTriangulation(locationTxt, locationMlab, faceCheckers)
addpath('..\PDM_helpers\');
triangulationFile = fopen(locationTxt, 'w');
views = numel(faceCheckers);
fprintf(triangulationFile, '# Number of triangulations\r\n%d\r\n', views);
for i = 1:views
... |
function freqPanel=BeatFreqPanel(T, EXP, Prefix, CmpName, TooltipFreq);
% Panel for simple frequency selection
[Prefix, CmpName, TooltipFreq] = arginDefaults('Prefix/CmpName/TooltipFreq', '', 'Beat', ...
'carrier');
if isequal('-',T), T = 'Beats'; end
freqParam = ParamQuery('BeatFreq', 'frequency:', '15000.5', ... |
function [ IDX ] = NTHC_clustering( X, K )
% NTHC clustering.
% IDX = NTHC_clustering(X, K) partitions the points in the N-by-P data matrix X into K clusters and
% returns an N-by-1 vector IDX containing the cluster indices of each point.
%
% input_args:
% X : Data sets to be clustered (Rows of X corr... |
function return_dat = reader_disconnect(obj)
if ~isempty(obj)
if isvalid(obj)
disconnect(obj);
delete(obj);
return_dat = 'connection successfully closed.';
end
clear kathreinReader;
end |
clear;close all
addpath('MTFCalculation');
cam = webcam(1);
%%
num_used_region = 5;
criterion = [0.1, 0.3]; % MTF = 0.1 at 0.3 cycle/pixel
im = snapshot(cam);
MTF_mean = measureMTF(im, num_used_region);
subplot(1,2,1);
h = imshow(imresize(im, 0.3, 'nearest'));
ButtonHandle = uicontrol('Style', 'PushButton', ...
... |
function [pAve,statsAve,meansAve,resultsAve] = AnovaAverageAnalysis(Outdir,alphath,indseqcondcell,id,invarlist,listcond)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
RTAcc=[]; % for each person it should be initialized again
GroupAcc=[];
GroupStrAcc=[];
for j=1:size(id,2), %ov... |
function result = rectangle_filter2(vertical, horizontal)
% function result = rectangle_filter2(vertical, horizontal)
%
% creates a rectangle filter of type 2
% (white on the top, black on the bottom).
result = ones(2 * vertical, horizontal);
result((vertical+1):(2 * vertical), :) = -1; |
%Titus John
%Leventhal Lab, University of Michigan
% 5/18/2016
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Input
%Previous Mask Dilation
%Thresholded mirror green image
%Output
%The newly labeled paw which is closest to the previous paw
function closestBlobToPrev = findClosestBlobToPrevious(prevMask, mirror_greenHS... |
function [prefix] = generateGRGs(numNodes,numEdges,dims,iters)
if nargin < 3
dims = 3;
end
if nargin < 4
iters = 10;
end
prefix = ['data' filesep 'GRG' num2str(dims) 'd-' num2str(numNodes) 'v-' ];
prefix = [prefix num2str(numEdges) 'e-'];
for iter = 1:iters
msg = [num2str(dims) 'd, iteration ' num2str(iter... |
%% Import DVD trades
d = 'G:\NYSE TAQ\';
diary(fullfile(d,'log.txt'))
recycle off
tic
c = 2190;
addpath .\utils\ .\utils\listzipcontents\
setupemail
% Get directory names
dirnames = {'201005', '201006','201007','201008','201009','201010','201011',...
'201012','201101', '201102','201103','201104','201105',... |
function [CP] = default_parameters_combine_turbulence( basedir, db_index)
%% [CP] = default_parameters_combine_turbulence(basedir , [db_index])
%
% Sets all parameter necessary for combine turbulence to its default values
%
% INPUT
% basedir : unit base directory
% db_index : instrument i... |
function RunExperimentRCoriLightTrigger(input,settings,experiment,ExpType);
% RunExperimentRCori(input,settings,experiment,ExpType);
%
% Gert Van den Bergh 20/10/2009
%
% Function to display Reverse Correlation experiment for orientation and
% phase
TimeDuration = 152*4*16.6667/1000; %152 images 4 times at 16.6667ms/... |
% key_moments.m
% extract key moments given parameters xparam=[sigmaz,sigmag,rhoz,rhog,Gbar,phi];
% if rhoz, rhog, Gbar, phi are not included in xparam, default values are used (defined
% in environment.m). Need to maintain the above order, so, for example,
% if xparam has a length three, this sets rhog, Gbar, ... |
function [bool,fit] = SEL_Iridium_archs_that_fit(archs,mask,MAX)
fit = sum(archs(:,logical(mask)),2);
bool = fit<=MAX;
end |
function [A] = A(dx,dy,N,M)
%Function for Poisson solver - A matrix
NM = N-1*M; %Not calcuating inlet pressure so 1 less column
A = sparse(NM,NM); %sparse function reduces the computing time by squeezing out zero values
%% Centre Points - (T1)
for i=2:N-2
for j=2:M-1
q=((j-1)*(N-1))+i; %pointer A
... |
function forward(s, inp, outp)
y = inp.y;
nAnt = size(y, 3)-1;
nAhead = max(outp.NAhead, nAnt);
nPer = size(y, 2);
[ny, ne] = size(s.H);
[nx, nb] = size(s.T);
nf = nx - nb;
Omg = covfun.stdcorr2cov(s.StdCorr, ne);
if nAnt==0
ZZ = s.Z;
HH = s.H;
dd = s.d;
OOmg = Omg;
else
[ZZ, HH, dd] = stackTime(... |
%function createfigure1(XData1, YData1, XData2, YData2)
%CREATEFIGURE1(XDATA1, YDATA1, XDATA2, YDATA2)
% XDATA1: line xdata
% YDATA1: line ydata
% XDATA2: line xdata
% YDATA2: line ydata
% Auto-generated by MATLAB on 21-Nov-2019 20:37:52
% Create figure
figure1 = figure('Tag','Print CFTOOL to Figure',...
... |
% Script file for control using CTC
%
% Author : Chen SONG
% Created : 2017
% Description :
% Script file for control using CTC. Currently GUI doesn't work with
% the new controller simulator, this will be a template for the
% simulator use.
% Clear the variables, command window, and all wi... |
function plotHandle = shadedErrorBars(xData,data_mean,data_se,plotcolor,plotlineWidth,plotlinestyle)
% Takes in the raw time series and plots it to the current figure with
% error bars (SE)
%
% xRange: x range of plot
% timeSeries (events*time)
% color: 'r' or [1,0,0]
% lineWidth: width of line (e.g. 2)
% shadedSE: if ... |
%function hmm=setStationary(hmm);
%set initial state probability = stationary state probability
%for a HMM object or multidim array of HMM objects
%
%Input:
%hmm= single HMM object or multidim array of HMM objects
%
%Result:
%hmm= HMM object(s) with all MarkovChains forced stationary
%
%Arne Leijon 2009-07-23 tes... |
function rescl = jmlimit(pc,s,cl)
%JMLIMIT Confidence limits for Q residuals via Jackson-Mudholkar.
% Inputs are the number of PCs used (pc), the vector of
% eigenvalues (s), and the confidence limit (cl) expressed
% as a fraction (e.g. 0.95). The output (rescl) is the confidence limit
% based on the method o... |
function out = rectify(data_in, sm)
out = data_in .^ 2;
% disp(size(out));
out = sqrt(out);
% disp(size(out));
% disp(size(repmat(mean(out, 2), 1, size(out, 2))));
% out = out - repmat(mean(out, 2), 1, size(out, 2));
for i=1:size(out, 2)
out(:,i) = smooth(out(:,i), sm);
% out(:,i) = out(:,i) - mea... |
% Paper: "Tight Decomposition Functions for Continuous-Time
% Mixed-Monotone Systems with Disturbances"
% Publisher: Control Systems Letters (L-CSS)
%
% Description: This script generates Figure 2 in the paper. A tight
% decomposition functions is constructed for a dynaical
% ... |
% gstat : call gstat from Matlab
%
% CALL : gstat(G)
% G : gstat data structure OR gstat parameter file on disk
%
% [pred,pred_var,pred_covar,mask,G]=gstat(G)
%
function [pred,pred_var,pred_covar,mask,G]=gstat(G)
gstat_bin=gstat_binary;
% check if input is STRUCTURE or FILE
if isstruct(G)==1,
gstat_file... |
function[m1,m2] = ci_mean(x,a,s)
n=length(x);
z = norminv (1-a/2,0,1);
m1 = mean(x)-z*s/sqrt(n);
m2=mean(x)+z*s/sqrt(n);
end |
function [ outputImage ] = enhanceHistogramColor( originalImage )
%ENHANCEHISTOGRAMCOLOR color version of histogram using HSI format.
% Using HSI format to manipulate intensity component and create a
% histogram based on that array alone. Converting back to RGB once
% complete.
%Convert to HSI image.
HSV = rgb2h... |
function [new_names,new_values,dup_names]=MM_eliminate_dup_names(A)
% Copyright 2019 MOMEI ZHOU, ARVIN LAB, STANFORD UNIVERSITY
% 1. The program make the protein names in a file unique, by adding [ * X ] for
% the X-th duplicate
% 2. Parameters: A is a table
names=table2cell(A(:,1));
values=table2array(A(:,2:... |
clearvars;
addpath('timevp_lib')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MODULE 4: Plot temporal profiles
% This component computes the probabilities of certain behaviors prior,
% during or after another type of events. E.g. the probability that the
% infant's looking behavior... |
function labeledROI = createLabeledROIFromImageJPixels(imgSize,roiObjects)
% Creates a labeled ROI from the ROIs defined in ImageJ's ROI Manager.
%
% Example: labeledROI = createLabeledROIFromImageJPixels([512 512],RC.getRoisAsArray)
%
% by David Whitney (david.whitney@mpfi.org), Max Planck Florida Institute, 2016... |
function varargout = Analytics(varargin)
% ANALYTICS MATLAB code for Analytics.fig
% ANALYTICS, by itself, creates a new ANALYTICS or raises the existing
% singleton*.
%
% H = ANALYTICS returns the handle to a new ANALYTICS or the handle to
% the existing singleton*.
%
% ANALYTICS('CALLBACK',h... |
cd(dirs.homedir)
d2 = dir('*.mat');
lapinfo = cell(size(d2,1),1);
for id = 1:size(d2,1)
thisdir = d2(id).name;
load(thisdir,'vel','behave_change_log','laps_singlepass','armpos','pos','armposindex','dirdat','binpos')
[~,armp] = max(armposindex,[],2); clear armposindex
lappro = NaN(size(laps_si... |
function [Pose] = Tolga_icp_mod_point_plane_pyr(SrcPC, SrcN, DstPC, DstN, Tolerence, MaxIterations, RejectionScale, NumNeighborsCorr, NumLevels, SampleType, DrawRegistration)
%% This code has been copied from a script by Tolga Birdal:
% https://www.mathworks.com/matlabcentral/fileexchange/47152-icp-registration-using... |
function load_in_browser(docfile, varargin)
%LOAD_IN_BROWSER Browse the local html file in a browser
% docfile is the name of the document file to launch
% anchor is the optional in-file anchor ('#introduction')
path = strrep(which(docfile), '\', '/');
if nargin == 2
str = ['file:///', path, varargin{1}];
w... |
function plotFullState(output)
%
% This function plots the full state of the robot (x), given the results of
% a simulation.
%
%%%% Pretty:
colorOut = [0.9, 0.2, 0.2];
colorInn = [0.2, 0.2, 0.9];
colorX = [0.5, 0.6, 0.1];
colorY = [0.1, 0.6, 0.5];
%%%% UnPack:
t = output.t;
z = output.x(1:6,:);
dz = output.x(7:12,:... |
function tdata = timeplot4(path, file, xyz)
% function result = timeplot4(path,file, [ x,y,z] )
%
% Returns the intensity of the voxels in the points determined
% x y z are the coordinates of a set of voxels to be averaged
% the data comes back as a row vector. eg -
% [ x1 y1 z1 ;
% x2 y2 z2 ;
% x3 y3 z3 ]
... |
function [ array_mean ] = my_mean( one_dim_array )
% pusing bro, ada obat nyamuk?
% dapatkan panjang array satu dimensi
n_array = length(one_dim_array);
% hitung total
array_sum = 0;
for i = 1:n_array
array_sum = array_sum + one_dim_array(i);
end
array_mean = array_sum/n_array;
end
|
function Testbed()
%Main function driver class
global outfile;
global infile;
infile = fopen('data.txt','r');
outfile = fopen('ISE511L.txt','w');
if(infile<0)
printf('data file does not exist!\n');
return;
else
shapeNum = fscanf(infile,'%d',[1,1]);
end
for i = 1:shapeNum
shapeType = fscanf(infile... |
function [aux_ini_fil,filaments] = move_index_3D(S_new,filaments,P)
% after remeshing update the closest mesh vertex to the intersection
% with the line from the nucleation location
aux_ini_fil = zeros(size(P.ini_fil));
for l = 1:length(P.ini_fil)
if P.line(l,4) == 1
ind = find(S_new... |
function [] = Lab4_Q2()
clc;
figure_name = 'Lab4_Q2-Figure';
figure_i = 1;
% Parameters for calculating the efficient frontier.
asset_price = xlsread('price.xls');
[M, C] = ReturnMeanCov(asset_price);
[mean_vec, var_vec] = MarkowitzEfficientFrontier(M, C);
fprintf('Part A - Figure 1... |
function output = pvd( type, img, in, PX, PY )
type = string(type);
stego_img = img;
lb=[0 8 16 32 64 128]; %lowerbound
ub=[7 15 31 63 127 255]; %upperbound
in = [ dec2bin( size(in,2), 32) in ];
%% Encoding
if type == "encoding"
ptr = 1;
for pl=... |
%% Geometry dependence of surface lattice resonances in plasmonic nanoparticle arrays
%******************
%% INITIALIZE
close all
clc
clear all
%******************
%******************
%% DASHBOARD
%******************
% speed of light
c = 3.0e8;
% momentum for periodicity 375nm
pg = 377e-9;
px = 415e-9;
py = 375... |
function [p2,score2,norm_score2] = proportional_selection(N,N2,p,score,norm_score,sum_norm_score)
% Halve population size by retaining fitter individuals with an higher likelihood.
i = 0; j = 0;
p2 = cell(1,N2);
score2 = -Inf*ones(1,N2);
norm_score2 = -Inf*ones(1,N2);
while j < N
i = mod(i,N2) + 1;
i... |
function [structs_scans] = collectScans_modified(positions, headings, reps)
try
rosinit();
catch
disp("Ros already initialized")
end
% Create empty structure array for all scans
struct_scan = struct();
struct_scan.r_all = [];
struct_scan.theta_all = [];
struct_scan.posn = [];
struct_scan.heading = [];
structs_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.