text
stringlengths
8
6.12M
function [pathDay,pathNight]=terminator(lat1,long1,time,lat2,long2) % A new terminator program based on getting just the solar elevation angle % along the path instead of the intersection with the actual terminator % Can take in multiple values for lat2/long2 for a given value of % lat1/long1 % % Written By: Michael...
%% Stelling 5 % % De onderstaande code wordt zonder fouten uitgevoerd: % % ======= Code ======= % clc % clear variables % for nHerhaling = 1:10 ...
% Read XCAT clear all close all clc %fid = fopen('MengPhantom1_atn_1.bin'); % change filename %phant = single( fread(fid,'single') ); % read entire phantom into a vector %phant = reshape(phant,281,512,601) ; % reshape % load '1_mm_pelvis.mat'; % load 'DistortedPelvisPhantoms.mat'; % It includes Pelvis1,2,3,4 (300...
function sampleTASMaxSeries %% % A series of TAS (Temperature of Air Surface) yerly maxima is useful to understand how heat waves evolve (Alessandro Dosio, jrc). % It is a series of yearly maxima, therefore it is fit for a GEV analysis, while a GPD analysis is meaningless. %% addpath('../'); dt = load('timeAndSeries...
%% let's see if I know what's going on with Fourier stuff... N = 101; a = 1/2; b = 1/8; x0 = 1; x1 = -1/16; x = linspace(-1, 1, N); f = zeros(1,N); f(abs(x) < a) = x0; f(abs(x) < b) = f(abs(x) < b) + x1; figure; plot(x, f); %% Fourier coefficients k = 100; fk = x0./(pi*(1:k)) .* sin(pi * a * (1:k)) + ... x1./(p...
function PWGraph(basedir, modes, num, duration) % bytes per second f = figure l={}; for m = 1:length(modes) switch modes(m) case 1 d='ae'; draw='r.-.'; l = {l{:} 'Authentication and encryption'} case 2 d='auth'; draw='g*-'; l = {l{:} 'Authentication'} case 3 d='crc'; draw='b+...
%QT_UNIT Create unit quaternion % % Syntax: % q = qt_unit(u,angle) % % In: % u - 3x1 vector representing axis of rotation or % N unit vectors as 3xN matrix % angle - Rotation angle in radians or N angles as % 1xN matrix % % Out: % q - Rotation quaternion in form [s;v] % or N quate...
% Define path to folders root = pwd(); scripts = [root '/ComplementaryScripts']; data = [root '/ComplementaryData']; % Check whether RAVEN is installed if ~exist('ravenCobraWrapper.m') warning(['RAVEN does not seem to be installed. For model curation, '... 'you are advised to install RAVEN Toolbox, wh...
function correlation=MetricsCorrelation(N,S,R,E,w) %%function to measure the correlation between atypicality and novely c=corrcoef(N,((S*w(1)+R*w(2)+E*w(3))/(w(1)+w(2)+w(3)))); correlation=c(2)^2;
function [ffdata] = readdofsFF(fullfilename,ffdata) % % readdofsFF.m % % Read FreeFem++ DOFs from .dat file. % % inputs: fullfilename > full path (e.g. sthg like: fullfile(pathname,filename)) % % disp 'readdofsFF' tic; uxy = load(fullfilename); u = uxy(:,1); % [0,1,2,3,4] for p,u,v,w,rho x = uxy(:,2)...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 本函数为策略运行按钮的callback。运行策略等到买卖清单,运用买卖清单计算 % 各类指标, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [output,StrategyExample] = runstrategy_callback(h,popupmenu_Input,handle,radio13,handle_push,Configure) % 清...
function Volatility=ImpliedVolatility(aSpot,aStrike,aTime,aOption,aIsPut) sigma=0.2; value=100 + aOption; myExpiry=((169000-aTime)+3600*24*daysact('13-jun-2016', '16-sep-2016'))/(3600*24*252); while any(value-aOption) > 1e-9 [call, put] = BlackScholes(aSpot,aStrike,myExpiry,0,sigma); if aIsPut==1, val...
function results = RBES_look_around(str_arch) jess reset; jess batch ".\\clp\\look_around_rules.clp"; jess(['bind ?f (assert-string "' char(str_arch) '")']); ff = jess('modify ?f (source yes)'); jess focus LOOK-AROUND; jess run; archs = SMAP_retrieve_archs(); ind = cellfun(@(x)isequ...
load('/Users/jannisborn/Dropbox/GitHub/TNM_project/data/behav_analyzed_hgf_newpriors/subject_18.mat') x = subject.behav.css.input; % cue-stimulus-contingency %y = subject.behav.css.response_aversive; %HGF_input_seq = sigm(subject.hgf.sim_neutral.traj.mu(:,2)); %y = HGF_input_seq; y=sigm(sim_2.traj.mu(:,2)); %% clc pi...
function X = rfft(x,len) % RFFT calculates the spectrum of a real valued time series % % X = rfft(x) % X = rfft(x,len) % % Performs a FFT on real valued x vectors or matrices. The symmetric part of the % transform is cut and only one half is preserved. % For len see FFT. % Klaus Hartung (hartung@aea.r...
% $Header: svn://.../trunk/AMIGO2R2016/Kernel/AMIGO_ranking_exp.m 770 2013-08-06 09:41:45Z attila $ function [r_par_rank_index,r_y0_rank_index,r_rank_mat,r_sorted_par_rank_mat,r_sorted_y0_rank_mat,... par_rank_index,y0_rank_index,rank_mat,sorted_par_rank_mat,sorted_y0_rank_mat]= ... AMIGO_ranking_e...
%% Create signal: main_tx_sdr; %% USRP PARAMETERS Fs = 3.125e6; Fc = 2.3e9; TxGain = 70; %% setup USRP % check connected boards; htx = comm.SDRuTransmitter(); % B210 htx.Platform = 'B200'; htx.SerialNum = '313191B'; htx.MasterClockRate = 12.5e6; htx.CenterFrequency = Fc...
function [data, source_signal, Asignal] = gen_data(T, D, N, K, snr, ssnr, samesignal, samenoise, pink, distr) % generate data as linear mixture of K correlated components and background noise % % T: number of time samples % D: number of sensors % N: number of subjects/viewings % K: number of correlated dimensions...
function DAG = get_degree_assortativity_per_month(Aframes,ACTIVE) months = length(Aframes); DAG = zeros(months,1); for m=1:months A = decompress_adjacency_matrix(Aframes{m}); A = A(ACTIVE{m},ACTIVE{m}); DAG(m) = assortativity(A); end end
[num,text,all] = xlsread('MS-9'); m = all(:,2); n = m(2:length(m)); for i = 1:length(n) if (n{i} == 'P') x(i,:) = 1; else x(i,:) = 0; end end dim = size(num); precision = []; recall = []; accuracy = []; ix = 1; for t = 0:.05:1 idx = randperm(dim(1)); nu...
function gcodeCoordinates = createGcodeCircle(center, radius, normalDirection, spacing, startZ, endZ, startX, endX, layerNum) perimeter = 2*radius*pi; spcingNum = round(perimeter / spacing); firstPoint = center; gcodeCoordinates = zeros(spcingNum+1, 4); Zspacing = (endZ - startZ)/spcingNum; Xspacing = (endX - startX)...
%% By generating random number, create color image %% Code % generate R, G, B R = rand(200, 350); G = rand(200, 350); B = rand(200, 350); % Adjust number from 0 to 255 by multiplying 255 to R, G, B R = R * 255; G = G * 255; B = B * 255; R = uint8(R); G = uint8(G); B = uint8(B); ColorImage = cat(3, R, G, B); figure...
function [ slope,offset,score,t,vars] = ortho_robust_coeff( PTS ) % Gives the slope fitting the cloud of points PTS % Pts is as : % x1 x2 x3 ... xn % y1 y2 y3 ... yn % Uses robust orthogonal fitting % S. Dmitrieff 2015 t0=pi/2; t=fminsearch(@(t) out_of_lineness2D(PTS,t),t0); [score,~,res,unres]=out_of_lineness2D(...
Img=imread('white_house256.jpg'); imshow(Img) title('original image') [M,N]=size(Img); n=zeros(1,256); for k=0:255 for i=1:M for j=1:N if Img(i,j)==k n(k+1)=n(k+1)+1; end end end end p=n./(M*N); plot(0:255,p,'.') title('The normalized histogram of original...
% Read free field or small field NATRAN input file and convert to cell structure data model % Anthony Ricciardi % % Inputs % filename = [string] text file input in ZAERO format % % Output % FEM [cell] input file data % function FEM = importFieldModelAdvanced(filename) fid = fopen(filename); %% Entries e...
%% 1 pendinit eig(Afc) %not stable in thetha thethaprim ctrb(Afc,Bfc) rank(ans) %Controllable eig(Afc-Bfc*[-7.5343 -1.3465 0 -0.2216]) % not stable in theta ????? ask %% elips ar=sqrt(0.62^2+9.4^2); ar=ar*0.7; br=sqrt(0.19^2+2.5^2); br=br*0.7; alfar=atan(9.4/0.62);
function results = showErrorStatistic(yReal,yPre,errorType) %% % Show the statistical results of errors between real and predicted outputs; % [num, n1]= size(yReal); n2 = size(yPre,2); if n1 ~= n2 error('Dimentions of Matrices are not matched!'); end switch errorType case 'MSE'; for i=1...
%% Begin eye tracking ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Eyelink('Message', 'TRIALID %d', puupCount); Eyelink('StartRecording'); WaitSecs(0.1); Eyelink('Message', 'SYNCTIME'); %Mark zero point on EyeLink file eye_used = -1; Screen('FillRect', el.window, el.backgroundcolour); Screen('TextFont', el...
function [mu00,mu10,mu01,mu11,mu20,mu02,mu21,mu12,mu30,mu03]=momentos_centrales(I) [m00,m10,m01,m11,m20,m02,m21,m12,m30,m03]=momentos_no_centrales(I); global center xm=m10/m00; ym=m01/m00; center = [xm ym]; u=m00; mu00=m00; mu01=0; mu10=0; mu20=m20-u*xm^2; mu11=m11-u*ym*xm; ...
% Data Analysis Version 1.7 % Updated November 13,2017 clear clc close all % Load in the completed variable mat file % inputting assignment title AssignName = input('Please input assignment name','s'); NameString = sprintf('%s_RESULTS.txt',AssignName); load('ALLDATA.mat') diary(NameString) % Renaming Variables Total...
%%% Model first developped by of Scranton & Vasseur 2016 (Theor Ecol.) %%% Script by Picoche & Barraquand 2017 %%% This function computes the growth response to temperature function growth = growth_response(tau) global a_r_tau0 tau0 E_r k growth=a_r_tau0*exp(E_r*(tau-tau0)./(k*tau*tau0)); end
function testControls % Leaves out the sensor network and just tests the controller and % simulation of the Pursuer/Evader dynamics. Similar to PEGSimMain. % % Put this file in the main simulator directory (or make sure your paths % are set properly) to run it. % % remember to comment out any SN intialization/use (ex....
function [smap] = saliency_ittikochniebur(input_image,image_path) gbvs_install % get saliency map: smap = ittikochmap(input_image); smap=smap.master_map; end
function [J, grad] = costFunctionReg(theta, X, y, lambda) %COSTFUNCTIONREG Compute cost and gradient for logistic regression with regularization % J = COSTFUNCTIONREG(theta, X, y, lambda) computes the cost of using % theta as the parameter for regularized logistic regression and the % gradient of the cost w.r.t. ...
function p=chi(x) % x 是一幅图像 % 检测卡方分析的函数 n=sum(hist(x,[0:255]),2);% 矩阵按行求和,hist求频数,得到的是一个列向量 h2i=n([1:2:255]);% 取奇数 h2is=(h2i+n([2:2:256]))/2; filter=(h2is~=0); % 过滤器 k=sum(filter); % 统计不是0的 idx=zeros(1,k); % 生成数组 for i=1:128 if filter(i)==1 idx(sum(filter(1:i)))=i;% 计算当前有多少1 end end r=sum(((h...
function printResults(se, s) [SDR, SIR, SAR, perm] = bss_eval_sources(se,s); % fprintf('SDR target: %0.4fdB\n', SDR(1)); fprintf('SDR Interference: %0.4fdB\n', SDR(2)); % fprintf('SIR Target: %0.4fdB\n', SIR(1)); fprintf('SIR Interference: %0.4fdB\n', SIR(2)); % fprintf('SAR Target: %0.4fdB\n', SAR(1)); fpri...
close all clear all clc data = readtable('0015_20 Experimental Data graphs.xlsx','Range','A1:T100'); noRead = [1,2,3,4,5,7,8,11,12,13,14]; data(:, noRead) = []; dataArray = table2array(data); c=1; for i = 1:3:99 L3 = [dataArray(i,2) dataArray((i+1),2) dataArray((i+2),2)]; Ave3L= mean(L3); AveL(c) = Ave3L...
function [ y ] = averagevalue7( x ) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here y = zeros; y(1) = (1/3)*x(1); y(2) = y(1) + (1/3)*x(2); y(3) = y(2) + (1/3)*x(3); for i = 4:length(x) y(i) = y(i - 1) + (1/3)*(x(i) - x(i - 3)); end end
function [ H, corresp ] = homography( corresp1,corresp2 ) corresp = zeros(4,1); for i = 1:4 corresp(i)= randi([1,size(corresp1,1)],1); end X=zeros(size(corresp,1),2); X1=zeros(size(corresp,1),2); for i=1:size(corresp,1) X(i,:) = corresp2(corresp(i),:); X1(i,:) = corresp1(corresp(i),:); end...
clc clear all format long T = [10,20,30]; % Simulation Time dt = 0.01; % Time Step tau=[0.1,.5,1]; % Refractory Period rup = 0.5/dt; % For leaving the Up State rdn = 1-rup; % For leaving the Down State sigmaup = 1; % Up State sigmadn = -1; % Down State ...
% % matlab file InfantDataForwardSelectionMethod % % Author1: Jesus G Cruz-Garza (jesusc90@gmail.com) % Author2: Zachery R Hernandez % Date: April 2014 % % Function : Forward Selection of EEG Channels that contribute the % most to classification. % % Description: Identify and...
trellis(1) = struct('ub',0,'lb',0,'state','unvisited','supporters',[2,3]); trellis(2) = struct('ub',0,'lb',0,'state','unvisited','supporters',[4,5]); trellis(3) = struct('ub',0,'lb',0,'state','unvisited','supporters',[4,5]); trellis(4) = struct('ub',0,'lb',0,'state','unvisited','supporters',[6,7]); trellis(5) = struct(...
clc; clear all; close all; x = [1 2 3 4]; N = 4; x=[x,zeros(N-length(x))]; i=sqrt(-1); w = exp(-i*2*pi/N); n=0:N-1; k=0:N-1; nk=n'*k; W = w.^nk; X = x*W; ax = abs(X); wx = angle(X); disp(x); disp(X); w1 = exp(i*2*pi/N); W1 = w1.^nk; ix = (1/N)*X*W1; disp(ix); subplot(4,1,1); stem(n,x); s...
%% % Filename: m3dof_jacobian.m % Desc: calculates the body Jacobian for the planar 3DOF robot % INPUT: % q (3x1): joint angles in radians % l (3x1): length of the links % OUTPUT: % J (3x3): body Jacobian expressed in base frame % % 2015 alessandro.giordano@dlr.de %% function [J] = m3dof_jacobian(q,l) %...
function [ newobj ] = getByIndex(obj, idx) %GETBYINDEX 从已有Ticks里拿出idx对应的条目 % 标量不变,只对时间序列取idx对应条 % 类似于 b = a( a>0 )的用法 % 例子 newtks = tks.getByIndex(tks.last > tks.askP(:,1) ) % 注:tks.latest 放弃, .data, .data2, .headers放弃 % 程刚;20140726 % 程刚,140829;使用这个写法: newobj.(fd) = obj.(fd); newobj = Ticks; %% 标量fields flds =...
function g = gplvmgradient(params, Y, X) % GPLVMGRADIENT Gradient of likelihood with respect to parameters. global SQRT % Tells us to optimise in sqrt of theta space dataDim = size(Y, 2); numData = size(Y, 1); lntheta = params(end-2:end); if nargin < 3 latentDim = (length(params) -3)/numData; % We must have to ...
clear all h=read_hdr('perf001.hdr'); c = read_img2(h,'perf001.img'); curve = []; for count=1:11 str=sprintf('perf%03d.img',count) t=read_img2(h,str); p=t-c; %curve = [curve; mean(mean(mean(p(28:36,28:36,1:end)))) ] curve = [curve p(20,35,5)] subplot 211,show(p(:,:,5)); subplot 212,show(t(:,:,5)); pause end
function inputPaths = savePaths4mayaviRGBchu(varargin) % fileName, inputPaths %function [x, y, z, s, connections] = savePaths4mayavi(fileName, paths) % % input: struct % or cell of struct if length(varargin) == 1 % default output file name fileName = '~/f'; inputPaths = varargin{1}; else ...
% YDEFAULT is the default value for an action (e.g. the value for 'no-action') function [bnet,engine] = learnBNetOrderK(traces,XSIZE,YSIZE,ORDER,YDEFAULT) VARS = XSIZE*ORDER + YSIZE*ORDER; data = []; for i = 1:size(traces,1) tmp = load(traces(i,:)); for j = 1:ORDER-1 firstrow = tmp(1,:); for...
function vdoc_as_post(name) % scan the optimization output files for new values and update the workspace % make vinf global and define drivetrain switch global vinf drivetrain=vinf.drivetrain.name; % print parameter for debugging debug=0; % 1==> writes additional output to command window, 0==> no debug printing if e...
function imOut = enhance_brightenVessels(im) % quick'n'dirty % we clip the "foreground" of Otsu's threshold output (above level) % this in practice seems to produce better segmentation results, but we % have to see about the robustness of this % One slice if length(size(im)) == 2 ...
%This function creates the specified variable in the specified nc file. If %it already exists in the file, this function returns an error. In that %case, call overwrite_nc_variable to overwrite the original variable, which %does not return an error if the variable didn't exist in the first place. %Takes in the number...
function [xvals,yvals] = ImportTracks(file, wormUIDs, tracklength, numworms, altcamxvals) %ImportTracks - Modular function that will import the x and y coordinates %of individual worm tracking data from an excel spreadsheet. % Required Inputs: % file = name of excel spreadsheet containing the tracking data in %...
%{ reso.Align (imported) # motion correction$ -> reso.ScanInfo --- nframes : int # actual number of recorded frames fill_fraction : float # scan fill fraction (see scanimage) raster_phase : float #...
% % Estimated size of dominating set vs. number of hops % addpath ./spgl1-1.9/ ./progress_bar run('./gspbox/gsp_start.m') set(0,'DefaultAxesFontSize',13); G = gsp_minnesota(); %G = gsp_sensor(1000); G.A = double(full(G.A)); Gcopy = G; Nhops = 10; progBar = ProgressBar(Nhops, 'UpdateRate', 0.5); size_D = zeros(Nhop...
function mcmc_iterator % A script to iterate loops of the oyster model mcmc code % Open matlabpools for parallel processing if matlabpool('size') > 0 matlabpool close force local end matlabpool open 3 % Model types to be passed to the mcmc code % Mortality type Mn = {'Con','Con','Con','Con','Region','Region','R...
function [F,J] = costgrad_lsqnonlin_projs_trispect_4tensor(x, x_lists, L,... M12_quants, M34_quants, m4_micro, m3_micro, m2_micro, m1_micro, lambda, L_cutoff, gamma) % parse optimization variable: % gamma = x(end); % a_lms = x(1:(end-1)/2) + 1i*x((end-1)/2+1:end-1); a_lms = x(1:end/2) + 1i*x(end/2+1:end); a_lms = ...
% visim_plot_semivar_mul(V,name,cax) function visim_plot_semivar_mul(V,name,cax) %V{1}=read_visim('visim_25_geomod.par'); %V{2}=read_visim('visim_25_geomod_unc.par'); %name{1}='cond'; %name{2}='uncond'; ang=[0 90]; tolerance=15; isim=1:2; col{1}=[0 0 0]; col{2}=[1 0 0]; col{3}=[0 0 1]; col{4}=[0 1 1]; lstyle{1}=('-')...
function [x,fval,exitflag,output] = assgn_code_pattern_search_ga(x0,lb,ub) % This is an auto generated MATLAB file from Optimization Tool. % Start with the default options options = psoptimset; % Modify options setting options = psoptimset(options,'SearchMethod', { @searchga [] [] }); options = psoptimset(options,'Di...
% compile the kernel mex -g ./core/kernel.cpp ./core/afbs.cpp ./core/app.cpp ./core/utils.cpp ... ./core/task.cpp % addpath addpath('./toolbox/')
% Enum for the type of control mode of myomuscle actuators % % Author : Dominic Chan % Created : 2019 % Description : classdef MyoControlModeType enumeration LENGTH FORCE ACCEL end end
function [PCs]=cchengPCA(HIM,M) %% Code Comments: %PCA does what PCA does best %Should consider to sue the built-in MATLAB PCA version % % There are two parameters,cchengPCA(HIM,M) where the HIM is the % Hyperspectral image cube, which is a 3-D data matrix % [XX,YY,bnd] = size(HIM), XX YY are the image size, % bnd is t...
function [W,L,U,pcol,P] = fzmult(A,V,transpose,L,U,pcol,P); %FZMULT Multiplication with fundamental nullspace basis. % W = FZMULT(A,V) Computes the product of a % a fundamental basis for the nullspace of full row-rank % matrix A, Z, times matrix V; W = Z*V. % Assume A is m-by-n with m<n, rank(A) = m. % ...
function [ sig_rs ] = Cci( bar, tp_per, md_per, const, type) % 该函数输出 CCI 的强弱信号以及 CCI 的数值 % CCI 刻画了股票是否有超买或者超卖现象,属于动能指标 % 输入 HighPrice,LowPrice,ClosePrice 分别是当日最高价,最低价,收盘价; % 输入 tp_per 为 tp 计算移动平均时的天数 % 输入 md_per 为 md 计算移动平均时的天数 % 输入 const 为计算系数 % 输出 sig_rs 为指标的强弱信号,为 1,-1,分别为买入,卖出建议 % 输出 cci 为指标 cci 的数值 % 输入参数的预处理...
function [ OptPositions,OptPnl,OptAction,OptLambda] = LinearSearch(p,spread,beta,Step,Start,End) %LinearSearch Summary of this function goes here % Detailed explanation goes here % In % p,spread,beta,Step,Start,End % % Out % OptPositions,OptPnl,OptAction,OptLambda % %%%%%%%%% OptLambda = -1; O...
% This setup program is used to load experimental data, certain model % parameters, and initial conditions for simulation. %clear; format short e; define_global; % This script defines global variables. %% Loading experimental data % These are experimental data from physiological hearts under different % work rates. ...
function init() %-------------------------------------------------------------------------- % 802.11a Konstanten % %-------------------------------------------------------------------------- % global ThresholdPacketDetection global FractionDetected global WindowPacketFindSmooth global MinimumPacketSize global...
% Door gambling task - Split Redo neg according to following choice 08/02/2017 % updated 05/07/2017 % + splitting 121, 122, 141 matching trial count across conditions, per sbj % + extended sample % (recovering high-no (1422) sbjs 10, 15, 24 (17 exclude...
function run_testing_grad(config_filename) fprintf('load %s\n', config_filename); eval(config_filename); addpath('../../util'); addpath('../../util/metrix_mux'); method = sprintf('yang13_%s_data%d_grad_LR%d_HR%d_corner%d_center%d_nn%d_lambda%s', ... parameter.training_dataset, ... ...
function varargout = Exp(Operation,Global,input) % <problem> <MOP in IntelligentBuildings> % IntelligentBuildings for Evolutionary Multi-Objective Optimization % operator --- PIO switch Operation case 'init' %三个服务的组合 Global.M = 3; Global.D = 3; ...
function [word, answer_word] = give_words() answer_word = []; % % Horizontal word{1} = []; word{2} = []; word{3} = []; word{4} = []; word{5} = []; word{6} = []; word{7} = []; word{8} = []; word{9} = []; word{10} = []; word{11} = []; word{12} = []; word{13} = []; word{14} = []; word{15} = []; word{16} = []; word{17} =...
% CMPU250 - Professor Eric Aaron % HW2 - Kyle Patterson % April 2018 % #################################################################### % ### ### % # ...
function [image_matrix_class, prob_plot] = run_classificationv2(config, cnn, ar_size, scale_factor) %%This function creates the pooled image %%ar_size: The iwndow size so the classification works %%mu and sigma train come from calculating the zscore in the classifier %%Create the matrix filename = config.data{2}; strfi...
function voxel_infomation_array = ... Voxel_size_information_from_struct( nii_struct ) %This function returns all the voxel size infomation in the sturct. - Have %newly apted to cope with sturcts mad from Dicom_loader_for_pipleine %The input is the sturct of the nii file %The output is an array of voxel si...
% Parameter selection function [bestnfactors,bestnloadings,bestperformance,pergrid] = opt_parameters( X, Y, nfac, nload ) bestperformance = -inf; bestnfactors = []; bestnloadings =[]; pergrid = []; for iload = 1:size( nload, 2 ) [ bestnfac, bestper, allper ] = loo_hoplsc( X, Y, nfac, nload(:,iload) ); if be...
function [siz, rat] = imgSizFit(siz0, sizMa) % Adjust the figure size to fit with the maximum size constraint but keeping the ratio. % % Input % siz0 - original size, 1 x 2 % sizMa - maximum size, 1 x 2 % % Output % siz - new size, 1 x 2 % rat - ratio % % History % create - Feng Zhou (zhfe9...
% run('init') G = tf([Ko],[T1*T2 T1+T2 1],'InputDelay', To) z=c2d(G, 0.5, 'zoh') % step(z) % step(G,'-',z,'--')
function car = Construct_car(pos_x, pos_y, vel_x, vel_y, accel, lane_id) % Construct structure of a single car % pos_y = {0, 3.6} setGlobal; car.x = pos_x; car.theta = pos_x / Params.road_radius; car.y = pos_y; car.vx = vel_x; car.vy = vel_y; car.a = accel; car.lane_id = lane_id;
clear all load('F:\Documents\MATLAB\Data\KDD\NSL-KDD Dataset\Processd with R\NSL-KDD Preprocessed_5Class_Target.mat'); %% Normalization % before normalizing we must replace NaN whit 0 KDD_Training_p_num_5class_target(isnan(KDD_Training_p_num_5class_target)) = 0; KDD_Test_p_num_5class_target(isnan(KDD_Test_p_num_5class...
clear all; x1=[0 1 1 1]; y1=[0 0 0 1]; z1=[0 0 1 0]; plot3(x1,y1,z1,'b.','MarkerSize',20); x2=[0 0 0 1]; y2=[0 1 1 1]; z2=[1 0 1 1]; hold on; plot3(x2,y2,z2,'r.','MarkerSize',20); grid; %----------------1ά-------- clear all; w1_o=[0 1 1 1;0 0 0 1; 0 0 1 0]; w2_o=[0 0 0 1;0 1 1 1;1 0 1 1]; a=[1/2 1/2 sqrt(2)/2]; w1_n=a*...
function PlotIterations(polynomialCoefficients, iterationValues) %Make a plot of the function xMinRange = min(iterationValues) - 0.1*min(iterationValues); xMaxRange = max(iterationValues) + 0.1*max(iterationValues); resolution = 0.01; plottingRange = xMinRange:resolution:xMaxRange; functionValues = Polynomi...
function [] = AnalyzeEEG_DynBin_Mseq(subj,Aud_channels,Num_noiseFloors,Keep_H) %subj = subject ID %Aud_channels = channels to analyze %Num_noiseFloors = # of noise floors %Keep_H = amount of time of impulse response to keep ITD_pow20 = []; IAC_pow20 = []; load('Mseq_4096fs_compensated.mat') Mseq_ITD = Mseq_sig; fs =...
function rp = close_open_run_RAS (... RASversion, files, RAShide, sett) % obvious % % Param : RASversion, integer, 3 digits long, e.g. 507 for % HEC-RAS 5.0.7 % % Param : files, Files_ obj % % Param : RAShide, boolean, true = hide HEC-RAS computation % window, not working yet, due to a Ras controller iss...
% PhotometryInitialize intializes the data acquisition session to read % photometry input (J33/AI1 and GND J67/AIG) - note that this is split from % the photoreceiver, with the other line going into the oscilloscope % global session % our global variable to store everything % add our rotary encoder to the ses...
% use the following to setvars for this script: pnev_manual_comp_setVars % define vars_1 and vars_2 as either ref or toMatch %%%%%%%%%%%%%%%%%%%%%%%%%%% Matching ROIs and plotting traces %%%%%%%%%%%%%%%%%%%%%%%%%%% orderPlot = 'qualityOrder'; % 'consecOrder'; 'randOrder'; 'qualityOrder'; % at what order you want...
function [sac sacd]= getML_saccade(fn,recompute) % get saccade metrics % returns (columns): % 1 - Drift during fixation along the direction of motion % 2 - sd of eye positions along motion direction during fixation % 3 - sd of eye positions in the orthogonal direction to the motion axis during fixation % 4 - Sa...
% SHIFTS q OVER A LOCALISED PLANE (X-Y LOCAL COORDS) IN 3D function q_shift_vector = mls3D_calculate_q_shift(q_shift_vector, H_q, H_projected_points, weights, h ) upper_bound = h/2; lower_bound = -h/2; %% X-TARGET SHIFT X_q_shift = q_shift_vector(1); X_H_q = H_q(1); X_H_projected_points = H_projected_poi...
function [area,nmach_a,arear,nmach_ar] = ex_group(grouping) % Syntax: [area,nmach_a,arear,nmach_ar] = ex_group(grouping) % % Purpose: Find the coherent machine groups using the slow % eigensubspace matrix. The number of coherent % groups is not restricted to be equal to the % number of colum...
function [head hattr prof pattr] = sdr2rtp_h5(f) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Read hdf5 file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [prof pattr] = readsdr_rtp(f); % test if the file is high or low res [vchan, ichan] = make_cris_grid(888,0); if(size(prof.robs1,1)>=numel(vchan)) error...
function F = makeibforce(varargin) % function IB = makeibforce(fxltot,fyltot,fxrtot,fyrtot,fxmtot,fymtot,fxntot,fyntot, ... % fxrmus,fyrmus,fxlmus,fylmus,fmusPr,fmusPl,actl,actr,... % fxsp,fysp,energy) % or makeibforce('base') % or makeibforce(S) % % Helper function to make an IBforce struct...
function image = InvVectorQuantizer(qImage, clusters, block_size) % Function Name : VectorQuantizer.m % Input : qImage (Quantized Image) % clusters (Quantization clusters) % block_size (Block Size) % Output : image (Dequantized Images) [qh, qw, qd] = si...
function screenTimes = VRcheckscreenTimes(VRdata, screenTimes) screenTimes2 = sort(VRdata.TRIAL.time(:)); maxTime = min(find(isnan(screenTimes2)))-1; screenTimes2 = screenTimes2(1:maxTime); screenTimes = screenTimes; display('WARNING!!!! temporary fix. Check the photodiode signalling'); screenTimes = screenTimes'-sc...
close all %Plot the sym6 wavelet function % Set number of iterations and wavelet name. % iter = 10; % wav = 'sym6'; % % Compute approximations of the wavelet function using the % % cascade algorithm. % [phi,psi,xval] = wavefun(wav,10); % figure(22); % subplot(1,2, 1); % plot(xval,psi); % title('Symlet 6 Wavelet Fu...
function A=fRotx(t) A=[ 1 0 0 0 cos(t) -sin(t) 0 sin(t) cos(t) ];
function es = combineTwoVRseries(es1, es2, FcatSpikes) if nargin < 3 FcatSpikes = false; end % function to combine two VR experiments. % Created AS 2011 % Combines the following fields: %. 'screenTimes2' %. 'sortIDX' %. 'screenTimes' %. 'sampleRate' %. 'sampleTimes' %. 'trialID' %. 'tra...
function[] = setfont(fs); %setfont(fontsize) % %this function sets the font of everything in the figure to fs hf = get(gcf); HA = get(gcf,'Children'); for i=1:length(HA) ha = HA(i); a = get(ha); if isfield(a,'FontSize') set(ha,'FontSize',fs) end if isfield(a,'XLabel') ...
function [] = load_Decadal_instruments() load instruments_measurements load attrib_correspondance load names % fid = - 1; % filename = []; % filepath = []; for instr = 1:length(names) instr_name = names{instr}; indexes1 = find(~strcmp(instruments_measurements(:,2,instr),'None')); indexes2 = find(~strcmp(ins...
function [MSE,MAE] = ay_mse(Xc,Xs,Pxx) % This function calculates the Mean Squared Error - and Mean Absolute Erro - between Prediction and % Correct one % Input: % 1.Xc, is the unobserved X (correct one) % 2.Xs, is the distribution sample points % 3.Pxx, is the estimate probability distibution of Xc...
% This programs tests RBF for a given function %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ % GENERATE THE I/O PATTERN %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ n1=1; p1=1; for i=0:45:360 AngleX=i*pi/180; ...
function addToNIDWT(n) global nidwt; if isempty(nidwt) nidwt = n; else nidwt = nidwt + n; end end