text
stringlengths
8
6.12M
io = dsp2.io.get_dsp_h5(); P = dsp2.io.get_path( 'measures', 'normalized_power', 'meaned', 'reward' ); measure = io.read( P ); measure.data = measure.data(:, 1); measure = dsp2.process.format.fix_block_number( measure ); measure = dsp2.process.format.fix_administration( measure ); % measure = dsp2.process.format.fix_si...
clear all rows = 600; X = randi(rows,[rows, rows]); Y = randi(rows,[15, rows]); idx = zeros(rows^2,2); row = 1; for x = 1:rows for y = 1:rows idx(row,:) = [x,y]; row = row + 1; end end tic [~, maxIdx] = max(sqrt(idx(:))); [win_row, win_col] = ind2sub(size(idx),maxIdx); toc clear win_row clear...
function [lambdaMin] = lambdaMin(physics, vref, rl) m = physics.m; g = physics.g; muS = physics.muS; muC = physics.muC; vs = physics.vs; f = @(x) 1 - exp((x.^2 + 2*x*vref)/vs^2) + 2*x.*(x+vref)/vs^2; epsilon = 3; % error in e-epsilon i = max(0, ceil(-log10(vref/10))); epsilon ...
%%%%%主函数 %%把图像读入,作为一个矩阵 Classnum=70; snuml=10; snumr=4; row=30; line=360; Datel=zeros(row,line,snuml,Classnum); Maskl=zeros(row,line,snuml,Classnum); Juanl=zeros(row,line,snuml,Classnum); %%class L1 T1=imread('F:\matwork\20110729\Irisnormalize_pic\S2001L01.jpg'); Datel(:,:,1,1)=T1'; T1=imread('F:\matwork\20110729\I...
function mpfn = removebran(mpfn,val) %% constants [m,~] = size(mpfn.branch); [~,M] = size(mpfn.smat); glist = mpfn.gb(:,1); for i = 1:m if glist(i)<val mpfn.gb(i,1:2) = 0; % clear .gb mpfn.branch(i,[4 11]) = 0; % clear branch mpfn.branch(i,3) = Inf; end end for i = 1:M ...
clear; load('ex6data1'); for C = 1:20:100 model = svmTrain(X, y, C, @linearKernel, 1e-3, 20); visualizeBoundaryLinear(X, y, model); pause; end
function [adjdata] = adjacent1D(nx, na, xtrack, atrack, data); % function [adjdata] = adjacent1D(nx, na, xtrack, atrack, data); % % For each FOV in the input it determines the data in the % 8 adjacent FOVs (ie the 8 points adjacent to the center % point of a 3 x 3 grid). % % Input: % nx : [1 x 1] full cross-tra...
function result = pca_backprojection(projection, average, eigenvectors) % function result = pca_backprojection(vector, average, eigenvectors) % % the vector is converted to a column vector. Each column in eigenvectors should % be an eigenvector. The mean is converted to a column vector projection = projection...
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR % Autores: Gonzalo Pajares y Jesús Manuel de la Cruz % Copyright RA-MA, 2007 % Ejercicio 5.9: Suavizado y Realzado: media armónica y contra-armónica %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 5.11.2 Suavizado: filtros de medias %...
num_channels=256; structure = [num_channels+1, num_channels+2]; cfg1=[]; cfg1.layout = layout_256; cfg1.comment = 'no'; cfg1.layout.pos(structure, :) = []; cfg1.layout.width(structure, :) = []; cfg1.layout.height(structure, :) = []; cfg1.layout.label(structure,:) = []; % The input ...
clear; close; clc; %point of intersection A = [1/3 1/4; 1/4 1/3]; b = [1 1]'; u = inv(A)*b %sketching the locus h = [linspace(0.5,5.9/7,50) linspace(6.1/7,1.2, 50)]; k = 1./(7/6-1./h); stem(h,k) grid xlabel('h'); ylabel('k'); print -deps -color ee16b1009.eps
function SimuPop = AddAgent(SimuPop,whichcircumstance,RiskID) % SimuPop = AddAgent(SimuPop,whichcircumstance,RiskID) % % This function adds a new individual to the clinic. % % SimuPop: Current Population % whichcircumstance: String which specifies which agent is added to the % clinic: % - 'initpatient': Adds...
function [Factors,Nb_intrudors,m_factor] = SSRF_compute_factor(BG,X) % X should at least have two instances % size of the sets nbX = size(X,1); nbBG = size(BG,1); % find nearest neighbors [IDX,D] = knnsearch(X,X,'K',nbX); [IDX] = rescue_knn(IDX); IDX = IDX(:,2:end); D = D(:,2:end); [IDX_bg,D_bg] = knnsearch(BG...
function test R = [0.40, 0.25, 0.15, 0.10, 0.10]; % happy1 = R.*[0, 3, 1, 0, 1]; % H1=sum(happy1); % disp('happy1'); % disp(H1); % % happy2 = R.*[1, 4, 2, 0, 1]; % H2=sum(happy2); % disp('happy2'); % disp(H2); % % happy3 = R.*[1, 5, 2, 0, 1]; % H3=sum(happy3); % disp('happy3'); % disp(H3); % % happy4 = R.*[1, 6, 2...
classdef Kernels properties(Constant) ONE = single(1); ONES = [1; 1; 1]; ONES_S = single([1; 1; 1]); KER = (1/(4*pi)); KER_S = single((single(1)/(single(4)*single(pi)))); end methods(Static) function [K] = evalKernelSingle(x,y) K = Kernels.KER * .....
function [x_k_j,w_k_i] = SIR_PF(T,N,Q,R,z_k) % function [x_k_j,w_k_i] = SIR_PF(T,N,Q,R,z_k) %% % Description: % This file is to mimic the example of SIR Particle Filter in % A Tutorial on Particle Filters: % M. Sanjeev Arulampalam, Simon Maskell, Neil Gordon, and Tim Clapp % Section V-B.1 % % In...
clear all % ensure previous legoev3 instance is deleted %% initialize connection ev3 = legoev3('usb'); %% initialze motors and sensors motor_r = motor(ev3, 'B'); motor_l = motor(ev3, 'C'); sen_sonic = sonicSensor(ev3, 2); sen_color = colorSensor(ev3, 3); %% declare parameters speed = 100; turn_speed = 50; th_sonic =...
% Generate pinhole mask in SVG pictures. % Every thing is defined in millimetre. % Don't worry about the difference of screen PPI and printer DPI. % The printer will try it's best to fit the actural position. % see % http://displayblocks.org/diycompressivedisplays/parallax-barrier-display/ % This is for iphone4-6, n...
function [P,Q,Tnew,Tant,BP]=TDMA(aw,ae,as,an,ap,bp,j,N,M,P,Q,Tnew,Tant,BP) if j==1 %At the bottom the temperature is fixed for i=1:sum(N) Q(i,j)=bp(i,j); P(i,j)=0; end elseif j==sum(M) %Left side ...
function camera = readCameraInfo(file) % function camera = readCameraInfo(file) % Reads the .cih files saved by the Photron high speed cameras % Produces a structure called camera with various useful fields fid = fopen(file); done = 0; while ~done, ln = fgetl(fid); if (ln == -1), done = 1; co...
function screenconfig global screenPTR screenPTROff screenNum Mstate Gtxtr Masktxtr setupDefault %screens=Screen('Screens'); %screenNum=max(screens); %set GPU correctly if needed in case of 2 GPUs if setupDefault.useSecondGfx==1 PsychTweak('UseGPUIndex',1); screenNum=1; else screenNum=0; end PsychImagin...
%% Useful notes on the Brick Toolbox % % We hope the 'Brick' Toolbox will help you, its documentation is not % complete, so you won't have too much to read! Just pay attention to the % following points: %% Higlights % The <fn_demo.html main presentation> has already highlithed functions % |<help_fn_coerce.html fn_coer...
%% Gaussian %% MRI CT distortions clear; close all; clc; ct = load('coordinates/centroids_CT.mat'); ct = ct.centroids_CT; % ct = ct./max(ct(:)); mri = load('coordinates/centroids_MRI.mat'); mri = mri.centroids3; % mri = mri./max(mri(:)); %train ctx = ct(1:2:end,1); cty = ct(1:2:end,2); ctz = ct(1:2:end,3); ctt ...
% This program implements Wirtinger Calculus based Levenberg-Marquardt % algorithm for complex-valued neural network (a three layer feed-forward) % % Author: Md Faijul Amin {Email: mdfaijulamin@yahoo.com} % % Ref: M.F. Amin, M.I. Amin, A.Y.H. Al-Nuaimi, and K. Murase. 2011. % Wirtinger Calculus based Gradient ...
%countrygdpstuff cd('/Users/grayson/desktop/summerresearch'); %get into a good directory FILE = fopen('companiesgdppercent.csv'); %pull in the network data DATA = textscan(FILE,'%s %s','delimiter',',','headerlines',1); fclose(FILE); %close the loose file country = DATA{1}; gdp = DATA{2}; tempgdp = zeros(length(gdp),1) ...
function makeTuples( obj, key ) [gwin, glim ] = fetch1(StatAreaParams(key),'gwin','glim'); [rfMap,rz] = fetch1(RFMapRaw(key),'onpoff_rf','rz'); rfMap = double(imresize(rfMap,1/rz)); [~,hMap] = max( squeeze(mean(rfMap,3)),[],3); fhMap = convn(hMap,gausswin(gwin)*gausswin(gwin)','same'); [~,reversal] = max(fhMap,[],2);...
function [x, flag, iter, xs] = Bisection(fun, interval, tol, maxIter) % Bisection Find zero of single-variable function using bisection method. % X = Bisection(FUN, INTERVAL) returns a zero of FUN within INTERVAL % using bisection method. FUN should be a function handle taking a scalar % as input and INTERVAL ...
% Image Compressor % Compresses to 1/3 size old_rgb_1 = imread('moon.jpg'); % Comvert jpg to rgb comp_rgb_1 = compress(old_rgb_1); % Compress image uncomp_rgb_1 = decompress(comp_rgb_1); % Uncompress image imwrite(comp_rgb_1,'image1new.jpg'); % Convert back to jpg % Display the original and ...
function [ classification ] = MultiSVMClassify( MultiSVMStruct, tst ) %MYMULTISVMCLASSIFY Summary of this function goes here % Detailed explanation goes here classification = []; NumOfClasses = length(MultiSVMStruct); for i=1:NumOfClasses classSVM = MultiSVMStruct(i); svmStruct = classSVM.SVM; cl...
%function [rec,prec,ap] = VOCevaldet(VOCopts,id,cls,draw) clc,clear close all clss = {'Insulator'; 'Rotary_double_ear'; 'Binaural_sleeve'; 'Brace_sleeve'; 'Steady_arm_base'; 'Bracing_wire_hook'; 'Double_sleeve_connector'; 'Messenger_wire_base'; 'Windproof_wire_ring'; 'Insulator_base'; 'Isoelectric_line'; ...
function magLightInit(connString) % Sets up the communication link to talk to SerialForwarder (suppose to be connected % to TOSBase) which broadcasts to motes running MagLightTrail. Also, % 1) initializes default values for the report threshold and the number of % intervals before the LED fades % 2) stores ...
function itsprint(str, k) %ITSPRINT displays the iteration information if(k==1) fprintf(str); end fprintf('%s%s', char(8*ones(1,length(str))), str);
function [data,count] = preprocess( input,day ) %PREPROCESS 此处显示有关此函数的摘要 % 聚合数据预处理 % 每年的同一天数据聚合,最后31个聚合结果,同师姐论文 col=length(input(day,:)); count=0; for i=1:col if(~isnan(input(day,i))) count=count+1; data(1,count)=i; data(2,count)=input(day,i); end end end
% Figures for paper % Figure 1 % from testDictionaryLearning(1) % dim = 64; nAtoms = 192; k = 6; nSignals = 50,000; avgAtoms = k * nSignals / nAtoms; % M_batch_OMP=dim*nAtoms^2 + nSignals * [ dim * ( 1 + nAtoms) + k^2 * ( 1 + nAtoms + k^2 ) ]; % m_D_update = nAtoms * [ 2 + dim * ( 3 + nAtoms ) + avgAtoms * ( 2 +...
%CBTHRW2D は、2次元のしきい値のユーティリティのコールバックです。 % M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 03-Oct-98. % Copyright 1995-2004 The MathWorks, Inc.
t = 0 : 0.01 : 5-0.01 f1 = 10; f2 = 20; x = 5 * sin(2* pi * f1 * t ) + 2 * cos(2* pi * f2 * t); DFTandShow(t,x); %% Fs = 1000; % Sampling frequency T = 1/Fs; % Sampling period L = 1000; % Length of signal t = (0:L-1)*T; % Time vector X = 0.7*sin(2*pi*250*t) + sin(2*pi*120...
addpath('./mfile_tests') addpath('./mfile_gold')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % CTD: Fast, Accurate, and Interpretable Method for Static and Dynamic Tensor Decompositions % Author: Jungwoo Lee, Dongjin Choi, and Sael Lee % % Version: 1.0 % Date: August 21, 2017 % Main Contact:...
function [ dataset, distortion ] = Assignment( dataset,centroids, K ,colors,attempt) %UNTITLED Summary of this function goes here % Detailed explanation goes here % size/rows of centroid matrix == K % attempt is how many times we updated our mean. for i=1:size(dataset(:,1),1) for j=1:size(centroids(:,1),...
function [ maxNcc, dx, dy, failed ] = tryFF( sample, template, data ) %tryFF An attempt at full frame registration first % Detailed explanation goes here ncc = getNCC(sample, template); [ncc, failed] = processFF(ncc, data); if failed maxNcc = 0; dx = 0; dy = 0; return; end maxNcc = ma...
i = imread('cameraman.tif'); figure; subplot(1,2,1);imshow(i); subplot(1,2,2);imhist(i); imh = imadjust(i,[0.3,0.6],[0.0,1.0]); imh1 = histeq(i); figure; subplot(2,2,1);imshow(imh);title('streatch'); subplot(2,2,2);imhist(imh); subplot(2,2,3);imshow(imh1);title('hist eq'); subplot(2,2,4);imhist(imh1);
function plot_simpl(A,B,R) figure(2); X = A; Y = B; Z = R; x_prev1 = [X(1);X(2)]; x_prev2 = [X(1);X(3)]; x_prev3 = [X(1);X(4)]; x_prev4 = [X(2);X(3)]; x_prev5 = [X(2);X(4)]; x_prev6 = [X(3);X(4)]; y_prev1 = [Y(1);Y(2)]; y_prev2 = [Y(1);Y(3)]; y_prev3 = [Y(1);Y(4)]; y_prev4 = [Y(2);Y(3)]; y_prev5 = [Y(2);Y(4)]; y_prev6...
%function [rec,prec,ap] = VOCevaldet(VOCopts,id,cls,draw) clc,clear close all clss = {'Insulator'; 'Rotary_double_ear'; 'Binaural_sleeve'; 'Brace_sleeve'; 'Steady_arm_base'; 'Bracing_wire_hook'; 'Double_sleeve_connector'; 'Messenger_wire_base'; 'Windproof_wire_ring'; 'Insulator_base'; 'Isoelectric_line'}; ...
function [cargasViento]=trussViento3D(lista,b,pV,datosEstructura,dirF) %funcion para repartir la fuerza en los elementos afectados d = datosEstructura; %% %Calcular el peso por elemento bElementos = b(lista,:); lElementos = d.longitudElementos(lista,2); fViento = pV*bElementos.*lElementos; %calculamos las carga...
%-appName, paramFile: see appBuilder %-configFile: string contaning the name of the function in configs/ folder with %the desired set of parameters %-fileInstance: number of the correct envList file inside the folder defined in %configFile %-version: year of your matlab version (numeric) function LOG = simulate(versio...
function varargout = fun(varargin) % FUN MATLAB code for fun.fig % FUN, by itself, creates a new FUN or raises the existing % singleton*. % % H = FUN returns the handle to a new FUN or the handle to % the existing singleton*. % % FUN('CALLBACK',hObject,eventData,handles,...) calls the local % ...
% test resizing path_orig = '../../data/original/'; file_image = '0000118.jpg'; scale = 0.5; method = 'nearest'; antialias = false; numIters = 100; RGB = imread([path_orig,file_image]); t = 0; for i=1:numIters tic(); RGBout = imresize(RGB,'Scale',scale,'Method',method,'Antialiasing',antialias); t = t + toc(); end f...
function plot_RMS_max_pressures(kgrid,sensor_data_fluid,sensor_data_elastic,freq_data) % plot and save the rms recorded pressure and HM line % open new figure figure; subplot(2, 2, 1), imagesc(kgrid.y_vec*1e3, kgrid.x_vec*1e3, sensor_data_fluid.p_rms,[-1 1]); title('RMS Pressure fluid simulation'); ...
function mk_des_mx_one_back_analy_3(all_sub,param) %*change need to address function file from file that loads up subject specific data ***_____________IF VARIABLES CHANGED ********* %get variables from param curr_sub=param.curr_sub; num_sess=param.num_sess; analy=param.analy; fs=param.fs; dir_base=pa...
function eventsCountHis(outputPath, generalProperty, imagingData, BehaveData) [labels, examinedInds, eventsStr, labelsLUT] = getLabels4clusteringFromEventslist(BehaveData, ... generalProperty.labels2cluster, generalProperty.includeOmissions); classes = unique(labels); allTrailsIndex = 1...
function [ax h1 h2] = adcasl_bar(astr_fileAdcAslData, varargin) % % INPUTS % astr_fileAdcAslData string file containing ADCASL data. % % OPTIONAL % v_YLim1 vector limits on Y1-axis % YTicks1 int number of ticks on Y1 axis % v_YLim2 vect...
function plotSeries(pb) series = fetch(mp.Series(pb.key),'*'); nSeries = length(series); for se = series' nChan = length(se.channels); for c = 1:nChan h=subplot(nChan,nSeries, (c-1)*nSeries+se.series); set(h,'parent',pb.seriesPanel); T=[]; if se.y_units(c)=='A' ...
basepathCode='/home/urut/code/osort-v1-rel'; path(path,[basepathCode ]); path(path,[basepathCode '/code/continuous/']); path(path,[basepathCode '/code/sortingNew/']); path(path,[basepathCode '/code/sortingNew/noiseRemoval']); path(path,[basepathCode '/code/sortingNew/projectionTest']); path(path,[basepathCode '/c...
function strct = elementify(strct, varargin) % strct = ELEMENTIFY(strct, ['keep']) % Separates an M by N matrix strct.data into N column vectors according to % the N names in cell array strct.elements. If 'keep' flag is selected, the % preexisting '.data' field will be retained % If the input data is not a struct, ret...
function result = initial_tracking_info(depth_frame, parameters) % function result = initial_tracking_info(depth_frame, parameters) global debug; de = depth_edges(depth_frame, parameters.depth_edge_low, parameters.depth_edge_high); % detect the face ft = parameters.face_template; [scorestoim, scorestotemp, ...
function [customizedSurface, zGrid, calibrationPoint, angleMatrix] = getCustomizedZGridForMember(currentMember, memberBoundingBox, splintLineX, splintLineY, angles) memberMinX = min([currentMember(1); currentMember(4)]); memberMaxX = max([currentMember(1); currentMember(4)]); memberMinY = min([currentMember...
function Params = stimdefITD(EXP); % stimdefITD - definition of stimulus and GUI for ITD stimulus paradigm % P=stimdefITD(EXP) returns the definition for the ITD (interaural time % difference) stimulus paradigm. The definition P is a GUIpiece that % can be rendered by GUIpiece/draw. Stimulus definition like s...
classdef Graph < handle % GraphAbstract properties Nodes Edges end properties( Hidden = true , Access = private ) NodeCount = 0; EdgeCount = 0; ConstructorKeyPropertyMap = struct(... 'NodeNames', {}, 'NodeIDs', [], 'NodeValues', {},... ...
function [g,dg_lo,dg_hi] = gamma_n(s,t,p,along,alat) %%% GAMMA_N: Label hydrographic data with neutral density %%% %%% USAGE: [g,dg_lo,dg_hi] = gamma_n(s,t,p,along,alat) %%% %%% DESCRIPTION: Label a section of hydrographic data at a specified %%% location with neutral density %%% %%% PRECISION: Double %%% %%% INPUT...
addpath(genpath('c:\matlab\lightspeed'))
classdef Snake < handle %PATCH 2016-11-09 JN properties arena = ones(100,200); elements TRONS life player err %PATCH 2016-11-09 JN end methods function hObject = Snake(varargin) % [y f]=audioread('ReeckFirebird.mps3'); %PATCH 2016-11-09...
function mutual_information(train_data,train_label) length=size(train_data,1); breadth=size(train_data,2); for j=1:breadth name='pclass'; new_data=train_data; new_label=train_label; if size(unique(new_data),1)>10 [sorted,indices]=sort(new_data); label=...
close all; clear all; clc; orig_data = load('iris'); % load input data model = lda(orig_data,2); % train LDA ext_data = linproj(orig_data, model); % feature extraction figure; title('LDA-Linear Discriminant Analysis'); xlabel('x_1'); ylabel('x_2'); ppatterns(ext_data); % plot ext. data ...
% this function calculates how many remaining files are there for each % subject, the ouput is a txt file containing this information function [] = compute_subject_statistics() % empty containers sub_counter_array = zeros(1, 25); sub_name_array = strings([1, 25]); array_counter = 1; % initializations % folder_conten...
function [new_pose] = motion_update(ut, sigma, old_pose, L) %MOTION_UPDATE Update the given pose using the actuation comand ut. ut = mvnrnd(ut,sigma); new_pose = old_pose + ut; if ~(IsInBounds(L, new_pose)) new_pose = old_pose; end end
if max(size(gcp)) == 0 % parallel pool needed parpool % create the parallel pool end NUMBER_OF_TRIALS = 4; variances = zeros(NUMBER_OF_TRIALS,1); fvals = zeros(NUMBER_OF_TRIALS,1); options = optimoptions(@fminunc,'Display','iter'); options.Algorithm = 'quasi-newton'; options.MaxIterations = 1000; options.MaxFuncti...
clear all % close all clc addpath(genpath('./libs')) addpath(genpath('../data')) openR; evalR('install.packages("glasso")') evalR('library("glasso",lib.loc="C:/Users/matineh/myFiles/projects/TBI/graphical_model/libs/")') % evalR('library("glasso")') measurementType = 'fa'; subjectType = 'hs'; HS = readTbiPdf(measu...
function [a] = plotLayer2Results(results) sizes = cell2mat({11,20,34,45}); minErrors = cell(size(results,1),1); for i = 1:size(results,1) [layer1, layer2, layer3] = divideResultsInLayers(results{i,4}); minErrors{i} = cell2mat(findMinErrorInLayer2(layer2)); end algos = {'traingdm','tr...
obj = VideoReader('D:\huangkang\Projects\pupilLab\code\PupilLab\data\rawData\26.avi'); NumberOfFrames = obj.NumberOfFrames; show_process = false; % la_imagen=read(obj,10); filas=size(la_imagen,1); columnas=size(la_imagen,2); % Center centro_fila=round(filas/2); centro_columna=round(columnas/2); figure(1) % draw mask i...
function plotStructure(structure, figNum, xLimit, yLimit, realvalue) if nargin<5 realvalue = false; end figure(figNum); hold on axis equal xlim(xLimit) ylim(yLimit) for i = 1:size(structure, 1) length = ((structure(i, 3) - structure(i, 1))^2 + (structure(i, 4) - structure...
% calculate the median absolute error (MAE) for the size-replication curve, % as well as the replication-size curve: % since we have both size->id and id->replication, % we can do then a change of variable to get size->replication %% parameters: n_case = 6; % num of GAN curves x_tmp = [22.02, 24.70, 27.41, 28.99, 30...
% ========================================================================= % % This software was developed by employees of the National Institute of % Standards and Technology (NIST), an agency of the Federal Government. % Pursuant to title 17 United States Code Section 105, works of NIST % employees are not subjec...
function showNii(niiData, z) maxVal = max(max(max(niiData))); imshow(niiData(:,:,z)',[0 maxVal]); end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % matWrapper.m % % DESCRIPTION: % Demonstration script for importing a model trained with Tensorflow-Keras % and using it for classification. Requires deep learning import packages % from add-on explorer in MATLAB, and deep learning toolbox. Rec...
function [ mask, centroid ] = findProbable( Im,threshold ) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here function p = probabilityDensity(val,mu,sigma) sigma_p2 = power(sigma,2); denom = sqrt(2*pi*sigma_p2) ; numer = exp(-1 * power((val - mu),2)/(...
%Script to study whether the ILD-distance method is *predictive* %That is, can a subset of locations be used to generate Activity vs. d_ILD curves that predict %the activity for the rest of the locations? %Load neuronal data if(~exist('Neuron','var')) load 'd:\mlspezio\matlab\save\Neuron_39_regress_twelfth' ...
%% Generate MAC curves for decomposition % PhotonElectric and Compton for materials without K-edges % structEBas: % Output: % strName,pfEnergy,pfBase % pnBaseLoc: matrix of size structDet.nEnergyBin * length(pfEnergy) function structEBas = setEnergyBasis() % Absorption effect structEBas...
function bootstrapEONIA(reference, maturity, rates) % Compute the bootstrap for the EONIA curve (chosen as the discount % factors' curve). The bootstrap technique is standard and uses market % quotes of Overnight Indexed Swap rates with increasing maturity. % Swaps with a maturity up to one year and swaps with lo...
x = [1 2 0 -1 0 3]; h = [1 -1 1]; conv(x,h) x_n = length(x); h_n = length(h); y_n = x_n + h_n - 1; y1 = zeros(1, y_n); y2 = zeros(1, y_n); y3 = zeros(1, y_n); for i = 1:x_n for j = 1:h_n y1(i + j - 1) = y1(i + j - 1) + x(i) * h(j); end end y1 ytemp = zeros( x_n, x_n + h_n -1); for i = 1:x_n yt...
function [ ] = mlestimator(filename,num_classes) %return data read from file % filename: file name to which holds data % data : return data maxtrix % Assumes a text file with (category x1 x2 x3... ) format % st: total samples % nf: number of features/dimenstions clc; fileID = -1; errmsg =''; %{ while fileID ...
clear; clc; close all; % Gp1 = 1 / (s + 1); filename = 'cost_ideal.mat'; myVars = {'t','y'}; S0 = load(filename, myVars{:}); % Gp2 = 1.2 / (0.9 * s + 0.8); filename = 'cost_actual.mat'; myVars = {'t','y'}; S1 = load(filename, myVars{:}); %plot(S0.y(:,1), S0.y(:,2), 'x-'); %hold on; %plot(S1.y(:,1), S1.y(:,2), 'x-');...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%README: %%This function is used to save the workspace. Data is an optional input %%variable which is saved. It is possible to specify a prefix which is %%saved before the rest of the file name. The format is as follows: %%userstring_With...
% PTV_STRING_UIMENU % % Function generates UIMENU with list of languages % Copyright is with the following author(s): % % (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava, % juraj.oravec@stuba.sk % (c) 2012 Monika Bakosova, Slovak University of Technology in Bratislava, % monika.bakosova@stuba.sk...
function [] = config_set_up(model) activeConfigObj = getActiveConfigSet(model); % disp(activeConfigObj); % lls = fieldnames(activeConfigObj); % lls = get_param(activeConfigObj, 'Components'); % lls = get_param(activeConfigObj, 'DialogParameters'); % lls = get(get_param(activeConfigObj,'handle')); % for i=1:length(lls...
function iid = prueba_acf(data,verbose) aut=xcorr(data); [maxaut idx]=max(aut); if verbose==1 figure stem(1:length(aut(idx+1:end)),aut(idx+1:end)./maxaut); hold on plot(1:length(aut(idx+1:end)),1.96/sqrt(length(data))*ones(length(aut(idx+1:end)),1),'r-',1:length(aut(idx+1:end)),-1.96/sqrt(length(...
function [x, Ci, Cf] = TrustRegionFour(StepBound, eta, StopError, xstart, B0, Xdata, ydata, UpdateType) E = Inf; Delta = StepBound/2; x = xstart; B = B0; Ci = 0; Cf = 0; while E > StopError x0 = x; [f, g] = N2GPLogLike(Xdata, ydata, x0); Cf = Cf + 1; pd = dogleg(B, g, Delta); % one linear solve if min(abs(x0+pd))...
% WRITE YOU CODE HERE!!! function dots = projectData(mat,eig_vec,k) % get the length of matrix n=length(mat); dots = zeros(n,k); for i = 1:n % loop in matrix and find dot product of all the points and store it in dots for j = 1:k dots(i,j) =dot(mat(i,:),eig_vec(:,j)); end end
function [ Img,a ] = flood_fill( i,j,Img,a ) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here connectivity = [-1 -1 -1 0 +1 +1 +1 0; -1 0 +1 +1 +1 0 -1 -1]; for m=1:1:8 if Img(i+connectivity(1,m),j+connectivity(2,m))== 1 Img(i+connectivity(1,m),j+connectivity(2,m))=...
clc; clear all; close all; dirName = 'DK0:[MICROCT.DATA.00002000.00026768]' ; fid = fopen('FEtoITS.csv','w'); CTfileNames={'E0012609_ITS_SUB_R15.AIM;1','E0012499_ITS_SUB_R15.AIM;1','E0012497_ITS_SUB_R15.AIM;1','E0012552_ITS_SUB_R15.AIM;1','E0012596_ITS_SUB_R15.AIM;1','E0012597_ITS_SUB_R15.AIM;1','E0012600_ITS_SUB_R...
function [z_gmax, diff_gmax] = analyze_roi_erp_zscore(data_dir, sub_prefix, ... data_file_prefix, sub_chs_analysis, sub_chs_to_average) % script to plot each subject's ROI's mean erp and difference erp. % David Huberdeau % data_dir = '/home/david/group'; target_files_prefix = data_file_prefix; %which file to look ...
% test QP solver rng(1); n = 2000; % dimension of x m = 1000; % number of equality constraints x0 = randn(n,1); % create random solution vector A = randn(m,n); % create random matrix A b = A*x0; % generate a well-conditioned positive definite matrix P = rand(n); P ...
function mlogfid = mlog(action,data,volume) %MLOG Manages messages to the log in MAESTRO. % MLOG(ACTION,DATA) will perform the action as described in ACTION. % % MLOG(ACTION,DATA,VOLUME) will assume a message volume as specified by VOLUME % % MLOGFID = MLOG(...) will return the fid of the current log. % % ACTIO...
function writeLFPRecordHDF5(FID, pop_ind, LFP_neurons) % write data recording for local field potential % FID: file id for writing data % pop_ind: % LFP_neurons: logical vector that specifies which neurons contribute the % LFP measure. For multiple LFP measures, use multiple rows. % for C/C...
%% Optimisation of DESPOT1 %David Leitao (david.leitao@kcl.ac.uk); 23-04-20 %Requires the handles to the SPGR steady-state signal function and its %derivative -> needs path to library folder clearvars; close all; clc; %% Sequence constraints and tissue parameters values TRmin = 5; %Minimum TR [ms] TEspgr = 2; %SP...
function [xmin, ymin, xsize, ysize] = getFalseEyeRect(I,yminrect,XSIZE,YSIZE) [imX, imY] = size(I); xsize = XSIZE; ysize = YSIZE; % cantonada superior esquerra xmin = uint32(rand * (imY - xsize - 20 )); ymin = uint32(rand * (imX - ysize - 20)); %comprobar Y while( (ymin ...
function a=read_bin_8bit(infile) %fid=fopen('Basketball.bin'); fid=fopen(infile); a=uint8(zeros(1024,1024,96)); for ia=1:96 a(:,:,ia)=fread(fid,[1024,1024],'uint8'); end fclose(fid);
clear all; height=100; width=100; window_s=1; window_e=height; window_h=window_e-window_s+1; %as=[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8]; t=0:2:400; tau=16; tau_off=5; phi=0.48; time=[0]; ColMap=[ 1 1 1; 0 0 0; 0 1 1; 1 0 0]; dd='/home/xiaoling/SpiralWave/data/'; matrix=l...
seed=23; rng(seed); min=-1000; max=1000; A=(max-min)*rand(1000,1000)+min; B=[(15 - seed)*rand(1)*10, (15 - seed)*rand(1)*60]; store=A(:,1); help=find(store<B(1,1)&store>B(1,2)); C=A(help,120:130); D=max(C,[],2);
% Checks whether a (sub)graph is complete, i.e. whether every node is % linked to every other node. Only defined for unweighted graphs. % INPUTS: adjacency matrix, adj, nxn % OUTPUTS: Boolean variable, true/false % GB, Last Updated: October 1, 2009 function S=iscomplete(adj) S=false; % default adj=adj>0; % remove w...
function [ R ] = radpcalc(str,dip,rak,faz,inc) %[ R ] = radpcalc(str,dip,rak,faz,inc) % For an earthquake with geometry defined by strike, dip and rake, this % script takes input vectors of azimuth and incidence angle and computes % the radiation amplitudes for each ray leaving the source % % INPUTS % str = fault ...