text
stringlengths
8
6.12M
function makeTuples( obj, key ) key = rmfield(key,'stim_idx'); [imrz, wrf, matrix] = fetch1(StatsImagesParams(key),'imresize','wrf','matrix'); if strcmp(wrf,'yes') % get traces of all neurons of a site and fps if ~isempty(RFFit(key)) [snr, gfit] = fetchn(RFFit(key),'snr','gauss_fit'); else ...
function result=my_funct_2(a,b,c,x) result=a*x^2+b*x+c; %代入(a,b,c,x)可得答案 %以上是函數你知道的
global saveProcess saveProcess = false; PD_classification_offset; saveProcess = true; close all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Training Online Classifier %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% classifier = build_classifier_online(training,... 'nbFeatures2Select',params.params_classifie...
classdef CNN < handle & NetworkLayer %Convolutional Neural Network based on Mathworks's default filter2 %------------------- %TODO: larger stride? %------------------- %input is width*height*num_channels*num_data %output is width*height*numunits*num_data properties ws; numunits; ...
function varargout = astar_jw(varargin) % astar_jw - A* implementation by Jeremy Wurbs % % This function is an implementation of the A star algorithm. It is meant % to be an implementation resource for you when trying to learn the A* % algorithm. To help you dissect this function, you can call astar_jw % without arg...
% % XXXXXXXXXXXXXXXXXXXXXXXXXXX sus_determine_new_mf_no XXXXXXXXXXXXXXXXXXXXX % % % % Author : Susanti % % Date : Aug 1 2014 % % Function : % % Syntax : sus_determine_new_mf_no(data_struct, data_value) % % % % Algorithm - % % XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
% This code solves the model of Graham and Wright (2010, JME) % Using two equation system: % c_{t} -E_{it} [c_{t+1} - (1-beta*(1-delta))*r_{kt+1}] = 0 % r_{kt} = (Pa(z)/Q(z))*a_t + (Pc(z)/Q(z))*c_t % Solve for Full Information Equilibrium (only aggregate part, with % aggregate TFP shock) % Use Algorithm 3 based on E...
% File: ExternalTrigger.m @ ExternalTrigger % Author: Urs Hofmann % Mail: hofmannu@biomed.ee.ethz.ch % Date: 26.05.2020 % Description: defines the structure of an external trigger % TODO: check all sets for correct values before passing them on to class classdef ExternalTrigger < handle properties extMode(1, 1) ...
% 2.1 dogrusal spline yontemi % % ex: 4 noktamiz olsun: P1, P2, P3, P4 % % P1(x1,y1) --- P2(x2,y2) --- P3(x3,y3) --- P4(x4,y4) birlestirirsek ve % % P1 ve P2 aras?ndaki dogruyu f1=ax+b % P2 ve P3 aras?ndaki dogruyu f2=cx+d % P3 ve P4 aras?ndaki dogruyu f3=ex+f % % varsayarsak, ortaya 6 tane denklem cika...
% a nice way to do transformations clear; clc; P = [0,1,1,0;0,0,1,1]; A = [1,1;0,1]; Ptran = A*P; % make a transformation of P with A subplot(1,2,1); fill(P(1,:),P(2,:),'red'); axis([-3 3 -3 3]); axis square subplot(1,2,2); fill(Ptran(1,:),Ptran(2,:),'green'); axis([-3 3 -3 3]); axis square
dirlist = dir('/Users/Pranav/Desktop/dicomimages/*.dcm'); X = length(dirlist); pause_time = 2 for i = 1:X Y = dicomread(strcat('/Users/Pranav/Desktop/dicomimages/',(dirlist(i).name))); fprintf(dirlist(i).name); disp(' ') Av = mean2(Y) max(Y(:)) min(Y(:)) disp(' ') disp(Av) SD = std2(...
function [ l_corr ] = prepare_vmode(labels,label_id ) %returns the label correlations [n_ids,n_labels] = size(labels); o_labels = setdiff(1:n_labels,label_id); %o_labels = 1:n_labels; l_corr = labels(:,o_labels); end
function varargout = ToArray(boldData, dataStr) %TOARRAY - Pull numeric data arrays from a BOLD data object. % This function converts a BOLD data object to a numeric array by returning specific data sets that it pulls out of % the object. It is intended for use as a shortcut alternative to constantly dot-indexing t...
function plotrbezier(B,w,t) %narišemo poligon plot(B(:,1),B(:,2),'-o'); axis equal hold on %narišemo krivuljo %dobljenje točke na krivulji D = rbezier(B,w,t); plot(D(:,1),D(:,2)); hold on %Farinove točke [n,d]=size(B); q= zeros(n-1,d); for i=1:(n-1) q(i,:) = w(i)/(w(i)+w(i+1)) * B(i,:) + w(i+1)/(w(i)+w(i+1))*B(...
function v = space(xy) % xy is size [ns, 2] % returns squared distance matrix, size [ns, ns] v = squareform(pdist(xy, 'euclidean')).^2; end
function [P] = deim(U) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Routine: Discrete Empirical Interpolation Method (DEIM) % Input: U = orthonormal basis % Output: P = index matrix %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% P = zeros(size(U)); [~,in...
function [ u_d, time ] = locregp( N, n, alpha, sn, bigt, t, A, bmat, f_d, c, number ) %LOCREG_P 2D local regularization with Poisson or mixed noise % N = 256; % n = 4; % % Slightly smaller than this, probably % alpha = 0.000015; % ell = 1; % % u = 10*rectangularHump(N,0.2,0.8) + 220*rectangularHump(N,0.22,0....
function [ output_args ] = Promedio( input_args ) %Promedio de una imagen % Programa que lee 4 imagenes especificas, una sin turbulencias y 3 con % distintos niveles de turbulencia. Sacaremos promedio de nuestras 3 % imagenes turbulentas para comparar la eficacia de un promedio entre % estas para disminuir esta...
function obj = modelSaveImgToFile(obj,saveFile,thisFigName,thisFigNo,thisFileID,varargin) % Saves the current open figure to a file. % Biafra Ahanonu % branched from controllerAnalysis: 2014.08.01 [16:09:16] % inputs % % outputs % % changelog % 2021.08.10 [09:57:36] - Updated to handle CIAtah v4.0 switch t...
function fusion_map = updateFusionMapWithProjMap(fusion_map, updated_map, h, w, proj_flag) %==== TODO: Merge the updated map with the remaining part of the old fusion map ==== % Write your code here... fov_idxs = proj_flag; update_pts_flat = reshape( permute(updated_map.points,[3 2 1]), 3, h*...
function Solar_Intensity(imgFile, outfile, lightIntensity) im_out = imread(imgFile); % Take the complement of the image im_out = imcomplement(im_out); % Convert to gray im_out = rgb2gray(im_out); % Create and save the colormap to outfile f = figure('visible','off','PaperPositionMode','auto'); %imshow(im_out, 'Border','...
function z=zad1_redlich_kwong_2mix_mixrule(p,t,pc1,tc1,pc2,tc2,x1,x2) %t=temperatura [K], p=ciśnienie [Pa] r=8.3144;u=1;w=0; % a1=0.42748*r^2*tc1^2.5/pc1/t^0.5; b1=0.0866*r*tc1/pc1; % a2=0.42748*r^2*tc2^2.5/pc2/t^0.5; b2=0.0866*r*tc2/pc2; % a=(x1.*sqrt(a1)+x2.*sqrt(a2)).^2; b=x1.*b1+x2.*b2; % A=a.*...
function[xk, times] = reconst(DFT_coef, N, fs) DFT_Nlength = zeros(N/2+1,1); DFT_Nlength(1:length(DFT_coef)) = DFT_coef; [xk, times] = comp_iDFT(DFT_Nlength, fs); end
function [new_results,new_archs] = merge_results(archs1,results1,archs2,results2) new_archs = [archs1;archs2]; names = fieldnames(results1); new_results = results1; for i = 1:length(names) values1 = getfield(results1,names{i}); values2 = getfield(results2,names{i}); setfield(new_results,names{i},[values1;va...
function [fitobj, f, dfdx, fp] = fit_hyperbolic(Xin, Yin) % FIT_HYPERBOLIC computes the parameters of the hyperbolic function that % fits the input data % [FITOBJ F DFDX FP] = FIT_HYPERBOLIC(XIN,YIN) takes the independenet % variable vector XIN and the dependent variable vector YIN and computes % the parameters of a h...
function M = npend_alphas_Lagrange_M_3(in1,in2,in3,g,in5,in6,in7) %NPEND_ALPHAS_LAGRANGE_M_3 % M = NPEND_ALPHAS_LAGRANGE_M_3(IN1,IN2,IN3,G,IN5,IN6,IN7) % This function was generated by the Symbolic Math Toolbox version 8.1. % 05-Dec-2018 15:52:12 I1 = in1(1,:); I2 = in1(2,:); I3 = in1(3,:); L1 = in2(1,:); L2...
function Y = generateY(n, table, ground) % n is number of nodes % table is the matrix yij % ground is the admittance to ground vector % Y_ij = -yij if i != j % Else = yi + sum admit = generateAdmittance(n, table); Y = zeros(n,n); for i = 1:n for j = 1:n if i == j % if o...
%LABWHEEL A set of colors from a circle in CIELAB color space % RGB = CLAB_WHEEL(N,L) finds a set of N colors equally spaced in % CIELAB space in a circle using CIELCHab co-ordinates. The circle is % taken anti-clockwise with constant lightness of L, and contant chroma % which is the maximum possible such that ...
%TASK 1 Regression % Importing Data X = concretedata_x; %Features for Extraction Y = concretedata_y ; %Target Vector %Visualising the Data %Refrence https://www.mathworks.com/help/matlab/titles-and-labels.html figure,boxplot(X,'Notch','on','Labels',{'Cement (component 1)',... 'Blast Furnace Slag (com...
function semlogx2(x,y,s) if (nargin<3) s='y'; end maxgrid=150; nticks=9; stdoct=[100 200 500 1000 2000 5000 10000 20000 50000]; %minstdoct=min(stdoct); %maxstdoct=max(stdoct); maxx=max(x); minx=min(x); if (minx == 0) minx=x(2); n_grid=maxgrid-1; else n_grid=maxgrid; end; %if (minx == ...
function get_current=E4P_Conv2double(OBJ) objClass=class(OBJ);%get the class of the object [char] switch objClass case {'char'}%in case type 'str' or 'char' get_current=str2num(OBJ); case {'cell'}%in case of cell array if ischar(OBJ{1,1}) get_current=str2num(OBJ{1,1}); else ...
function [MODE,FRQ,TMM,XX,YY,ZZ,KAKOM]=MAIN(FRQ0,NEIG) % DYNAMIC PROBLEM OF 3-DIMENSIONAL BEAM STRUCTURE % ++++++++++ data input ++++++++++++++++++ % [XX,YY,ZZ,KAKOM,NFREE,TEISUU,KOTEI]=DATAIN4; [XX,YY,ZZ,KAKOM,NFREE,TEISUU,KOTEI]=DATAIN3; NELT=size(KAKOM,1);NODT=size(XX,1); if NODT==1 NODT=size(XX,2); else...
%% General Time Series Plotting Script - separate plots version % This script can be used to generate a variety of time series plots % This version creates two separate plots for sequential date and DOY % Can also turn on histogram plot and save (end of script) % Author: Valerie Pasquarella %% SET code directories %...
function analyzeDataBySubjectName(subjectName) %function analyzeDataBySubjectName(subjectName) % % Example: analyzeDataBySubjectName('CNSU_0001') % This function analyzes the data collected for a subject. % The subject information is recovered from 'subjectName.mat' in the folder % /Users/vijaysingh/Dropbox (Aguirre-Br...
% original data folder hrdir = '/scratch/mfr/DIV2K/DIV2K_train_HR/'; % configuration p = 128; % stride stride = 16; fnum = 1; files = dir([hrdir '/' '*.png']); savedir = 'train'; % 3 channels h5create([savedir '/hr.h5'], '/data', [p p 3 Inf], 'Datatype', 'single', 'ChunkSize', [p p 3 1]); for k = 1:length(files) ...
function [ FM ] = Focus(i,vid) %UNTITLED Summary of this function goes here % Detailed explanation goes here %vid = videoinput('pointgrey', 1, 'F7_Mono8_808x608_Mode0'); %src = getselectedsource(vid); %vid.FramesPerTrigger = 1; %preview(vid); I = getsnapshot(vid);%rgb2gray(imread('Capture1.jpg')); %imshow(I); FM = f...
%% Gets all histogram data from all files set(0, 'defaultTextInterpreter', 'LaTeX') set(0, 'defaultLineLineWidth', 4) set(0, 'defaultLegendInterpreter', 'LaTeX') addpath ~/bbtools/automate/matlab; ROOT_DIR = cd('~/scratch/triply_per'); % Read in file starting and ending times % ignore 500-4 % 1500-4,5 % ...
function detail = selfCreateData(StockCode,BeginDate,EndDate) s=datenum(BeginDate,'yyyymmdd'); e=datenum(EndDate,'yyyymmdd'); T=datestr((s:1:e)','yyyymmdd'); detail=[]; for i =1:size(T,1) detail = [detail ;GetStockTick_Web(StockCode,T(i,:))]; end
function X_out = tmprod(X,U,mode) %TMPROD mode-n tensor-matrix product. [I,J,K]=size(X); [M,N]=size(U); if (mode~=1) && (mode~=2) && (mode~=3) error('The input variable mode should be 1, 2 or 3') end if N~=size(X,mode) error(['The number of columns of the input matrix should be equal to dimension ',int2str(mod...
% Static force analysis of 3-bar non-minimal tensigrity prism (Fig 3.43 of Skelton & de Oliviera 2009) % By Shuhang Zhang, UC San Diego student 2019. clear; clf; clc; figure(1); % Free [Q=Q_(dim x q)] and fixed [P=P_(dim x p)] node locations a = 1; h = 3; Alpha = pi/6; Q(:,1)=a*[ -1; 0; 0]; Q(:,2)=a*[ cos(pi/3); sin(...
%function signs = firstTry(I) clear; close all; %% validationSet = [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67]; %validationSet = [39 41 43 45 47 49 51 53 55 57 59 61 63 65 67]; %validationSet = [1]; % for N = 1:length(validationSet) % Current sign id nSi...
classdef SelectiveSearchSegmentation < handle %SELECTIVESEARCHSEGMENTATION Selective search segmentation algorithm % % The class implements the algorithm described in [uijlings2013selective]. % % ## References % [uijlings2013selective]: % > Jasper RR Uijlings, Koen EA van de Sande, Theo Gev...
classdef OptStructureTools methods function obj = OptStructureTools() end end end
function filter_upd=retro_update_local_before_ko(filter_retro,filter_upd,Nhyp_i,p_d,H,R,z,i,gating_threshold,Nx,Nz,ko,Lscan) %Local hypotheses update for OOS measurement update. Case %non-present/present, when the time of birth corresponds to ko %Author: Angel Garcia-Fernandez p_s1=filter_retro.p_s1; t_bi=filte...
function allmode2=feemd_post_pro(Y,Nstd,NE,numImf,runCEEMD,maxSift,typeSpline,toModifyBC,randType,seedNo,checksignal) % Post-processing of fast EMD/EEMD/CEEMD code % Author : Yi-Hao Su, IANCU [imf] = eemd(Y,Nstd,NE,numImf,runCEEMD,maxSift,typeSpline,toModifyBC,randType,seedNo,checksignal); allmode = imf'; xsi...
#Exemplo aula 27-08 #rand(2,12) gera uma matriz com 2 linha e 12 colunas #rand gera apenas valores entre 0 e 1 #para ter uma rand entre [10,13] basta 3* rand(2,12) + 10; Nexp = 1e6; X = rand(1, Nexp); # de -0.1 a 1.1 com passo 0.1 xbins = -0.1:0.01:1.1; histograma_X = hist(X,xbins); pdf_x_simul = histograma_X / t...
function [D,Ddiod] = LBCN_convert_NKnew(fname, path_save,downsample,exclude) % Function to convert NK data from edf to SPM format. % Inputs: % - fname: name of file to convert. if empty, a selection window opens. % - path_save: path to save the new file. if empty, same path as file. % - downsample: 1 to downsample dat...
function [ec, Vc] = VWN(p, n) A = 0.0310907; % Eh if n == 3 b = 13.0720; c = 42.7198; x0 = -0.409286; elseif n == 5 b = 3.72744; c = 12.9352; x0 = -0.10498; end x = (3/(4*pi*p))^(1/6); xi_x = x^2 + b*x + c; xi_x0 = x0^2 + b*x0 + c; Q = sqrt(4*c - b^2); eta = atan(Q/(2*x+b)); if p < 1e-15 e...
function plotpoints(w,X) xl = min(X(:,2)):0.1:max(X(:,2)); yl = -(w(2)*xl+w(1))/w(3);
function scans_to_process = LONG_extractVolumes( scans_to_process,scantype ) %LONG_extractVolumes - extract WM/GM/CSF/TIV and add to scans_to_process %structure % % Syntax: scans_to_process = LONG_extractVolumes( scans_to_process,scantype ) % % Inputs: scans_to_process - array of objects of class LONG_participant, %...
function [VmMat, KeqMat] = genKineticParamsLin( AdjMat, DistrType, DistrParam ) %genKineticParamsLin generates kinetic parameter matrix for network of %linear reactions % % VmMat = genKineticParamsLin( AdjMat, DistrType, DistrParam ) takes the adjacency % matrix AdjMat of metabolites and generates the matrix of corres...
function c = get_bad_days() c = {'day__05172016', 'day__05192016', 'day__02142017'}; end
function [trainData, validData] = sampling(data, p, type) trainData.header = data.header; validData.header = data.header; if type == "random" N = size(data.x,1); n = floor(N*p); i = randperm(N,N); train_i = i(1:n); test_i = i((n+1):N); ...
function A_k = cerinta1(image, k) %Functia care rezolva cerinta1 A = imread(image); A = double(A); [m n] = size(A); [U S V] = svd(A); A_k = U(:, 1:k) * S(1:k, 1:k) * (V(:, 1:k))'; A_k = uint8(A_k); end
%% Generate cross validation curves for HFcvglmnet % Results for iterative lasso using HFcvglmnet has to be loaded first! clear; close all; %% Load the data label = 'TrueFaces'; load(['JLP_HF_' label '.mat']) %% Plot the CV curve for subject i, iteration j % % specify the parameters % subNum = 1; % numIter = 1; % % ...
clear all close all clc p = -1; %y = m x + p where y(-1 1) x(0 999) from rfduino z(-2^14 2^14) m = 2/999; delete(instrfind({'Port'},{'COM15'})) ser = serial('COM15','BaudRate',115200,'InputBufferSize',200); ser.ReadAsyncMode = 'continuous'; fopen(ser); qC = [1,0,0,0];qD = [1,0,0,0];qA = [1,0,0,0];qB = [1,0,0,0];qE = [1...
%% timer_start : put before loop function time_elapsed = timer_start() tic; time_elapsed = 0; end
function [ X_ Y_ ] = get_mini_batch( X, Y, n ) %GET_MINI_BATCH Summary of this function goes here % Detailed explanation goes her indices = randperm(size(X,2)); tmp = repmat(ceil(size(X,2)/n), 1, n-1); reste = size(X,2) - tmp(1,1) * (n-1); tmp(n) = reste; Y_random = Y(indices,:); X_random = X(:,indices); Y_ = ma...
function [svm_model, knn_model] = trainer_feature_extraction() %% Image training and finding eigenfaces imagelist = dir('image_set'); noOfFile = length(imagelist); noOfImage = (noOfFile - 2); imagelist = imagelist(3:noOfFile); disp(noOfImage); imageSet = cell(1, noOfImage); current_di...
%% % This script solves optimisation of the scenario-tree based model % predictive control. The dynamic system considered is the standard % spring-masss system. %% % Generation of the system clear all; close all; clear model; clc; Nm=5; % Number of masses T_sampling=0.5; ops_masses=struct('Nm',Nm,'Ts',T_sampling,'xmin...
function insertDialog(pb,src,event) idh.fig = figure('position',[600 600 550 250]); hTop = uiextras.HBox('Parent',idh.fig,'Spacing',3); vLeft = uiextras.VBox('Parent',hTop,'Spacing',3); vRight = uiextras.VBox('Parent',hTop,'Spacing',3); set(hTop,'Sizes',[-1 -5]); % Animal, Slice, and Session number uicontrol('style'...
function [ vTris, vVerts ] = onering( mesh, nVert, mode ) %ONERING returns list of tris and verts in one-ring of vertex % mode == 'ccw' : sort one-ring vVerts = find(mesh.e(nVert,:)~=0)'; vTris = cat(1, full(mesh.te(nVert,vVerts))', full(mesh.te(vVerts,nVert))); vTris = unique(vTris); vTris(find(vTris==0))...
function [H] = entropy1d(px,x1_span) % Function [H] = entropy1d(px,x1_span) % calculates entropy for a 1-d random variable with density interpolated by % vector px in the space x1_span. temp_func=log(px.^px); H=-trapz(x1_span,temp_func); end
clear,clc input_path='../../input/'; %input parameters z_o=0.16; nsteps=35000; dt=0.5; Nx=48; Ny=48; Nz=48; hprocs=1; l_r=1; z_i=795.775; u_star=0.5; l_z=2000; press_cor=1; Ug=3.6; Vg=0.0; f_c=0.5; verticalBC=0; nu=0; theta_mean_wind=0; cs_count=1; nframe=500; sframe=25000; framestep=20; c_flag=0; npart=72900...
% HWK 8 Part 3 % Macky Brock McWhirter % Hidden System % These methods are modifications of the system_identification.m file % by Juan Carlos Rojas close all; clc; clear all; %% Frequency Sweep Method % Method 3: frequency sweep if (1) num_frequencies = 250; % Create the vector of normaliz...
function [KR, A_in,A_ref, SP1,SP2, n_min,n_max] = func_refwave(eta1,eta2,dL,h,dt,g_min,g_max,p_flag) % ====================================================================== % version 1.21 % % Update % 2008/11/25 NM Update help % 2006/01/25 NM Additional input parameters g_min and g_max are added % 2006/03/02 Nakajo %...
function [ret]=Fun(vector) len = length(vector); if len==1 ret = Gun(vector); else Part1 = vector(1:floor(len/2)); Part2 = vector(floor(len/2)+1:end); %ret = Gun(Part1) + Hun(Part2); %ret = Hun(Part1) + Hun(Part2); %ret = Gun(Part1) + Gun(Part2); ret = Fun(Part1) + Fun(Part2); end en...
cur = fileparts(mfilename('fullpath')); export_path = fullfile(cur,'export'); if ~exist(export_path) mkdir(export_path); end addpath(export_path); %% create a truck model vf = 20; speed = vf; horizon = 1; bzorder = 5; sys = truck(horizon,speed,bzorder); % add an additional parameter of 'ymax' % this will automat...
clear all close all T = readtable('PatientInfo_063021.csv','Headerlines',2); gammas = zeros(4,872); for pt = 22:872 pt_id = T{pt,1}{1}; for i=1:4 if isfile(strcat('/Volumes/GoogleDrive/Shared drives/REU shared/ForwardEvaluation/nomHRs/', pt_id, '_val', num2str(i),'_nomHR.mat')) load(s...
function[Ifc,CI] = fuzzycmeans(I,k,Tn) % This program illustrates the Fuzzy c-means segmentation of an image. % Author: Krishna Kumar %I - input image %k - no. of clusters required %Ifc - fuzzy clustering output image %C - final cluster centers %Tn - Number of itrations %sample usage: %I = imread('cameraman.tif'); %[...
leftImg = imread('C:\Users\ycth8\Desktop\leftImage.jpg'); topImg = imread('C:\Users\ycth8\Desktop\topImage.jpg'); rightImg = imread('C:\Users\ycth8\Desktop\rightImage.jpg'); s = ImageProcessor(leftImg, topImg, rightImg); [image_sframe1, image_sframe2, image_sframe3, image_sframe4] = s.leftCamCrop(); [image_stframe5, im...
% Performs k-fold cross validation on the given examples plus output label function [confusionMatrix, avgRec, avgPrec, avgMeas] = crossValidation(k, examples, outputLabels) numberOfExamples = length(examples); bucketSize = floor(numberOfExamples / k); currentIndex = 1; iterationNumber = 1; ...
clear; close all; % open file and interpret results fig = 1; dir_open = './'; nodes = [8,16,32]; for i = 1:length(nodes) node = nodes(i); filename = ['newest_results_5_13_',num2str(node),'_advanced.txt']; % open fid = fopen([dir_open,filename],'r'); fgetl(fid); [A,count] = fscanf(fid,'%d ...
function pass = uq_randomfield_test_gaussian_1d( level ) % PASS = uq_RF_exponential_1D: test for 1D gaussian analytical function % . Gaussian_eigenValue1 = [45.5543391219171;40.5081735886253;33.3294910303610;25.3973976703664;17.9470231751218;11.7807292471836;7.19809492118083;4.10344883953213;2.18816817167518;1.0943949...
% DeleteAllPolygons - DeleteAllPolygons() This will remove all of the polygons. function DeleteAllPolygons() D3d.Viewer.Mex('DeleteAllPolygons'); end
%% GAIO demo: largest Lyapunov exponents % %% The Hénon map a = 1.4; b = 0.3; % parameters of the map f = @(x) [1-a*x(:,1).^2+x(:,2) b*x(:,1)]; % Hénon map Df = @(x) [-2*a*x(:,1) 1; b 0]; %% x = [1,1]; % initial point N =...
function dataTensor_proj = projectTensor(dataTensor, w) [~, w] = normVects(w); [T, N, R] = size(dataTensor); K = size(w,2); XN = reshape(permute(dataTensor, [1 3 2]), T*R, N); XN_proj = bsxfun(@minus, XN, mean(XN))*w; dataTensor_proj = permute(reshape(XN_proj, T, R, K), [1 3 2]); end
function dat = handle_missing_in_quantitative(inpmat) checkNAN=isnan(inpmat); raw = inpmat; raw(checkNAN==1)=0; mVal = mean(raw); raw(checkNAN==1)=mVal; dat = raw;
function Ss = scsurf(Z,H,VARS) % get required VARS: dphi_dtheta = VARS.dphi_dtheta; m_one_two_pi = VARS.m_one_two_pi; rho_rock_dr_Lambda = VARS.scsurf.rho_rock_dr_Lambda; sin_theta_m_cos_theta_theta_lt_B_theta_gt_C = ... VARS.sin_theta_m_cos_theta_theta_lt_B_theta_gt_C; S_air = VARS.scsurf.S_air; %-------...
function table=my_mc_time(newcat,Nwin,Nstep,N,Nboot) %Function to calculate Mc with time %given a window of events, with increment one %-------------------------------------------------------------------------- %Table to save all the output parameters %Assign NaN to (i) pre-allocate memory, %and (ii) not to mess up wi...
function displayTransparentMixedImage(templateImage, targetImage, xOffset, yOffset, hScale, vScale) if(class(templateImage) == "logical") templateImage = cast(templateImage * 255, 'uint8'); end sizeMatchedTemplate = zeros(size(targetImage)); % Rescaling the template to match the input...
function A1 = inv3(A) % The inverse of 3-order square matrix % See also tr3, det3, inv3, adj3, svd3, foam % Copyright(c) 2009-2020, by Gongmin Yan, All rights reserved. % Northwestern Polytechnical University, Xi An, P.R.China % 28/01/2020 A1 = adj3(A)/det3(A);
function acc = getEnergyMap(mag) [dy, dx] = gradient(mag); % Gradient Energy Function acc = hypot(dy,dx); % HOG = extractHOGFeatures(mag); % HOG Energy Map % acc = mag/max(HOG); % acc = entropyfilt(mag); % Entropy Energy Map
function [Y] = khatri_rao(X) % [Y] = khatri_rao(X) % Calculates the Khatri-Rao product of a set of matrices. % INPUTS % X cell array with matrices of the same number of columns % OUTPUTS % Y the Khatri-Rao product of the matrices in X % % Georgios Papamakarios % Imperial College London % M...
function v = mdispg(jb, je, ncjt, ndof, nsc, p, v) i = 1; while i <= 2*ncjt v(i) = 0; i = i + 1; end j = (jb - 1)* ncjt; i = 1; while i <= ncjt j = j + 1; n = nsc(j); if n <= ndof v(i) = p(n); i = i + 1; else i = i + 1; end end j = (je - 1)*ncjt; i = ncjt + 1; whil...
%% 1. Initialization clear all; clc; close all;%#ok<CLALL> %% Inits covfunc = {'covSum', {'covSEard', 'covNoise'}}; % specify ARD covariance Mgpr = zeros(H,length(dyno)); Mgp0 = zeros(H,length(dyno)); Mgp0_prob = zeros(H,length(dyno)); Sgp0_prob = zeros(length(dyno),length(dyno),H); Mgp0_...
% This file contains the experiment on Bayesian Optimization (BO) by using Gaussian Processes (GP) executing different acquisition functions (AF's). % This script can be used for two dimensional input % Different tests can be executed: % Sample function: output of measurement point is sampled from a function (Branin) ...
M = get_frame_matrix('~/code/datasets/photometric/bulb_close/frames/rgb/', [40 20 120 160]); %% MSub = M(1:30, :); [U S V] = svd(MSub); r = 4; d_fr = S(:, 1:r); d_rn = S(1:r, :); %% L_tilde = U*sqrt(d_fr); S_tilde = sqrt(d_rn)*V; S_tilde = bsxfun(@rdivide, S_tilde, sqrt(sum(S_tilde.*S_tilde, 2)));
function H_min = minphase(H_mix, t, p) % MINPHASE calculates the minimum phase impulse response or transfer function % function H_min = minphase(H_mix, t, p) % initial delays are pre % H_mix: mixed phase impulse response or transfer function % t: domain of input and output data t=1 time domain, t=0 frequency dom...
function [D, D2, X, labels] = learn_features(params, params2) annotations = '/cshome/dana/foisy4/DATA/VESSEL12/Annotations/VESSEL12_%d_Annotations.csv'; % Load volumes, annotations and pre-process disp('Loading and pre-processing data...') V = cell(3, 1); A = cell(3, 1); Vlist = cell(3, 1); ...
% 做Voice Conversion的合成部份 % 即是Synthesis phase clear all; pack; clc; addpath 'E:/bond8246/research/rastamat'; load 'E:/bond8246/common_research/iterative9/MOS_GMM_parameter_sung_tu'; load 'E:/bond8246/research/MOS_STRmfcc_24/sung/pitch'; source_pitch = []; [m,n] = size(f0); for i = 1:n if f0(i) ~= 0 source...
sw=find_system(gcs,'followlinks','on','LookUnderMasks','all','FindAll','on','type','line'); for k=1:length(sw) n = get_param(sw(k),'Name'); if ~isempty(n) disp(n); end end
function matparse(mat) % this function is to parse through the rows of a matrix channels=length(mat(:,1)); currchan=1; fp=figure; marked=[]; c='a'; while c~='q' %%%%%%%%%%%%%%%%%%%%%%%plotting%%%%%%%%%%%%%%%%%%%%%%%%%% clf plot(mat(currchan,:)) ylabel('amplitude'),xlabel('column datapoints'),title(strc...
%%%%%%%%%% Impact Date in each sandy/muddy cluster/group %%%%%%%%% clear;clc; load 'C:\Program Files\MATLAB\R2017a\bin\beach formation and sea surface pollutant\settings for grid type and concentration.mat' % cd 'C:\Program Files\MATLAB\R2017a\bin\beach formation and sea surface pollutant\excel result output\10x10...
load presents.mat remain = presents; presents_4 = remain(find(Small_Edges(remain) >= 65 & Large_Edges(remain) >= 71), :); remain = remain(find(Small_Edges(remain) <= 64 | Large_Edges(remain) <= 70), :); presents_3 = remain(find(Large_Edges(remain) >= 71), :); remain = remain(find(Large_Edges(remain) <= 70), :); pres...
function FeatureSetsInfo = generateIBEXsettings(saveflag) %Generate a feature settings strucutre compatible with IBEX % settings = ibexGenerateSettings(saveflag) % % saveflag is boolean, if true will save it as "IBEX_features_default.mat" % that contains the field FeatureSetsInfo % % Under construction, cur...
%% Load things probeFile='~/Desktop/HCN_128.sfp' %probeFile = '/raid/MRI/data/4dImaging/Projects/MTLocalizer/EEG_EMSE/MOCOFields/spm_MOCOField_112707Data/Polhemus/spm_MOCOFields_112707.elp' invFile = '/Volumes/MRI-1/data/4dImaging/Projects/JMA/ICM/AMN_ICMadd/FFTs/3ShellMinNorm_n=10-20Hz0.0042S.inv' fwdFile = '/Volumes...
function results = CalcsCPW(material_thickness,material_length,airFile,materialFile,materialFile2) %This function determines the complex permittivity and permeability of both %the substrate and the loaded material on top of a coplanar waveguide [s11,s21,freq] = s2pToComplexSParam_v4(materialFile); [s22,s12,~] = s2pToC...
rng(split); nreps = 10; addpaths; load(fullfile(basedir,['data/Demographics',name_root,'.mat'])); load(fullfile(datadir,['TimeSeriesIndicators',name_root,'.mat'])); savedir = fullfile(masterdir,'analyses','choosing_k','splithalves'); mkdir(savedir); cd(savedir); concTS = csvread(fullfile(datadir,['ConcTSCSV_',name_roo...
function f = SPLT(x,y,m,y2,c) % SPLT Function for cubic spline interpolation % x is grid, y is fn eval on grid, m is grid points % y2 is 2nd deriv output of SPL, c is desired point of interpolation % Error check if length(x)~=m || length(y)~=m display 'You lied about the grid size.' return end klo =1; khi =...