text stringlengths 8 6.12M |
|---|
disp('Running startup file, updated March 2018')
restoredefaultpath
cd ~/Desktop
%EXPERIMENT PATH - load your personnal libraries here
%functionPath = genpath('~/Google Drive/fonctions_MATLAB');
%path(path, functionPath);
%disp('Loaded path to your personal libraries.')
clear all
%Add Freesurfer path to the path
... |
function T=CovEst_transp(hatT,A,B)
% function T=CovEst_LMI(hatT,A,B)
% state covariance (Toeplitz covariance) matrix estimation via transportation/Hellinger
% distance minimization
if(norm(hatT-hatT')>.001||min(eig(hatT)<0))
error('Sample covariance must be PSD');
end
n=length(hatT);
if(nargin==1) %Toep... |
function T2 = rotateMatrixStress(angle)
%rotate matrix for stress, the rotate angle is in counter-clock direction
%3x3 [T2] is used as [T2].{sigma} to calculate stress in rotated coordinate
m = cos(angle); n = sin(angle);
T2 = zeros(3,3);
T2(1,1) = m*m; T2(1,2) = n*n; T2(1,3) = 2*m*n;
T2(2,1) = T2(1,... |
function [ w, F, S ] = OnlineFeat2(X, y, mf)
%OS Summary of this function goes here
% Detailed explanation goes here
p = size(X, 1);
n = size(X, 2);
w = zeros(p, 1);
F = 1;
F = F';
S = 1:n;
S = S';
for i = 2:p
res = zeros(n,1);
tau = n;
MAX_ITER = ... |
clc;
clear;
gaussdata;
epochs = 600;
n = 0.3;
[outSize, ndata] = size(targets);
nOut = outSize;
alpha = 0.9;
%Hidden layers
hidden = 15;
%delta-initialization
[insize, ndata] = size(patterns);
w = randn(hidden, insize+1) .*0.05;
v = randn(nOut, hidden+1) .*0.05;
dw = zeros(hidden, insize+1);
dv = zeros(nOut, hidden+1... |
function x_hat = ext_MSE(u, y, param)
x_hat = zeros(16,1);
coder.extrinsic('myStateEstimator');
x_hat = myStateEstimator(u, y, param);
end
|
kx=[];
RL1k=[];
DeltaMx=[];
wo=1;
Qrx=4;
for DeltaM=0:0.001:1
DeltaMx=[DeltaMx, DeltaM];
k=(1-DeltaM);
kx=[kx k];
RL1=[];
wRL=[];
for w=0.667*wo:0.001:1.33*wo
a=(Qrx*(w^2-wo^2))/(w*wo);
b=(1-k^2);
c=1/((b/a^2)+1);
d=k^2- (((1-k^2)^2)/a^2);
Rx=c+ ((sqrt(d))/((b/a^2)+1));
RL1=[RL1 Rx];
wRL=... |
clear
close all
format long
addpath(genpath('function'))
%% user input
tic
epsr = 4; %material permittiivity
L = 1; %flim length
L_perb = 0.0; %perturbation (if fourier space doesnt find feasible solution)
L = L + L_perb;
Nx = 75; %resolution
Nf = 25;
ND = 12; %num local power constraints
m = 1;
z = linspace(0,L,Nx);... |
function all_ids = dsp__get_trial_ids( obj )
if ( isa(obj, 'Container') )
inds = obj.get_indices( 'days' );
else inds = obj.getindices( 'days' );
end
cumulative = 0;
all_ids = nan( shape(obj, 1), 1 );
for i = 1:numel(inds)
fprintf( '\n Processing %d of %d', i, numel(inds) );
extr = obj(inds{i});
channels = un... |
function hyperObj = getRidgeHyperObj_grid(X, Y, obj, scoreObj)
hyperObj.name = 'ridge_grid';
% define grid
ssqs = Y'*Y/numel(Y);
lbs = [1e-3 0.1*ssqs]; ubs = [1e4 5*ssqs]; ns = [10 10];
hypergrid = tools.gridCartesianProduct(lbs, ubs, ns);
% set cross-val fold inds
nfolds = 5;
fold... |
function [ out ] = extraireCanal( input, canal)
%EXTRAIRECANAL extrait un canal d'une image
% Retourne une image où tous les canaux, sauf celui spécifié sont nuls.
% Création d'une matrice nulle similaire à input
out = uint8(zeros(size(input)));
% Copie du canal désiré de input dans out
out(... |
plotPositionStepShortLoaded;
figure;
plotPositionStep;
figure;
plotVelocityStep; |
% matlab -nodesktop -r main_cmd_sep15_m0m1_rand_1sp.m -logfile run.log
% nohup matlab -nodesktop -r "try, main_cmd_sep15_m0m1_rand_1sp_v2_all_part2;end;quit" -logfile run1013.log
% nohup matlab -nodesktop -r "try, main_cmd_sep15_m0m1_rand_1sp_v3_dec15;end;quit" -logfile run1215.log
% matlab -nodesktop -r "main_cmd_200... |
%% rename_FUNC_GLM
%
%
function rename_FUNC_GLM(subj, study)
%% Pathing
dir_subj = fullfile(study.path, 'data', subj.name);
dir_func_GLM = fullfile(dir_subj, 'FUNC_GLM');
dir_renamed = fullfile(dir_subj, 'FUNC_GLM_v1');
%% The lifting
if ~exist(dir_renamed, 'file')
movefile(dir_func_GLM, dir_renamed)
m... |
function save_image(img, well_name, save_dir)
[temp, parent] = fileparts(save_dir);
[temp, plate_name] = fileparts(temp);
[temp, assay_date] = fileparts(temp);
if exist(save_dir) == 0
mkdir(save_dir);
end
%Saving the images
well = strfind(well_name,'(');
if isempty(well) == 0
newname = [assay_date '_' plate_n... |
%% ES155 P7
%% Problem 3
%% 3.a
P = tf(1, [1 10 3 10])
S = 1000 * tf([1 1], [1 10])
L = P*S
figure(1); clf;
subplot(1,2,1)
bode(L)
subplot(1,2,2)
nyquist(L)
saveas(gcf, "ES155P7_3a.jpg")
pole(L)
[GainMargin, PhaseMargin, Wcg, Wcp] = margin(L)
%% 3.b
P = tf(100, [100, 101, 1])
S = tf([1 10], 1)
L = P*S
figure(2)... |
function out = lab5_integration()
% X = [0 5 10 15 20 25 30 35 40];
% Y = [0 6.67 17.33 42.67 37.33 30.1 29.31 28.74 27.12];
a = 0.3;
b = 0.7;
h = 0.025;
[X, Y] = generate_points(a, b, h);
area = solve_trapazoidal(X, Y);
fprintf('The area of the points is %d using T... |
#include "com_codename1_ui_URLImage.h"
const struct clazz *base_interfaces_for_com_codename1_ui_URLImage[] = {};
struct clazz class__com_codename1_ui_URLImage = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_ui_URLImage ,0 , &__GC_MARK_com_codename1_ui_URLImage, 0, cn1_class_... |
function [ dataStruct,timeAxisStruct,samplingInts ] = CreateDataStructure( files,paths )
% CreateDataStructure Creates structure variables for data and time axis
% from files entered as character input
% [dataStruct,timeAxisStruct,samplingInts] =
% createdatastructure(files,paths);
%
% ***** Author: AP ******
if iscel... |
function plotErrors(in)
for idx = 1:length(in.errors)
m_err.low(idx) = nanmedian(abs(in.errors(idx).low));
m_err.med(idx) = nanmedian(abs(in.errors(idx).med));
m_err.high(idx) = nanmedian(abs(in.errors(idx).high));
m_err.lowThigh(idx) = nanmedian(abs(in.errors(idx).lowThigh));
m_err.lowTmed(id... |
clear paramsAll;
clear params;
params.Gridjob.runLocal = false;
params.Gridjob.jobname = 'labelMeInput';
params.LoadLabelMe.catName = '05june05_static_street_boston';
params.LoadLabelMe.fileid = 1:185;
params.LoadLabelMe.outActFolder = 'labelMeInput';
paramsAll{1} = params;
clear params;
params.Gridjob.runLocal = fal... |
function [ output_args ] = TFcal( input_args,T,FT,fs )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
[a,b] = size(input_args);
FTs = FT*fs;
num = T/FT;
d = zeros(num,b);
output_args = zeros(num-1,b);
for c = 1:num
d(c,:) = sum(abs(input_args((c-1)*FTs+1:c*FTs,:)));
end
for c = 1:nu... |
function irp = bfact_intrepres(bmat)
%BFACT_INTREPRES Internal representation for sparse B matrix
% IRP = EPT.BFACT_INTREPRES(BMAT)
% Creates internal representation IRP from sparse matrix BMAT.
% This is used for MEX transfer.
[m,n] = size(bmat);
if m==0 || n==0 || ~issparse(bmat)
error('BMAT wrong');
end
% BVA... |
% add additional inputs after sensor if you want to
% Example:
% your_input = 1;
% estimate_pose_handle = @(sensor) estimate_pose(sensor, your_input);
% We will only call estimate_pose_handle in the test function.
% Note that unlike project 1 phase 3, thise will only create a function
% handle, but not run the function... |
function [ m ] = calc_moment( Hz , sample )
outside = 1 - sample;
g = calc_g(Hz);
g = g - sum(sum(g .* outside)) ./ sum(sum(outside));
g = g.*sample;
m = sum(sum(g));
end
|
function cellout = mat2cell_singleton (mat)
% mat2cell_singleton (ps-utils): mat2cell but cell has singleton entries
%
% 111219: Deprecated: use NUM2CELL. This function was first created for a
% very old version of matlab.
%
% function cellout = mat2cell_singleton (mat)
%
% Same as:
% mat2cell(mat, 1, ones (size(... |
function P2(m)
ans=zeros(m);
ax=1:(m-1)/2;
big=m-ax
small=1+ax
ans(small:big,small:big)=1;
disp(ans);
end |
%This test determines if the series is stationary or not.
%A value of 0 implies the series is stationary while 0 means the seires is
%non-stationary.
stationarity = kpsstest(Data) |
function [scc,pcc]=corrmyown(a,b,c,quietpls,plotit)
if nargin<5
plotit=false;
end
if nargin<4
quietpls=false;
end
if nargin<3
c=[];
end
if size(a,2)~=1&&size(a,1)==1, a=a'; end
if size(b,2)~=1&&size(b,1)==1, b=b'; end
if isempty(c)
idx=~(isnan(a)|isnan(b));
[scc,p_scc]=corr(a(idx),b(idx),'type','s... |
addpath(genpath(pwd))
% load individual data sets and save as structures
% stores data in folder "Structure Data". These can be deleted after
% running
convert2structLong( 'B1464run', 28 : 58 ) ;
% split each data channel into individual SL sweeps
% (note: important to use SL data for slip ratio and not SR )
% store... |
clear ; close all; clc
filename = 'Biomechanical_Data_column_2C_weka.csv';
formatSpec = '%f%f%f%f%f%f%C';
Data2 = readtable(filename,'Delimiter',',', ...
'Format',formatSpec);
fprintf('Decision tree For Data2\n\n');
%Take Data2 and split it into randomly selected 210 training instances and remaining 100 as te... |
% First baby timesteps in t-domain wave eqn BIE: known exterior Dirichlet BVP.
% Four different reps, output eps of max norms vs j, and videos of g, mu.
% Barnett 1/4/17-1/16/17, w/ Hagstrom, Greengard. 6/7/17 pred-corr.
% wobbly torus geom, 10/10/18.
% fsparse crashes for big probs (on desktop not laptop)
%rmpath ~/m... |
% Created by Xikang Zhang, 04/20/2013
% monkey main function, version 0.5
% implementation using class MK
% load detection log and plot
% perform data association
function mk_main5
addpath(genpath('C:\zxk\toolbox'));
addpath(genpath('C:\zxk\Research\code3.0.0'));
% fileName="";
inputFileDir1='C:\zxk\Research\monkeyD... |
%find the intersection of two lines, specified by a pair of points on each line
function point = GetIntersection(pair1, pair2)
line1 = polyfit(pair1(:, 1), pair1(:, 2), 1);
line2 = polyfit(pair2(:, 1), pair2(:, 2), 1);
%function searches near here
x = line2(2) - line1(2);
x = x / (line1(1) - line2(1... |
clc; clear; close all;
k = 1;
p = 2;
h=xlsread('filters.xls'); % import the analysis filters
f=xlsread('filters.xls'); % import the synthesis filters
t=0:1/(2*pi):60; % time interval
% creat an input signal which consists of four sinusoidal waves with differet frequencies
f_base=pi/8;
f1=0.5*f_... |
% This class creates Radiation objects for analyzing the electromagnetic
% radiant power that all matter emits, also referred to as radiometry.
% The objective of radiometry is to characterize the distribution of the
% radiation's power in space and time. A typical radiometric analysis
% would to be determine the... |
function index = find_angle_index_for_time(angles_with_time, time)
index = 0;
% diff = abs(angles_with_time(1,1) - time);
% for i=1:length(angles_with_time(:,1))
% if abs(angles_with_time(i,1) - time) <= diff
% diff = abs(angles_with_time(i,1) - time);
% index = i;
% end
% ... |
function [r,k,nneu]=get_neutnodes(nvt,nvn)
%
%[r,k,nneu]=get_neutnodes(nvt,nvn)
%nvt : Equation number for T/H
%nvn : Equation number for neutronics
%
%Example: [r,k]=get_neutnodes; gives r rows for the T/H
%and k kolumns for the neutronics
%@(#) get_neutnodes.m 2.3 02/02/27 12:09:52
global geom termo
ncc=ge... |
function gi = GausImg(sz,c,sigma)
%function gi = GausImg(sz,c,sigma,opts)
%
if(length(sigma) == 1)
sigma = [sigma sigma];
end
normler = ((2*pi)^.5 * (norm(sigma' * sigma))^.5)^-1;
gi = zeros(sz);
x = 1:sz(2);
y = (1:sz(1))';
x = exp(-((x-c(2)).^2/(2*sigma(2))));
y = exp(-((y-c(1)).^2/(2*sigma(1))));
gi = y*x;
|
clear all
local_dir=pwd
file_dir=strsplit(local_dir,'data_Script');
load_OrginalData_4by4
%-------------------------------------------------------------------------
fprintf('**********************************************************\n');
fprintf(' Now we Crate Original 4by4 Graphene Data \n');
fprintf('*********... |
function [p h] = predict(X,Theta1, Theta2,Theta3)
m = size(X, 1);
p = zeros(size(X, 1), 1);
h1 = sigmoid([ones(m, 1) X] * Theta1');
h2 = sigmoid([ones(m, 1) h1] * Theta2');
if(exist('Theta3','var'))
h = sigmoid([ones(m, 1) h2] * Theta3');
else
h= h2;
end
p = h >= 0.6;
end
|
clear
clc
filename = ' ';
running = 0;
N_iter = 1000;
lamda = 0.1;
N_vali = 10000;
Run_times = 50;
R_ini = 10; |
function bayesdegree = dataset1_bayes( trainset, testset, DEGREE)
trainlength = length(trainset.feature1);
maxFeature1 = max(trainset.feature1);
maxFeature2 = max(trainset.feature2);
maxFeature3 = max(trainset.feature3);
maxFeature4 = max(trainset.feature4);
maxFeature5 = max(trainset.feature5)... |
% Compute Normal Flow
function n_flow = computeNormalFlow(img1, img2)
if size(img1) ~= size(img2)
error('Image size not equal!')
end
[rows, cols] = size(img1);
fimg1 = gaussian_filter(img1, 1);
fimg2 = gaussian_filter(img2, 1);
fimg1 = im2double(fimg1);
fimg2 = im2double(fimg2);
% Temporal gradient
It = fimg2 ... |
function [z,w] = Stroud_Ck( n, m )
%
% This routine returns the Stroud quadrature points for Cn, n-cube.
% Such quadratures are exact for n-dimensional multiple integral
% in [-1,1]^n with polynomial integrants of degree up to P^m.
%
% Syntax: [z,w] = Stroud_Ck( n, m )
%
% Input : n, dimensionality of the space;
% ... |
clc;
clear all;
fs=400;
ts=1/fs;
t=[-0.1:ts:0.1];
x=0.5*sin(2*pi*15*t)+2*sin(2*pi*40*t);
N=400;
X=fft(x,N);
df=fs/N;
f=[0:df:df*(N-1)]-fs/2;
plot(f,fftshift(abs(X)));grid on; |
% Deactivate_Joystick - This is a gui script to deactivate the joystick
% ========================================================================
%
% Deactivate_Joystick()
%
% Description:
% This GUI is only used in the script Move_Robot_with_Joystick.
% It is just a button to deactivate the control by the ... |
function master_plotter(master_data)
%Authors: Alex Abulnaga, Sacha Welinski
%Date: 2019-08-15
%Title: band_plotter.m
%function overlap = master_plotter(xlimits,h,w)
%Description: Given master data containing [height, width, data],
% master_plotter plots each data entry as a function ... |
% Implementation of Linear Regression for IRIS Data Set %%%
%% Author: Raghuvar Prajapati %%%%
clear all;
close all;
data_1 = load('Iris_data_norm_train.txt');
data_2 = load('iris_data_norm_test.txt');
n=size(data_1);
m=size(data_2);
x1 = data_1(:,1:n(2)-1); # Load coloumns from 1 to n-1 in x1 from data_1
x2 ... |
% Domain extension
xleft=0;
xright=7.5;
% Cross sectional areas
S=1; %0.02;
% Physical paramaters
nul=1E-6;
rhol=1000;
mul=0.001;
nug=1E-5;
rhog=1.2;
dp=0.005; %
g=-9.81;
% Relative velocity model (1: UADE, 2: Schiller-Naumann, 3:Constant, V0)
VpqModel=3;
% UADE model Vpq=V0.*((alphaMax-min(alpha.internal,alphaMax... |
% 'src' and 'evt' are arguments passed automatically by the 'timer' objects,
% thus they need to be handled even if not used
%
function RunExperimentalPI( src, evt, tController, tTCPConnection )
%
try %
%
if( tController.bPrintDebugInformation )
%
fprintf('Entering Low Level Run()\n');
%
end;%
%
%... |
function w = g(z,f,h,xm,ym,varargin)
%z = Ym+1
w = z - h*f(xm,z,varargin{:})-ym; |
function [ occupancy ] = getOccupancy3D(occupancy_matrix, map_resolution, check_array)
% this function returns 1, if a point hits an obstacle, otherwise it returns 0
for n=1:size(check_array,1)
if occupancy_matrix(ceil(check_array(n,1)/map_resolution),ceil(check_array(n,2)/map_resolution),ceil(check_array(... |
clear
clc
close all
%% Get data
% Get Parameters
filedir = sprintf('%s', 'C:\Users\jhyu\Desktop\1\');
parfilestem = strcat(filedir,'acqu');
params.acqTime = readpar_Kea(strcat(parfilestem,'.par'),'acqTime');
params.bandwidth = readpar_Kea(strcat(parfilestem,'.par'),'bandwidth');
params.nrScans = readpar_Kea(strcat(p... |
%***********************************************************************%
%********************** State Estimation - A1 **************************%
%****** Evolutionary Programing - Elitist + Autoadapting Sigma**********%
%******************* Diogo Martins & Ines Trigo ************************%
%***********************... |
clear all
close all
load engDynamicNew
load econDynamicNew
tspan = 11:.001:17;
%%
econNAmp = zeros(1, 5);
econNMaxLoc = zeros(1, 5);
econEAmp = zeros(1, 5);
econEMaxLoc = zeros(1, 5);
engNAmp = zeros(1, 5);
engNMaxLoc = zeros(1, 5);
engEAmp = zeros(1, 5);
engEMaxLoc = zeros(1, 5);
for i=1:5
N = econDynamic{i}... |
classdef NATNET_CONNECTOR < CONNECTOR_CLASS
% motive = NATNET_CONNECTOR(param)
% param : HostIP, ClientIP
properties
result
rigid_list
end
properties (NonCopyable = true, SetAccess = private )
init_time % first getData time
max_in_marker_num = 50; % max num... |
function res_S = fNPV(S)
fx_pr = phi*x_pl;
revenue = M_pr*H/t_cycle*S - fx_pr;
dep=(1-slv)*CAPEX/(ny-2); % Depreciation rate (straight line)
profit = revenue - OPEX - dep;
taxes = max(0,profit*tx);
CF = profit - taxes + dep;
disc_cf = [-DB0 0 CF./(1+r).^(nyv(1:end-1)) (CF+SV+WC)/(1+r)^(nyv(end))];
disc_... |
function [Mnotes, notes] = notes2matrixnotes(notes,hopsize_secs)
notes=notes(notes(:,3)>0,:); %Remove 0-pitch notes.
Hend=round(max(max(notes(end,2)),max(notes(end,1)))/hopsize_secs);
maxj=size(notes,1);
i=0;
j=1;
f0=zeros(maxj,Hend);
while (i<Hend)&&(j<=maxj)
i=i+1;
t = i*hopsize_secs;
if (t>notes(j,1))&&... |
%---------------------------------------------------
% 20 SCANS (360deg) with a 18deg gap.
% Get the crossing points and distances along scan lines for the robot and all particles
%---------------------------------------------------
% ultraScan;
if (rotateBack == false)
r_scan_dist_1 = ultraScan_r(sensorMot, SENS... |
function c = affinityCross(input, i, j)
%AFFINITYCROSS Cross-affinity matrix.
% C = AFFINITYCROSS(LEVEL, I, J) returns the affinities among X(I,:) and
% X(J,:), where X = TVs at level L of the level object LEVEL.
%
% C a SIZE(X,2)-by-SIZE(Y,2) matrix whose elements are C(I,J) =
% c(X(I,:),Y(J,:)).
%
% This fu... |
function yhat = logfun(beta,x)
b1 = beta(1);
b2 = beta(2);
x1 = x(:,1);
yhat = (b1.*log(x1)+ b2 );
|
function [scaled_data, scalings, scaling_name_str] = scale(unscaled_data, uncentered_data, scal_crit, user_supplied_scaling)
% This function scales the data set.
%
% Input:
% ------------
% - unscaled_data
% an unscaled data set.
%
% - uncentered_data
% an uncentered and unscaled data set.
%
% - scal_cr... |
function rungekutta
h = 0.05;
t(1) = 0.0;
w(1) = 1.0;
ye(1)=1.0;
fprintf(' Step 0: t = %12.8f, w = %12.8f\n', t, w);
for i=1:20
k1 = h*f(t(i),w(i));
k2 = h*f(t(i)+h/2, w(i)+k1/2);
k3 = h*f(t(i)+h/2, w(i)+k2/2);
k4 = h*f(t(i)+h, w(i)+k3);
w(i+1) = w(i) + (k1+2*k2+2*k3+k4)/6;
t(i+1) = t(i) + h;
fprintf('Step... |
function [x,iter]=D_ADMM_H( y,H,miu,method, eps)
%D_ADMM A Derivative-Space alternating directional method of mutipliers for TV-based image restoration
% The method is designed based on the ALM
% The constraint d=Dx requires d lies in the irrotatioanl subspace V.
% According to the definition of curl of a ... |
%MIT License
%Copyright (c) 2019 Sherman Lo
%CLASS: MAD MODE NULL FILTER
%See superclass EmpiricalNullFilter
%Does the empirical null filter, makes use of ImageJ and multiple threads
%Replaces empirical null std with median around the mode x 1.4826
classdef MadModeNullFilter < EmpiricalNullFilter
methods (Access ... |
function Aout = timefilter(Ain,nframes)
%TIMEFILTER Apply moving average to a time dependent matrix.
%
% Aout = timefilter(Ain,nframes) apply a zero-phase forward and reverse
% digital filtering (filtfilt) to a time dependent (3D) matrix Ain, over
% the range of frames specified by nframes. This practically does ... |
function output = HandleEventPoint(p,lines,MaxLength)
RB = Red_Black_Tree_Lines(p,MaxLength);
RB.Insert(Node(p));
flag = 0;
for i=1:length(lines)
if(lines(i).Y1 > p.Y1 && lines(i).Y2 < p.Y1)
RB = RB.Insert(Node(lines(i)));
flag = 1;
end
end
... |
function compareDatabanks(actDb, expDb)
assertTol = @(a) assert(all(a(:)<=1e-14));
listOfFields = fieldnames(actDb);
for i = 1 : length(listOfFields)
ithName = listOfFields{i};
x = actDb.(ithName);
y = expDb.(ithName);
d = max(abs(x(:) - y(:)));
assertTol(d);
end
... |
% Reference:
% Bokai Cao, Xiangnan Kong, Jingyuan Zhang, Philip S. Yu and Ann B. Ragin.
% Mining Brain Networks using Multiple Side Views for Neurological Disorder
% Identification. In ICDM 2015.
%
% Dependency:
% [1] Xifeng Yan and Jiawei Han.
% gSpan: Graph-Based Substructure Pattern Mining. In ICDM 2002.
%... |
function [ c, R, Vec] = Hough_transform( I, c_pca, R_pca, Vec_pca, threshold )
% Application of the hough transform to get the precise elements of the
% ellipsoïde : center (line), size of axis R (line), and directions Vec
% (lines normalized)
% I is the image of probabilities to be in the nodule
% c_pca is the center ... |
% Expanding and finding lapalacian
I=im2double(imread('yos1.jpg'));
n=3;
for i=1:n
I_reduce=reduce_func_LK(I,1);
I_expand=expand_func_LK(I_reduce,1);
if(size(I)~=size(I_expand))
I=imresize(I,size(I_expand));
end
I_laplacian=I-I_expand;
figure,imshow(I_laplacian);
I=I_reduce;
end |
function angl = mvlpmc(uic1,uic2)
% Script for nom angle
% Called by mvlvm
global mpgb1 mpgdtmu mmggamma
if get(uic2,'Value') == 1 ;
set(uic2,'BackGroundColor','white') ;
if max(abs(imag(mpgb1))) > 100*eps ; % Imag component
angl = mmggamma*(mpgdtmu/1000)*sum(abs(mpgb1))*360 ;
else ; % Only real
angl = mmggam... |
function out = recog_expt(distMAT,actions,trials)
% actions = 8;
% trials = 2;
winsize=1;
confusion_mat = zeros(actions);
for test_run = 0:trials-1
A = 1:actions*trials;
B = find(mod(A,trials)==test_run);
testing = B;
A(B) = [];
training = A;
for i = 1:length(testing)
... |
% routine
clear
nit = 1000;
x = zeros(nit,1);
y = zeros(nit,1);
z = zeros(nit,1);
for i = 1:1000
clear BM
BM = BernoulliMixture(2,50);
BM.OrthCondition = 0.5;
BM.CPgap = 0.01;
BM.sparsity = 0.1;
BM = PGen(BM);
BM = lambdaGen(BM);
BM.nsample = 2000;
BM = CMGen(BM);
BM = DKeiggap(... |
function [c, usedSizes] = divideTasksForMachines(nMachines, dimensions, func)
% solves an n-subset problem: divide a vector v = func(dimensions)
% into nMachines sets in order to have the same sums
c = cell(1,nMachines);
sizes = func(dimensions);
usedSizes = zeros(1,nMachines);
[sortSizes, sizesIdxs] = sor... |
%% Inference in undirected version of sprinkler network
% Compare to sprinklerDGMdemo
%#testPMTK
dgm = mkSprinklerDgm();
ugm = convertToUgm(dgm);
model = ugm;
false = 1; true = 2;
C = 1; S = 2; R = 3; W = 4;
mW = marginal(model, W);
assert(approxeq(mW.T(true), 0.6471))
mSW = marginal(model, [S, W]);
asse... |
function output = doubleTide(const,OPT)
% Function used in morfacTide.getSignal
% Inputfields are defined in morfacTide.getSignal()
% Function returns a Mx3 array with fields [frequency,amplitude,phase]
% [(cyc/hr) ,(m) ,(degree)]
% NOTE: harmonic boundary conditions i... |
function model = elmTrain_loo(x, y, activationFcns, numHiddenNeurons, rndseed)
%
% Extreme Learning Machine training phase with LOO as criterion.
% Train neuron by neuron, and ensemble with Jackknife model averaging
%
% Input:
% x
% y
% humHiddenNeurons
%
% Output:
% model model whi... |
function y = MF(X, d)
%MF is a classic target detection algorithm.
% Assume n is the number of the pixels,
% d is the number of the bands.
%
% Then,
% X should be a n*d matrix,
% D should be a 1*d matrix.
m = mean(X, 1);
X = X - m;
d = d - m;
R = X' * X;
R_ = pinv(R)... |
%script to plot flight trajectories from NASA dataset
close all
load '../../spectral/hsmmSpectral/dataNorm.mat'
N = length(data);
%visualize trajectories
f1 = figure;
for i=1:N
load(data{i});
%select part of flight from takeoff to landing
ind = zeros(size(PH.data))';
ind(startInd(i):endInd(... |
function movie = analyze (movie)
% ANALYZE extracts the necessary header information
% File Labels
JUNK = [74 85 78 75];
RIFF = [82 73 70 70];
AVI = [65 86 73 32];
avih = [97 118 105 104];
strf = [115 116 114 102];
movi = [109 111 118 105];
idx1 = [105 100 120 49];
db... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% IQM Tools - PopPKPD Example
%
% SCRIPT_04_Model_PK_Base
% -----------------------
% The purpose of this script is to build a popPK base model, based on the
% given dataset.
%
% IMPORTANT: This template assumes a standard popPK analys... |
%Xt1 posição inicial: x, y e o angulo de orientação teta [x y teta]
%Ut é um vetor com as velocidades linear e angular [v w]
Xt1 = [0 0 0];
Ut = [1 0];
Xt1 = [0; 0; 0];
Ut = [1;0];
%alfa = [2 2 2 2 2 2] * 1e-4;
alfa = [2 2 2 2 2 2] * 1e-1;
tempo = 2;
X_inicioEfim = []; % Vetor para as coordenadas x ... |
I=ones(300,600,3);
% figure,imshow(I);
r=150;
c=300;
for i=1:300
for j=1:600
p=r-i;
b=j-c;
x=p/b;
x=round(atand(x));
dist=sqrt((c-j)^2+(i-r)^2);
dist=round(dist);
if(dist==75)
I(i,j,1:2)=0;
end
if(mod(x,15)==0 && dist... |
clear all
clc
% clf
%% outline
% plot the all atom int
% find the out range points
%% load data
load Mat_016_cluster_3_20Dia_int.mat dat_En dat_in
load Mat_find_err_big_near_ind.mat ind_tr_320 en_er
% plot index and name
load Mat_int_name.mat
n_bod=length(bod_na);
n_ang=length(ang_na);
n_dia=length(dia_na);
d... |
function pic = nolimscolor(IV1,IV2,d)
%IV1=imread('p1.jpg');
%IV2=imread('p2.jpg');
row1=size(IV1,1);
line1=size(IV1,2);
%d=171;
w=linearr(d);
GP1=zeros(row1,line1,3,'uint8');
GP2=zeros(row1,line1,3,'uint8');
GG1=IV1;
GG2=IV2;
GI1=zeros(row1,d,3,'uint8');
GI2=zeros(row1,d,3,'uint8');
%将两幅图的重叠部分分别放入GI1,GI2
... |
% Get ROI data
%ROI_data_to_workspace
%Menu('Export (untouched)')
load('/Users/jan/Documents/Projects/imlook4d/Test data/DAD/imlook4d_ROI_data.mat');
% Cref
ref_roi = 97;
disp( [ 'Cr = ' imlook4d_ROINames( ref_roi) ]);
Cr = imlook4d_ROI_data.mean( :, ref_roi)';
% Caudate + Putamen both side
range = 75:78;
Ct = i... |
function series_force = return_series_force(obj,series_extension,time_step)
% Function returns force in series element
if (time_step<eps)
series_force = obj.series_k_linear * series_extension;
else
series_velocity = (series_extension - obj.last_series_extension)/time_step;
series_acceleration = ((seri... |
function runPhaseX(runParams)
global LCONE_ID
global MCONE_ID
global SCONE_ID
% Load/Recompute connected mosaics and the optics
recomputeConeMosaic = ~true;
recomputeOptics = ~true;
% mRGC mosaic: whether to re-generate it
recomputeRGCmosaic = true;
% mRGC mosaic: whether t... |
function [Q,res] = MultiScaleIsoWaveAnalysis(A,num_scales,ha,hd,prefilter)
%
% function [Q,res] = MultiScaleIsoWaveAnalysis(A,num_scales,ha,hd,prefilter)
%
%
% multiscale isotropic wavelet analysis.
%
%
% INPUTS
% ------
%
% A image to process
%
% num_scales number of scales
%
% ha approximati... |
clear;
generate_data;
B = 1000; %Number of permutations
sig_level = 0.05; %significance level
tic
for d = 1:length(alpha_2)
for i = 1:length(m_list)
[d i]
m = m_list(i);%sample size of X-sample
n = n_list(i); %sample size of Y-sample
for j = 1:T %trial times
... |
function recall_1 = recall(pred,Y)
n=length(Y);
tp=fn=0
printf("%d",1);
i=1;
r=1;
while(r<=4),
while(i<=n),
x=pred(i)
if(Y(i)==x)
tp+=1;
else if(Y(i)==r && x!=r)
fn+=1;
endif
i+=1;
end
printf("recall")
if(tp+fn>0)
tp/(tp+fn)
else
printf("0\n")
endif
r++
end
i=1;
r=1;
tp=fp=0
wh... |
%% Path setup for the color statistics project
clear global;
global logFileRoot;
% host-dependent paths
[a, host] = system('hostname');
logFileRoot = getPathName('logs');
path3rdParty = getPathName('code', '3rd_party');
pathMyCode = getPathName('code', 'mycode');
pathUtils = getPathName('codeUtils');
pathUtilsPrivat... |
function [J grad] = logCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
%NNCOSTFUNCTION Implements the neural network cost fun... |
function synctest()
synchKey = KbName('t');
% gKey = KbName('g');
% rKey = KbName('r');
% yKey = KbName('y');
% bKey = KbName('b');
x=1;
% while x==1
% [ keyIsDown, timeSecs, keyCode ] = KbCheck(-1);
% if (keyIsDown)
% if (strcmpi(KbName(keyCode),'r')==1||strcmpi(KbName(keyCode),'y... |
function [iris,pupil,out]=find_iris(I,rmin,rmax)
[ci,cp,out]=thresh(I,rmin,rmax);
iris.x0 = ci(2);
iris.y0 = ci(1);
iris.r = ci(3);
pupil.x0 = cp(2);
pupil.y0 = cp(1);
pupil.r = cp(3); |
function runPhaseXI(runParams)
% Figure exports dir
figExportsDir = runParams.exportsDir;
stimulusType = 'drifting gratings';
switch stimulusType
case 'drifting gratings'
visualizedSet = 'data and fit';
plotChromaticTuning(runParams, figExportsDir,visualizedSet );
... |
classdef RSCode
% RSCode class: allows encoding and decoding using a Reed-Solomon code
%
% Author: Johannes Van Wonterghem, Jan 2017
%
% See the static test() method for an example usage of this class
properties
m; % GF(2^m) field
n; % Code length
k; % Infor... |
function q = chisqq(p,v)
%CHISQQ Quantiles of the chi-square distribution.
% Q = CHISQQ(P,V) satisfies P(X < Q) = P, where X follows a
% chi-squared distribution on V degrees of freedom.
% V must be a scalar.
%
% See also CHISQP.
% Gordon K Smyth, University of Queensland, gks@maths.uq.edu.au
% 27 July 1999
% Referen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.