text stringlengths 8 6.12M |
|---|
function p = PTBDemoParams
% Screen
p.screenWidthCm = 20;
p.viewDistCm = 57;
% Fixation
p.fixSize = 0.5; % degrees visual angle
p.fixColor = 1; % white
% Images
p.backgroundColor = 0.5; % gray
p.imPos = [0 0];
p.imDur = 1; % s
p.gratingSize = 4; % degrees visual angle
p.gratingSF = 1; % cycles per degree
p.gaborSD =... |
% =======================================================================
%
% Program to estimate a model by full information maximum likelihood
% and instrumental variables. The set of equations is given by the
% bivariate system
%
% y1t = beta*y2t + u1t
% y2t = gam*y1t + alpha*xt + u2t
%
% ====... |
function pseudoternary( bitstream )
%PSEUDOTERNARY Pseudoternary encoding
% sample data:
% d = [ 0 1 0 0 1 1 0 0 0 1 1 ]
% usage:
% pseudoternary(d)
% author:
% Anastasios Latsas
% pulse height
pulse = 5;
% assume that current pulse level is a "low" puls... |
%%
% fm = 1.8512e9; % BTD06
% fm = 1.845e9; % BTD07
fm = 1.841e9; % BTD08
% znb.frange(fm);
psg.frequency(fm);
psg.power(-20);
P_RF_drive = psg.power
psg.on;
%%
fsw.center(fm);
fsw.span(1e6);
fsw.bw(100);
pause(0.5);
fsw.sweeptime(0.1);
pause(0.5);
fsw.sweeptime(0.5);
fsw.scan(... |
% Audie Milson ( 535180021 )
clear; clc;
bAtas = 2;
bBawah = 0.5;
segment = 2;
segment_0375 = 3;
fun = @(x) (0.5*(exp(1.5*x+1)))-(3*sqrt(x));
nilaiIntegral = integral(fun, bBawah, bAtas);
hasil_simpson033 = simpson033(fun, bAtas, bBawah, segment)
error_eksak = (abs(nilaiIntegral-hasil_simpson033)/nilaiIntegral)*100
... |
function D = GenerateDistribution(N)
sigma = 0.05;
myu = 0;
x = linspace(0, 1, N );
D = NormalDistribution(x, myu, sigma);
D = D / max( D );
end
function D = NormalDistribution(x, myu, sigma)
D = 1./sigma./sqrt(2*pi)*exp(-(x-myu).^2/2./sigma.^2);
end
|
addpath('../general_functions')
addpath('../../generally_applicable_code')
clear all
T_iter=linspace(0.01,30,600);
w_range=linspace(0,200,10^5);
d_iter=2:5;
q=0.2;
lam=0.4;
alpha=1;
A=-1;
nlam=100;
Fbar_S=@(x) exp(-x);
p=1/2;
for i=1:10
px(i)=(1-p)^(i-1)*p;
xx(i)=i;
end
px(10)=1-sum(px(1:9));
xx=xx./sum(px.*xx... |
%% addVertex
% Method of the cellNetwork class to add a Vertex
%%
%% Syntax
% N = addVertex(N,V)
%
%% Description
% Add a new vertex to a cellNetwork object.
%
%% Inputs
% * N - a cellNetwork object
% * V - a n by
%
%% Outputs
% * N - a new cellNetwork object
%
%% Examples
% >> N = addVertex(N,[0 0]);
% add the or... |
close all;
ptSpacing = 0.02;
x = 0:ptSpacing:1;
y = 0:ptSpacing:1;
% a regular function
funcString = 'conj(Z).^2';
wzmap(x,y,funcString);
% a non-regualar function
funcString = 'Z.^2';
wzmap(x,y,funcString);
funcString = 'exp(Z)';
wzmap(x,y,funcString);
funcString = 'cos(Z/(2*pi))';
wzmap(x,y,funcString);
x2 = 0:.... |
maxCycle = [0,0];
prime = primes(1000);
prime = prime(2:end);
for i = 1:length(prime)
n = 2;
prod = 0;
count = 0;
while prod ~= 1
prod = mod(10^n,prime(i));
n = n + 1;
if prod ~= 1
count = count + 1;
end
if count > maxCycle(2)
... |
ca;
fsz = 16;
lwd = 1;
TGL_sav = 0;
% define catheter
L = 100; % length of catheter (mm)
L_pct_bent = 80; % active length (%)
L_res = 0.5; % number of nodes along catheter length
% define helix
p1_helix = 20; % helix starting point (% length)
p2_helix = 90; % helix ending point (% len... |
err = zeros (0,1);
md = zeros(0,1);
for year = 2011:2014
for month = 1:12
cstryear = num2str(year);
infiletff = strcat('/usr/local/data3/rtc/tff/',cstryear,'/rtc',cstryear(3:4),sprintf('%02d',month),'00.tff');
infidtf=fopen(infiletff,'r');
if infidtf == -1
continue;
end
npttf1=fread(infi... |
classdef ReLU < nnet.internal.cnn.layer.Layer
% ReLU Rectified Linear Unit layer
% Copyright 2015-2016 The MathWorks, Inc.
properties
% LearnableParameters Learnable parameters for the layer
% This layer has no learnable parameters.
LearnableParameters = nnet.intern... |
for database = {'Y6'}%{'OA'} % {'Y1','Y4'} %{'O9'}%{'l'} %{'Y5'}%{'Y3','Y4'}%{'O6','O7'}%{'O5'}%{'Y1','Y2'}%{'O1','O2','O3','O4'}
for p = 2:10 %3:3:30 %
for sigma = [sqrt(10)] %][sqrt(2),sqrt(5),sqrt(10),sqrt(15),sqrt(20)]
outfile = GetW_caideng(database, p, sigma)
end
end
end
|
function varargout = w_TransMat(varargin)
% W_TRANSMAT MATLAB code for w_TransMat.fig
% W_TRANSMAT, by itself, creates a new W_TRANSMAT or raises the existing
% singleton*.
%
% H = W_TRANSMAT returns the handle to a new W_TRANSMAT or the handle to
% the existing singleton*.
%
% W_TRANSMAT('CALL... |
clc
clear all
cd ('/Users/pegahk/Dropbox/AutismPaper/BalancedSites')
files=dir('tr*.mat');
Nfiles=length(files);% number of matrices
%% from colum vector index to positions in the 2d fisher matrix
load('featureRank.mat')
F_rank=featureRank;
squence=cumsum([0:1:199]);
for i=1:length(F_rank);
column(i)=... |
% Construct the companion representation of a state space model
% with state vector theta p lags in the VAR representation and
% n variables and c=1 constant c=0 no constant.
function C = companion(theta,p,n,c)
if c == 1
np = (n*p+1);
elseif c == 0
np = (n*p);
end
theta = theta';
for i = 1:n
... |
close all
clear all
dut = load('CV_E_1storder_random');
first_order_CV_E1_random = dut.CV_E1_rand;
first_order_E = first_order_CV_E1_random.E;
first_order_E_best = first_order_CV_E1_random.E_best;
first_order_E_best1 = first_order_CV_E1_random.E_best1;
first_order_h ... |
function mpart = niak_part2mpart( part , flag_lvec )
% Convert a partition on nodes into a partition on edges.
%
% MPART = NIAK_PART2MPART( PART , FLAG_LVEC )
%
% PART (array Kx1) a partition of the K nodes
% FLAG_LVEC (default true) if the flag is on, use NIAK_MAT2LVEC to vectorize the mask.
% Otherwise, use NIAK_... |
clear; close all;
dat = readtable("age-surgery.csv");
dat.age = double(dat.age);
dat.surgery = double(dat.surgery);
summary(dat);
scatter(dat.age, dat.surgery,200, 'MarkerFaceColor','black')
alpha(0.5)
grid()
%%
% Linear regression (the silly thing to do...):
lin_regr = fitlm(dat, 'surgery~age')
coef = lin_reg... |
function R=loadaudit(tag)
%
% R=loadaudit(tag)
% read an audit text file with name fname into an audit structure.
% The text file must contain lines of the form:
% cue duration type
% Comments preceded by the symbol % will also be read in
% Output:
% R is a structure containing all o... |
function [bar] = corrs_to_bar_matlab(corrs,S,barmap)
if ~isfield(S,'X')
S.X = S.VERT(:,1);
end
bar = zeros(length(S.X),4);
bar(:,1)=-1;
inds = corrs(:,1);%+1for c to matlab
bar=barmap(corrs,:);
end
|
function bioRadio_Execute_fcn4(~,event)
%% Globals Initialization
global bioRadioHandle;
global channelNumbers collectionInterval rawWindow isCollecting;
%% Initializing
txt1 = 'not collecting...';
event_time = datestr(event.Data.time);
maxChannel = max(channelNumbers);
% rawWindow = zeros( 8,collectionInterval);
cDa... |
clear;
close all;
%%%%%%setting model tunning parameters%%%%%%
winsize=7;
lamb=1e-4;
N=20;%sparsity constraints;
snr=10;
%%%%setting parameters%%%%%%%
option.method='batch';%'online';
option.priorType='conv';%'times';
option.estepType1='chain';%'tree' for e-step;
option.addone=1;%add bias term;
option.con... |
list=[1,1,2,3,4,5,2,4,5,2,98,76];
max=0;
for i=1:length(list)
if list(i)>max
max=list(i)
disp(max)
end
end |
function [numTables,out_tables] = getTablesFromHTML(HTML_string)
% GETTABLESFROMHTML read the table from HTML string
%
% Syntax:
% [numTables,out_tables] = getTablesFromHTML(url_string, nr_table)
%
%Description:
%
% Function getTableFromWeb_mod is based on the very very good "pick of the week" from August 20th, 20... |
clear all;
x = xc_test.timestwo(2.0);
y = xc_test.cube(3);
excentury.dump_text('tmp.xc', ...
{x, 'x', 'double'}, ...
{y, 'y', 'int'} ...
);
|
clear all;
close all;
hold on;
x = rand_sawtooth(1000).*4 - 2;
z = randn(1,1000)*2;
alpha = 15;
x_axis = linspace(-2,2,1000);
y_org = m(x,alpha);
y = y_org + z;
y_basic = m(x_axis,alpha);
plot(x_axis,y_basic)
estimator_NW(x,y)
|
function spec2input(spec,nnn,mmm)
% 将能谱转换为mcnp输入文件中的分布
% spec:两列
% nnn: 输出的x每行有多少个值
% mmm: 输出的y每行有多少个值
% REF:
% si参数: L离散值分布 A描点概率密度
disp('c *-1----*----2----*----3----*----4----*----5----*----6----*----7----*----8----*');
a = spec(:,1)';
% H 区间内均匀分布;L离散值分布;A描点概率密度函数
disp(['si1 L ',num2str(a(1:nnn),'%g ')]);
i = nn... |
% STEPDEMO
% This script demonstrates the process of measuring
% the step response of a 1st-order, feed-back LPF.
% A plot is created showing a comparison between
% the input step signal and the output response.
% Initialize the Sampling Rate
Fs = 48000; Ts = 1/Fs;
% Create Step Input Signal
x = [zeros(Fs,1) ; ones(F... |
% MXLANTC.M
% Sets text for angle (in degrees)
% Called by MXLXM
% Note: angle (mxlang) is in degrees
mxlang = str2num(get(mxluiant,'String')) ;
if isempty(mxlang) ;
set(mxluiant, 'String','ERR', ...
'BackGroundColor', 'red')
else ;
if mxlang < 0 ;
set(mxluiant, 'String','ERR', ...
'BackGroundColor', 'red')... |
function ind = n_dim_find(array, val)
%N_DIM_FIND N-dimensional FIND function that returns array of indices for
% val in each dimensions. IND is empty matrix [] if VAL was not
% found in ARRAY
%
% Author: Nadya Travinin
%!!!Only supports 4-D arrays at the moment
%dimension of the array
dim = length(si... |
function obj_Rotate = GUIRotate(object,varargin)
% % % determine if GUI already exists
h=findall(0,'Type','figure','Tag','guiRotate');
if ishandle(h)
figure(h);
return
end
figRadiography=SMASH.MUI.Figure();
figRadiography.Name='Use Dialog Box to Rotate Image';
imagesc(object.Grid1,object.Grid2,object.Data);... |
%This script simulates ITD sensitivity for a pair of low-frequency and
%high-frequency narrowband noises. This simulation is based on simulated
%spike trains at the output of the BEZ phenomenolgical auditory nerve (AN)
%model. This method roughly follows the procedure described by Moncada-
%Torres et al. (2018) http... |
function [centerCoord, neuronShape, CD] = segmentNeuron(Img, Mask, nuc,algorithm)
%segmentNeuron returns the list of the center coordinates and the list of
%the pixels belonging to the neuron
% it is "copy and paste" from the Raphael's script
Img=double(Img); % cast to double
Mask=logical(Mask); % cast to logical
ass... |
%-------------------------------------
% Run testBioradio.m first
%-------------------------------------
% Clear the workspace and the screen
sca; % clear all screens/screen objects
% close all;
% clearvars;
load('regression_fit_1.mat');
% Here we call some default settings for setting up Psychtoolbox
PsychD... |
function E = KeplerEq(M,e,eps)
% Function solves Kepler's equation M = E-e*sin(E)
% Input - Mean anomaly M [rad] , Eccentricity e and Epsilon
% Output eccentric anomaly E [rad].
En = M;
Ens = En - (En-e*sin(En)- M)/(1 - e*cos(En));
while ( abs(Ens-En) > eps )
En = Ens;
Ens = En - (En - e*sin(En) - M)/(1 -... |
% class helper
% write helper functions as helper class methods
%
% use:
% h = helper() % initialize class
% h.method_name(...) % to use a helper function
%
classdef helper < handle
properties
end
methods
% initialize
function h = helper()
end
% function [d_std5, d_std4] = find_std_maturity(d)
% finds t... |
% Code debugger and tester
clear all;
close all;
clc;
Table = readtable('output_file_Sun_18_Apr_2021_08_35_57AM.csv');
Ts = 0.003333;
arm_data_previous = table2array(Table(1652,2:4));
pivot_data_previous = table2array(Table(1652,5:7));
Teensy_data_previous = table2array(Table(1652,11:14));
arm_data = table2array(Tab... |
function GraphMultiAnal(FILENAME,TYPE,varargin)
% GraphMultiAnal
% Creates a visualization and summerization of the results from
% RunMultiAnal.
%
%
%
%
%
%
%
%
%
%
%
%
%
NUM_OBS_CUTOFF=500;
SIG_NUM_CUTOFF=0.7;
MAG_CUTOFF=0.4;
switch lower(TYPE)
case 'excel'
[Drug... |
function [ gaussian ] = computeBasisFunctionsVector( x , params )
MUsInv = params.MUs';
gaussian = arrayfun(@(muX,muY,var) computeGaussianValue(x, [muX;muY], var), MUsInv(:,1), MUsInv(:,2), params.Vars);
%
% [N,~] = size(params.MUs);
% gaussian = zeros(N,1);
% for i = 1:N
% mu = params.MUs(:,i);
% ... |
function SNR = dBstoSNR(SNR_dB)
SNR = 10^(SNR_dB/10); |
function Loss = rlmse(ModelOutput,Target)
% Mean squared error loss.
% ModelOutput: dlarray, output from model
% Target: mse target, can be numeric
% Copyright 2019 The MathWorks Inc.
Loss = mse(ModelOutput, reshape(Target,size(ModelOutput)));
end |
function [Y,F] = GCG( Y0,A,iters )
%GCG Grassmaniann-Conjungate-Gradient method to find the smallest
%eigenvalue and eigenvector
%
% INUTS
% Y0 - [] Initial eigenvector
% A - [] Target matrix
% iters - [] Number of iterations
%
% OUTPUTS
% Y - [] The resulted eigenvector
... |
%%
% % desciption: merge multiple netcdf files for sepcific domain
%
% % usage:
% % 1. filenumber is up to the number of your netcdf file to be processed.
% % 2. all the details of the data is saved as the orginal ones.
% % 3. just consider extend the time dimension, so the other dimensions
% % ... |
function Cost = SVM_Cost( XX , Xtr , Ytr )
%SVM_COST Summary of this function goes here
% Detailed explanation goes here
Cost = zeros(size(XX,1),1);
for ii = 1:size(XX,1)
X = XX(ii,:);
Mdl = fitrsvm(Xtr , Ytr ,'Standardize',true,'KernelFunction','gaussian','KernelScale'...
, X(1:1) , 'Epsil... |
if ~exist('pathName','var')
pathName=pwd;
if ~strcmpi(pathName(end),filesep)
pathName=[pathName,filesep];
end
end
[fileName, pathName]=uigetfile([pathName,'*.csv'],'Get main data file.');
csv490File=[pathName,fileName];
[fileName, pathName]=uigetfile([pathName,'*.csv'],'Get control data file.');
csv... |
function features = process_image(base_path, img_id )
% Read the raw image and mask of interesting area.
pure_png = imread(strcat(base_path, sprintf('%04d', img_id), '_raw.tif'));
mask_png = imread(strcat(base_path, sprintf('%04d', img_id), '_msk.png'));
% Compute histogram features.
sig_1D = sig_1D_signature(mask_pn... |
function O = lines_segmented_visualization(lines)
%LINES_SEGMENTED_VISUALIZATION Puts together the segmented lines into a
%single image
% O = lines_segmented_visualization(lines)
%
% INPUT
% lines: a cell array with the images of each of the segmented lines.
%
% OUTPUT
% O: a single image ... |
function data = splitDataRandom(inputs, targets, splitdistribution)
m = size(inputs, 1);
indeces_perm = randperm(m);
N = numel(splitdistribution);
M = sum(splitdistribution);
ind = 0;
for k = 1:N-1
ind = ind(end)+1:ind(end)+round(m*splitdistribution(k)/M);
data{k}.inputs ... |
function binclock(color)
%BINCLOCK Binary Clock - Displays the clock time in binary representation
% BINCLOCK(COLOR) Displays the LEDs with the specified color
% where COLOR is a 1x3 vector with values in the range [0,1]
%
% Time is displayed as 6 columns of LEDs in the form HH:MM:SS
% Thus,the following d... |
%Create function for s3kplot 2 work (callback from s3kplot figure)
function get_cmsfile %Maingoal with operation
hmainFig=gcf; %Get figure handle
s3kplot_prop=get(hmainFig,'userdata'); %Get properties for choosen file
h=s3kplot_prop.h; %Get handle for ... |
function MIP(zone_i, zone_j)
% further Linearization, to make the obj function linear
% accelerate the algorithm tens of times
% clear;clc;clf;
global zone robot
submap = zone(zone_i, zone_j).submap;
robot_local = robot(zone(zone_i, zone_j).robot);
no_robot = length(robot_local);
states = [robot_local.rstate]';
spoint... |
i=0;
ans=0;
for i = 0:999
if(rem(i,3)==0)
ans=ans+i;
end
if(rem(i,3)~=0&&rem(i,5)==0)
ans=ans+i;
end
end
|
function [Gini_min, op_point] = CART_split2_C(attr, labels)
% 函数功能:分类树选择属性的最佳分割点
% 函数输入参数:
% attr: 样本的某个属性的全体值
% labels: 属性值对应的类别标签
% 函数输出值:
% Gini_min: 最佳分割点对应的基尼指数
% op_point: 最佳分割点的下标
n = length(attr); %特征数组长度
for i = 1:n-1 %对特征值冒泡排序,类别标签也应改变
for j = 1:(n-i)
if attr(j) > attr(j+1)
... |
function plotPartObj(bTrueResult, sTitle, varargin)
%
% Plot the input data as subplots.
%
% bTrueResult: boolean to indicate if the dataset loaded has true
% distribution/partition results.
%
optargin = size(varargin,2);
stdargin = nargin - optargin;
if stdargin < 0
disp(' plotPartObj(varargin)');
exit;
end... |
function [lambda,mu,eta,X1,X2,X3,Y1,Y2,Y3] = threepareig(A1,B1,C1,D1,A2,B2,C2,D2,A3,B3,C3,D3,opts)
%THREEPAREIG Solve a three-parameter eigenvalue problem
%
% [lambda,mu,eta,X1,X2,X3,Y1,Y2,Y3] = THREEPAREIG(A1,B1,C1,D1,A2,B2,C2,D2,A3,B3,C3,D3,opts)
% finds eigenvalues and eigenvectors of a three-parameter eigenvalu... |
function groupimages(curfile,namefolder,sexpval,conc)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
storedfiles2=cell(1,numel(conc));
for r=1:numel(conc)
testlc2= sprintf('\\%1.1f ngperml\\',conc(r));
fpofname=char(strcat(namefolder,testlc2));
cd(fpofname)
summaryfiles... |
function figh = plotSpikesAndLFP( ex, varargin )
% plot the spike train together with two bandpass filtered versions of the
% LFP for a subset of rewarded trials
%
% additional arguments are
% ntrials - the first x trials are shown in the graph
% alpharg - the first frequency band shown in the plot
% gammarg - the sec... |
function varargout = Surface_Vox2mm(varargin)
%
% Syntax :
% Surf = Surface_Vox2mm(Surf,Vr,convcad);
%
% This function plots the surfaces contained in the cell file Surfa.
%
% Input Parameters:
% Surf : Surface file (Matlab Format).
% Vr : Volume or image filename.
% convcad : Conversion strin... |
clear
img = load('hall.mat');
p = double(img.hall_gray(1:100, 1:100));
ans1 = DCT2(p);
ans2 = dct2(p);
max(max(ans1-ans2))
function C = DCT2(P)
[~, N] = size(P);
D = zeros(N, N);
D(1, :) = 1/sqrt(2);
for i = 1:N-1
for j = 0:N-1
D(i+1, j+1) = cos((2*j+1)*i*pi/(2*N));
end
... |
%@(#) fallsum7.m 1.2 06/01/02 15:39:20
%
%function fallsum7('sumfil',cases,crnums,'infil');
function fallsum7(sumfil,cases,crnums,infil);
tx=readtextfile(infil);
i=bucatch('PRIFIL',tx(:,1:6));
[t,n]=sscanf(tx(i,:),'%s');
printfile=t(7:length(t));
i=bucatch('REFDIS',tx(:,1:6));
[t,n]=sscanf(tx(i,:),'%s');
disfil=... |
function [edge, isInside] = clipRay(ray, bb)
%CLIPRAY Clip a ray with a box.
%
% EDGE = clipRay(RAY, BOX);
% RAY is a straight ray given as a 4 element row vector: [x0 y0 dx dy],
% with (x0 y0) being the origin of the ray and (dx dy) its direction
% vector, BOX is the clipping box, given by its extreme co... |
% Demo for model sum_{i=1}^{nCH}|MFS_jx-f_j|^2/2 + wRegRescaled*TV(x), where M is
% the mask, F is the 2D Fourier transform matrix, S_j's are sensitivity
% maps, and f_j's are k-space datasets. The solution x of the model is the
% reconstructed image from partially parallel MRI.
%% Init
clear; clc; close all;
... |
function y = RungeKutta(f, yi, ti, h, n)
% Solves an initial value problem of the form dy/dt=f(t, y).
y=zeros(n, length(yi));
for i=1:n
k1=h*f(ti, yi);
k2=h*f(ti+h/2, yi+k1/2);
k3=h*f(ti+h/2, yi+k2/2);
k4=h*f(ti+h, yi+k3);
yi=yi+(k1+2*k2+2*k3+k4)/6;
ti=ti+h;
y(i,:)=yi;
end
end |
function Configuration = save_summary_data_for_device_profiles (Configuration, ...
Summary, Households, Devices, Model, Time)
%SAVE_SUMMARY_DATA_FOR_DEVICE_PROFILES Summary of this function goes here
% Detailed explanation goes here
% Erstellt von: Franz Zeilinger - 04.12.2012
% Letzte Änderung durch: ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Autor: Prof. Alexandre Zaghetto %
% E-mail: zaghetto@image.unb.br %
% Disciplina: Sinais e Sistemas %
% Departamento: Ciência da Computação %
% Universiade de Brasília %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
clc
%%%%%%%... |
% Exercise 2.5: Probabilities on Normal distribution
mu = 4;
sigmasq = 0.01;
x0 = 3.9;
p1 = 0.01;
% P(X<x0)
sigma = sqrt(sigmasq);
px0 = normcdf(x0,mu,sigma);
x1 = norminv(p1,mu,sigma);
fprintf('F_X(%3.3f)=P(X<%3.3f)=%3.3f \t F^{-1}_X(%3.3f)=%3.3f \n',x0,x0,...
px0,p1,x1);
|
function kyu_plotbins(data_C,data_C_raw,boundary,labels,units)
nvar = size(data_C,2);
plot_ncols = 8;
plot_nrows = ceil(size(data_C,2)/plot_ncols);
nbins = 7;
bins = linspace(-2,2,nbins);
for i = 1:nvar
%subplot(plot_nrows,plot_ncols,i);
subaxis(plot_nrows,plot_ncols,i,'sh',0.02,'sv',0.12,'Padding',0,'mt',0.0... |
function [ G ] = makeG_nonlinPendulum( theta, T, force )
%Create the G matrix for the nonlinear pendulum problem
% @param theta Array of theta angles rad (1xm)
% @param T Period of the motion
% @param force Forcing constant
% @return G G matrix for J*delta = -G
% AUTHOR: Morgan Yost
m = lengt... |
%read_landsat8_image
% opens window for each color channel.
%% Read Landsat8 Images
cd(datadir); % set datadir as current directory
%%% Read the PAN image
PAN = imread('LC81740382017052LGN00_B8.TIF'); % read the B8 raw file.
figure(1)
imagesc(imadjust(PAN, stretchlim(PAN))); colorbar % display the PAN image includ... |
function [res] = cusum(ds,dim,alpha,c,th)
%This function detects anomalies (changes) using cumulative sum
%INPUTS
% infilepath: path to infile (csv)
% header : flag set to 1 if header present
% dim : dimension to test variations
% alpha [optional]: scalar defining the proportion of new/old value: new = alpha*old ... |
% FIGURE MANAGMENT
%
% Files
% dockfig - fighandle=dockfig(figs) DOCK one or more FIGures.
% getfigdim - [figsize,figborders]=getfigdim(figh) GET FIGure DIMensions.
% newdfig - fighandle = newdfig(numfigs,figname) create NEW Docked FIGures.
% vf - fighandle=vf(figs) View one or more Figur... |
function addpath_bpm
%ADDPATH_BPM - Add the new BPM software to the Matlab path
% The path should not be modified in standalone mode
if ~isdeployed
% Regular Matlab Session
MMLROOT = getmmlroot;
%addpath(fullfile(MMLROOT, 'machine', 'ALS', 'Common', 'BPM'), '-begin');
addpath(fullfile(MMLROOT, 'machin... |
%---------------------------------------------------
%AUTHORS: Sofia Fernandes, Hadi Fanaee-T, Joao Gama
%--------------------------------------------------
clear all;
clc;
%load dataset
load('datasets\synthi')
T=sptensor(T);
%run detector on the whole network using a sliding window
dataset='synthi';
WL=[... |
%% MyMainScript
tic;
I = zeros(300);
I(50:100, 50:120) = 255;
J = zeros(300);
J(120:170, 20:90) = 255;
fig1 = figure(1);
subplot(121); imshow(I); title("Image I");
subplot(122); imshow(J); title("Image J");
f1 = fftshift(fft2(I)); f2 = fftshift(fft2(J));
f = (f1 .* conj(f2))./(abs(f1 .* f2));
lf = log(abs(f) + 1);
fi... |
format short e
N = 100;
for a = 0.35:0.0001:0.55,
sqrtq = pi/(2*a);
h = a/N;
yp = @(x) -0.3 * sin(sqrtq * x) * sqrtq;
yt = @(x) sqrt(1 + yp(x)^2);
approx = 0;
k = 1;
limit = a/h + 1; %(k-1)*h = L => k = L/h + 1
while k<=limit,
xk = (k-1) * h;
k = k + 1;
xk1 = (k - 1) * h;
... |
% add missing labels with nearest point
clear,clc
pth_dir_original = '/home/dtc/Backup/Data/ScanNet/Ply';
scene_id = 'scene0011_01_vh_clean_2.ply';
pth_file_original = fullfile(pth_dir_original, scene_id);
pc_original = pcread(pth_file_original)
figure(2)
pcshow(pc_original) |
function [hkl,translated_points] = get_hkl_slices(params,thres)
disp(['calculating hkl with slice-width: ',num2str(thres)])
start_time=clock;
a = params.base_vectors(1,:);
b = params.base_vectors(2,:);
c = params.base_vectors(3,:);
max_range = max(norm(single(min(params.data))),norm(single(max(params.data))));
i... |
clear all;
nbins=64;
BG=csvread('compressed/color/train/BG.csv');BG=reshape(BG',100*17120,1);
CG=csvread('compressed/color/train/CG.csv');CG=reshape(CG',100*17120,1);
TG=csvread('compressed/color/train/TG.csv');TG=reshape(TG',100*17120,1);
X_test=cat(2,BG,CG,TG);
%clear BG;clear CG;clear TG;
Y_test=kmeans(X_test,nbins... |
function imf = emd(x,varargin)
% Empiricial Mode Decomposition (Hilbert-Huang Transform)
% imf = emd(x);
% imf = emd(x,'interp',interp);
% Inputs:
% x - Timeseries on which to perform EMD
% interp - 'spline' or 'cubic' [default]
% nComps - Manually specifying number of components
% Outputs:
% imf - Cell array where eac... |
function [C, sigma] = dataset3Params(X, y, Xval, yval)
%DATASET3PARAMS 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] = DATASET3PARAMS(X, y, Xval, yval) returns your choice of C and
% sigma. You... |
function [points] = getRandomPoints(I, alpha)
% Generates random points in the image
% Input:
% I: grayscale image
% alpha: random points
% Output:
% points: point locations
%
% -----fill in your implementation here --------
[m,n,c]=size(I);
i = randi([1 m... |
function A=posmatr(matriks)
%fungsi ini untuk menghitung pada baris ke berapa suatu matriks mencapai
%nilai maksimum
[m,n,o,p]=size(matriks);
for j=1:p
A(1,j)=posmax(matriks(:,j));
end
A;
|
%% create_menu.m
%
% TODO: write short description of function
%
%% Help
%
% *USE*
%
% TODO: write longer description of function
%
% *INPUT VARIABLES*
%
% * |main_figure|: Handle to main ESP3 window
%
% *OUTPUT VARIABLES*
%
% NA
%
% *RESEARCH NOTES*
%
% TODO: write research notes
%
% *NEW FEATURES*
%
% * 2017-03-28: h... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Name : <Sunny Patel>
% GT Username : <sunnypatel18@gatech.edu>
% Section : <B05>
% Homework : HW01
%
% Collaboration: <place here one of the following:
% "I worked on the homework assignment alone, usi... |
Stimuli=zeros(6,size(ZS,2));
GCaMP6=[0,1.69644104899772,5.13796058542217,8.27886020152244,10.3756715204800,11.8173714529814,12.2425184714093,10.8571417354877,8.80831829681196,6.91339112244670,5.46959264663869,4.30868766622567,3.42533619066766,2.75378443486879,2.18017250852183,1.72816235135824,1.32732537295463,1.006844... |
function rec = getRecommendations(u_hat, Theta_sub)
%GETRECOMMENDATIONS Returns the recommendation in order
available_items = Theta_sub(:,1);
ratings = u_hat*Theta_sub(:,2:end)';
[~,I] = sort(ratings,'descend');
rec = available_items(I);
end
|
clear all
close all
clc
del32Candidate = importdata('HazardDelta32Bootstrap.txt');
%first convert the hazard rate per year into survival probability till each
%age
%the result from each bootsrap takes 37 rows (each row is one year interval).
%so there are 1000*37 rows.
%The four columns, representing the genotypes r... |
% Experiment on Mpeg-7 dataset
clear; clc;
addpath('include/llc/');
addpath('include');
addpath('include/liblinear-1.7-single/matlab');
addpath('include/idsc_distribute/common_innerdist/');
addpath('include/vl_toolbox');
vl_setup;
img_dir = 'data/mpeg71';
fea_dir = 'data/mpeg71_feas';
codebook_path = 'data/mpeg71_... |
close all
clear all
clc
Fs = 1000;
endTime = 50*Fs;
t = [1:50*Fs]./Fs;
subjectNo = 1:12;
[b,a] = butter(4,5/(Fs/2),'low');
count = 1;
for j = 1:2
for k = 2:2:4
for i = 1:length(subjectNo)
index_Sub = subjectNo(i);
if index_Sub < 10
subjectID = ['20' num2str(ind... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Hamza Bourbouh <hamza.bourbouh@nasa.gov>
% Notices:
%
% Copyright @ 2020 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration. All
% Rights Reserved.
%
% Disclaimers
%
% No Warranty:... |
clear; clc; close all;
[a, b] = deal(-1, 0);
m = 25; % number of subintervals per dimension (per square domain)
fem_type = 1; % 0 for triangle and 1 for square
if ( fem_type )
[h, ne, n, coo1, con1, bounds1] = qfem_discretize(a, b, m);
else
[h, ne, n, coo1, con1, bounds1] = tfem_discretize(a, b, m);
end... |
function [ rho ] = sample_powercell_density( X, w, nu )
%SAMPLE_POWERCELL_DENSITY Sample the powercell density of V_i
% The powercell of a point set X with weights w is the set
% V_i^w = {x | ||x - x_i||^2 - w_i <= ||x - x_j||^2 - w_j, \forall j}
%
% This fn finds the density of all Voronoi cells against a given
... |
function [intensities finalVal numAtFloor] = simulateQuestRun(tActual, upperLimit, lowerLimit, q, numTrials)
% [intensities finalVal numAtFloor] = simulateQuestRun(tActual, upperLimit, lowerLimit, q, numTrials)
%
% Run one simulated QUEST procedure, determining an estimate of the
% psychophysical threshold.
%
% INPUT
... |
function [phi_K] = phi_kT(phi, time, T, Ts, A)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Time shifts phi k*T to the right in the given time vector
% Zero fills left and right when needed
% k = (0:1:2*A)
%
% INPUT:
% function phi,
% time vector,
% T constant,... |
close all
clear all
clc
N=5;
M=2;
fo=0.1;
n=0:N-1;
m=0:(N*M)-1;
x=sin(2*pi*fo*m);
y=x([1:M:length(x)]);
subplot(211)
stem(n,x(1:N));
subplot(212)
stem(n,y) |
% reset_data_analysis_environment
close all;
rmix=radial_r_value_flux(size_r-4)
PRECESS_LAMBDA_BIN_SIZE=0.02;
precession_lambda_bins=(41*PRECESS_LAMBDA_BIN_SIZE:PRECESS_LAMBDA_BIN_SIZE:60*PRECESS_LAMBDA_BIN_SIZE);
lambda_values=(41.5*PRECESS_LAMBDA_BIN_SIZE:PRECESS_LAMBDA_BIN_SIZE:59.5*PRECESS_LAMBDA_BIN_SIZE);
lam... |
function d_err = disp_error (D_gt,D_est,tau)
E = abs(D_gt-D_est);
E(D_gt<=0) = 0;
d_err = length(find(E>tau))/length(find(D_gt>0)); |
function [r sim] = model_simulate_baseline(m,s,r)
%% Simulate productivity shocks
%Initalize objects
ind_z_prod = zeros(s.N,s.T*(1+s.burn));
ind_y = zeros(s.N,s.T*(1+s.burn));
%Initialize productivity realizations at stationary distribution
%Input -> z_pi, stationary distribution of ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.