text
stringlengths
8
6.12M
function archive = update_archive(archive, P, Z, picks, Global) global disable_flag; if disable_flag return; end if ~isempty(archive) P = [archive, P]; end [O, ia, ~] = unique([P.objs], 'rows'); P = P(ia); [index_frontiers, ~] = find_frontiers(O, [P.cons]); archive = P(index_frontiers); O = [archive.objs]; if n...
function [] = plot_BNV(cmat,outputFilename) % plotting the networks using BrainNet Viewer (http://www.nitrc.org/projects/bnv/) % Xia M, Wang J, He Y (2013) BrainNet Viewer: A Network Visualization Tool for Human Brain Connectomics. PLoS ONE 8: e68910. % This code was originally developped by Sahar Allouch. % contact...
function tests = offsetTicksTest tests = functiontests(localfunctions); end function setupOnce(testCase) testCase.TestData.orig_path = path(); % On my install, the perl script called in restoredefaultpath.m finds the % stateflow folder twice. I don't know why but it throws an annoying % warning. state = warni...
function [output_file_name] = shortest_paths( filename ) % This function computes shortest path from a weighted network and saves the corresponding distance matrix. % Input: text file with each line storing a triple 'i j w_{i,j}' % where i and j are positive integers representing two nodes of the network % and w_{i,j}...
function [pq] = priorityPrepare() %PRIORITYPREPARE initializes an empty priority queue with fields key and cost pq = repmat(struct('key', [], 'cost', []), 0); end
% Copyright Claudio Menghi, University of Luxembourg, 2018-2019, claudio.menghi@uni.lu  function [data, abstractedmodel]=refine(data, model, abstractedmodel, aristeo_options, idOptions) global absreftime; absreftimetic=tic; data = misdata(data); try if (isempty(idOptions)) abstract...
function [ sprt_data_original, sprt_data_balanced, sprt_train, sprt_test ] = prepare_dataset() %PREPAREDATASET Prepares the dataset for testing if exist('preprocessedData.mat', 'file') == 2 load('preprocessedData.mat'); return ; end target_number_of_features_feature_extraction ...
function uv = sceneFlow2Flow(uv3, z1, params) %% % convert the 3D scene flow UV3 and scene depth Z1 (current frame) to 2D % optical flow UV [H,W,~] = size(z1); [x,y] = meshgrid(1:W, 1:H); X = (x-params.cx).*z1/params.fx; Y = (y-params.cy).*z1/params.fy; X2 = X + uv3(:,:,1); Y2 = Y + uv3(:,:,2); z2 =...
% Floyd-Warshall algorithm to complete a partial Euclidean distance matrix % assume input is square matrix function [D] = floydwarshall(P) [m,n] = size(P); D = symmfromupper(P); for i = 1 : n for j = 1 : n if (D(i,j) < 0 || D(i,j) >= Inf) D(i,j) = Inf; end end end for i = 1 : n ...
LUCY = 1; WIENER = 1; noises = [0.005, 0.01, 0.05, 0.1]; iters = [1, 2, 5, 10, 20, 50]; for sigma = noises for iter = iters % Read data aperture = imread('apertures/circular.bmp'); image = imread('images/penguins.jpg'); image = image(:,:,1); % Noise level (gaussian ...
%% get precision, recall, f-score from 'ellipse_fitting.m' % 19.4.23-24 % imshow(gt_path); clear Indicator = []; for pic = 74:118 gt_path = strcat('real-bin\',num2str(pic),'.png'); img_path = strcat('result423\',num2str(pic),'_mask.png'); gt = imread(gt_path); img = imread(img_path); % figure...
SetupEnv; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % You do not need to chage values below %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if is_server if strcmp(dataset, 'voc12') VOC_root_folder = '/rmt/data/pascal/VOCdevkit'; elseif strcmp(dataset, 'coco') VOC_root_folder = '/rmt/data/coco'; else error...
function [] = RecipEntropyConsolidate(Ningred_used,orders,Nsubsamps) % Consolidates subsamples for order-order maxent model of Ningred_used most % common ingredients % % Written by: DJ Strouse % Last updated: Aug 19, 2013 by DJ Strouse % % INPUTS % Ningred_used [=] positive integer = number of ingredients to use % orde...
%@(#) bransleflytt.m 1.1 05/12/08 14:34:05 % %function f = bransleflytt(eocfil, bocfil, v, utfil) % %Inparametrar: %EOCFIL: tex eoc23.dat %BOCFIL: tex boc24.dat %V: Om v väljs till 1 skrivs även asyid ut, annars väljs v till 0. %UTFIL: Utfilen som resultatet skrivs ut i. % %Funktionen skriver ut kedjorna som b...
function [dataz] = zscore(data) [~, ncol] = size(data); dataz = zeros(size(data)); for ii = 1:ncol dataz(:, ii) = (data(:,ii) - mean(data(:,ii)))./std(data(:,ii)); end end
function result=movingmean_glen(data,window,dim,option) %Calculates the centered moving average of an n-dimensional matrix in any direction. % result=movingmean(data,window,dim,option) % Inputs: % 1) data = The matrix to be averaged. % 2) window = The window size. This works best as an odd number. If an...
function px_settick(axis,ticks) %axis为'x'或'y',分别表示更改x或y刻度 %ticks是字符cell % example 1. x=0:0.1:4*pi;plot(x,sin(x));ticks={'G_1' 'G_2' 'G_3' 'G_4' 'G_5'};settick('x',ticks) %example 2. x=0:0.1:4*pi;plot(x,sin(x));ticks={'G_1' 'G_2' 'G_3' 'G_4' 'G_5'};settick('y',ticks) n=length(ticks); tkx=get(gca,'XTick')...
function [out1,out2]=submean(dat) x=dat(:,1); y=dat(:,2); d=dat(:,3); vx=dat(:,4); vy=dat(:,5); dat(:,5)=dat(:,5)+1.5.*dat(:,1); xlist=unique(x); ylist=unique(y); Nx=length(xlist); Ny=length(ylist); Ly=max(ylist)-min(ylist); datbar=zeros(size(xlist)+[0 3]); datprime = zeros(size(dat(:,3:5))); disp(size(datbar)); for...
function result = masconv(a, b) %Perform convolution of two arbitrary length %sequences say x = [1 2 3] & y = [4 5 6 7]. %This is the most easily understood program %of the convolution as it uses the idea of %simple polynomial multiplication of the two %vectors to obtain the convolution sum. % Initializing a t...
clc clear variables close all addpath('Data') addpath('Functions') %Fait par : Francois %Date : 2019-11-11 %% Data load('Data/capteur.mat'); % 1 Original Data % 2 Y = mx + b % 3 Y = a + Bx^2 % 4 Y = a cos(x) % 5 Y = ae^(bx)+c % 6 % 7 % 8 % 9 %Figure 1 2 3 4 5 6 7 8 9 plots...
function MACafter = ChangeMacAdress( MACtest ) %CHANGEMACADRESS modifies the current MAC adress. % - "MACafter": the MAC adress (a string) that will be used to replace % the current one. If not specified a random one is generated. % Get the initial MAC adress [~, MACbefore] = system('ifconfig en0 |grep ether'); ...
function subgrad = calc_subgrad_scp_hinge_loss(features_list,C,list_weights,lambda,beta) % features_list is cell of size [1,B]. features_list{i} is [L,d] % C is [B,L] % list_weights is [1,L] % beta is [d,1] [B,L] = size(C); d = length(beta); subgrad = zeros(d,1); % prediction error terms for k = 1:B features = featu...
function [result,b]=c_4_grad(r1,r2,r3,r4,b1,b2,b3,b4,option) %C_4_GRAD calculate gradient of physical field using 4 spacecraft technique % [grad_b,[b]]=c_4_grad(r1,r2,r3,r4,b1,b2,b3,b4) % [grad_b,[b]]=c_4_grad('r?','b?','grad') % [curl_b,[b]]=c_4_grad('r?','b?','curl') % [div_b,[b]]=c_4_grad('r?','b?','div') % [cu...
function G=cpd_G(x,y,beta) % alternative to the original if nargin<3, error('cpd_G.m error! Not enough input parameters.'); end; k=-2*beta^2; m=size(x,1); n=size(y,1); G = zeros(m,n); if isequal(x,y), % using the symmetry property for i=1:m, for j=1:i, G(i,j) = exp(sum((x(i,:)-y(j,:)).^...
function [ output_frame ] = get_audio_frame( W_in, W_out, input, beta ) X_in = [input 1]'; h = W_in*X_in; out_first_layer = tanh(h*beta); X_out = [ out_first_layer ;1]; h_s = W_out*X_out; output_frame = ta...
function [g1,g2] = constraints(X) initialisation; g2 = 0; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Discretize each line segment into a no.of points specified by evaliter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% line1x = linspace(A(1),X(...
function offscreenHist(data,fname,varargin) %OFFSCREENHIST Plot a histogram off screen. % % offscreenHist(data, fname) % offscreenHist(data, fname, ...) % offscreenHist(data, fname, nbins) % offscreenHist(data, fname, nbins, ...) % offscreenHist(data, fname, edges) % offscreenHist(data, fname, edges, ...) %...
% funcion que genera la busqueda de grilla mas chica function [svmFinal Exac Cfinal Sfinal] = iterSVM(C,Sigma,DATAFIN) i=0; svmFinal = []; Exac( round(C(1,2)-C(1,1) + 1) , round( Sigma(1,2)-Sigma(1,1) + 1 ) ) = 0; for c = C(1,1):0.2:C(1,2) i = i + 1; j = 0; for s = Sigma(1,1):0.2:Sigma(1,2) ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % plot_figures_from_ultimate_optimization.m % This script shows some plots based off the results of % ultimate_optimization. ultimate_optimization should be run first. % ME271E, Fall 2018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function to_sharpen_T(I_file,s) %generally s = 0.1-0.3 tiff_info = imfinfo(I_file); [pathstr,name, ~] = fileparts(I_file); I_file_F = [name,'_RM_T.tif']; %hist_averaging(master); %I_file = 'Fabs05_488TIRF_wt_netrin_1_WOO_100_mod_final_hist_average.tif'; tiff_info2 = imfinfo(I_file_F); out_file_coral3 = fullfi...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Created: 19-May-2014 16:59:11 % Computer: GLNXA64 % Matlab: 8.1 % Author: NK %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [xx,yy] = meshgridQuick(xrow,ycol) % xrow = full(x(:)).'; % Make sure x is a full row vector. % ycol = full(y(:)); % Make sure y is...
function mit(senf) if(strcmp(senf, 'senf')) fprintf("doener mit senf"); end end
function wsEva = movSalEva(src, wsSal, parEva, varargin) % Evaluate the salience result. % % Input % src - source % wsSal - saliency % parEva - parameter % nL - #level, {255} % varargin % save option % % Output % wsEva - evaluation % Pre - precision, nL x nF % Rec ...
function [p1,stat1,p,stat] = indtestimpl_nloop_pstat(i,j,k,ds,alpha,S,N) %This function implements the bootstrap method in combination with HSIC %implementation. It cannot be used in combination with bnt learning %bayesian model. It's a test function to get all the pvalues and statistics %of the sub tests %Usage [...
function [] = draw_graphs(simu_desc) %************************************************************************** % UCLOUVAIN/MIT CONFIDENTIAL % ALL RIGHTS RESERVED %************************************************************************** %******************************...
clc; clear; im_0=imread('1.tif'); [m,n]=size(im_0); im_reverse=~im_0; im_temp=logical(ones(m,n)); im_temp(2:m-1,2:n-1)=logical(zeros(m-2,n-2)); im_label=im_reverse & im_temp; %se=logical(ones(3000,3000)); %im_dilate=imdilate(im_label,se); %im_next= im_dilate & im_reverse; im_next=myreconstruct(im_label...
function recall = compute_recall_combined(query_B, database_B, attr_pred_query, attr_pred_database, query_label, database_label, query_Attribute, database_Attribute, leave_one_out) % This function computes recall. % query_B ---- size: Nq * k, value: {1, -1} % database_B ---- size: Nd * k, value: {1, -1} % attr_pre...
function lfpnew = remove_spk(lfp, lfptime, spktime, wnd) % remove spike from lfp by a linear interpolation if isempty(spktime) lfpnew = lfp; return end lfpnew = lfp; nspk = length(spktime); for n = 1:nspk [~, idx1] = min(abs(lfptime - spktime(n) - wnd)); [~, idx2] = min(abs(lfptime - spktime(n) + wnd));...
function [action,state] = player2(G,TR,S2,S1,N,M,plnum) %action = round(rand*3)*ones(size(S2,1),1); action = 4*ones(size(S2,1),1); state = 0; return;
function y=ramsize % Returns the size of machines physical RAM in bytes y=1250*2^20; % for 1.2GB use 1250*2^20
function [ imageFiles, imageFileCount] = listFilesInDirectory( targetFolder, imageFileType ) %LISTFILESINDIRECTORY listing = dir(fullfile(pwd, targetFolder, ['*', imageFileType])); imageFileCount = length(listing); [imageFiles{1:imageFileCount}] = listing.name; [~, lengthIndex] = sort(cellfun('length', imageFil...
function displayGutVideo(gutMesh, gutMeshVels, gutMeshVelsPCoords, thetas, imPath, filetype) % Load data and images from directory matData=dir(strcat(imPath,filesep,'*.mat')); % Assumes filesep at end of imPath load(strcat(imPath,filesep,matData(1).name)); ims=dir(strcat(imPath,filesep,filetype)); nT=size(ims,1)-1; % ...
%% load_nova reads data from two column data files exported by NOVA %% %% [y x] = load_nova(file, st) %% %% OUTPUT: %% y 2nd column data %% x 1st column data %% %% INPUT: %% file Name of file to be read %% st Row to start reading from (optional) %% function [y x] = load_nova(file, st = 6, op = 10) ...
function [ax,profil] = mplltpro(expan,pcde) % Profile plot for excitation pulse % Called by mplcalcc % Note that splotn etc removed for now **** % Declare globals ************************* global mpgbb mpgaa mpgnofp mpgdtmu mpgang ; global mmgfincr mmgfxyoff mmgfxypos mmgplotn ; % Declare local variables *** h = mpg...
function [board,cntFences] = findFences(board,bluewoCircles,demo) %findFences Hledani ohrad % board - vstup/vystup(s podbarvenim pastvin) hraci desky % cntFences - pocet pastvin % bluewoCircles - modry rastr bez kruhu % smazani sumu bluewoCircles=imopen(bluewoCircles,ones(3)); % spojeni ohrad dil=roun...
% % VOLYMUNDER % % Beräknar volymen av båten under ett visst z-värde. % Returnerar dessutom 'spunkter' som är en vektor av skärningspunkter % med planet zguess. Volymen integreras i x-led över snittareorna i % båten. Dessa räknas ut genom att hitta snittets bézierkurvas t-värde % för där fz(t)=z (Löses med Newton-Raphs...
%this calculates the AIC of the various models for the purpose of %comparing and selecting the best model numParam1 = length(info1.X); numParam2 = length(info2.X); numParam3 = length(info3.X); numParam4 = length(info4.X); aic1 = aicbic(LogL1, numParam1); aic2 = aicbic(LogL2, numParam2); aic3 = aicbic(LogL3, numParam3)...
% EJERCICIOS DE PROGRAMACIÓN - SCRIPTS EN MATLAB PARA RESOLVER E.D % Autores: Camila Cueva, Jonnathan Espinoza y Edgar Sánchez % Fecha: 03 de junio de 2021 % EJERCICIO 01 % Representar un campo direccional de la ecuación diferencial dy/dx = 2x % Sobre la misma gráfica superponer: % > La gráfica de la solución de l...
function [q_seed,qd_seed,qdd_seed,t_seed] = GenManualSeed(obj, rbm) arguments obj (1,1) NLP rbm (1,1) DynamicalSystem end % Guess initial pose [qGuess, tGuess] = Opt.ManualInit(); validateattributes(tGuess, {'double'}, {'size', [1,1]}) mustBePositive(tGuess) validateattributes(qGuess, {'double'}, {'s...
function [ rmse ] = rmse_calc( R_pred, R_test, z_test ) %RMSE Calculation % Calculates RMSE based on test set sample_no = sum(z_test(:)); tmp = sum(sum(z_test.*(R_test - R_pred).^2)); rmse = sqrt(tmp/sample_no); end
clear format long %global n; %global I5; %global betaO; %global X; %global logY; %global t; %global h; %global h1; n=100; I5= eye(5); betaO= [0.25 -0.25 -0.25 0.5 0.75]'; matlabpool open parfor m=1:12 innerPro=0; while innerPro < 0.9995 X = mvnrnd(0*ones(1,5),I5,n); Y = (X*betaO).^3; e = normrnd(0,1,n,1); ...
function drawGrid(ax,grid_size,width,height) hold on; for ii = 1:grid_size x = 1:width; y = ii*(width/grid_size)*ones(width,1); plot(ax,x,y,'k:'); xx = ii*(height/grid_size)*ones(width,1); yy = 1:width; plot(ax,xx,yy,'k:'); end
clear clc data = load("spikes.mat"); spikes = data.spikes; test_number = 5; % normalize spikes_mean = mean(spikes); spikes_normalized = spikes - spikes_mean; s = std(spikes); spikes_normalized = spikes_normalized ./s; % pca [CO, SCORE, LATENT] = pca(spikes_normalized); co_2 = CO(:,1:2); score_2 = SCORE(:,1:2); k = ...
% This is a demo script for conducting two-sampled t-tests in matlab % Clear the previous variables in the workspace clearvars; % state the full name of the input data file filename = 'tea_time_data.xlsx'; % read file content and save them into a variable input_file = importdata(filename); % save the data portion o...
cd('C:\Users\Lukas Litzellachner\OneDrive\PhD\Values as Goals\Program') addpath('C:\Users\Lukas Litzellachner\OneDrive\PhD\Values as Goals\Program\fun'); addpath('C:\Users\Lukas Litzellachner\OneDrive\PhD\Values as Goals\Program\Pics'); addpath('C:\Users\Lukas Litzellachner\OneDrive\PhD\Values as Goals\Program\Data'); ...
clear all; close all; clc %Plastic Properties Given Mod_El=230000; %Modulus of Elasticity E = 230000psi Sig_y=2500; %Yeild Strength Sig_y = 2500psi Sig_uts=3000; %Ultamate Tensile Strength Sig_uts = 3000psi Density=0.0376; %Density = 0.0376lb/in^3 %Extra Definitions w=50; %Omega = 50rpm theta=(0:1:360).*(pi/180); ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % FEM for - div . (u_x,u_y) + u = f in \Omega % % (u_x, u_y). n = u_N on \partial\Omega_N % % u = g on \partial\Omega_D % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function init_maze(id) global maze if(id==1) maze1(); elseif(id==2) maze2(); elseif(id==3) maze3(); end save('maze.mat','maze'); disp('maze saved'); end function maze1() global maze maze=zeros(103); maze(1,1)=1; % obs(1,:)=[.3,.5,.5,.7]; maze(30:50,50:70)=1; maze(50:80,60:68)=1; maze(40:48,30:60)=1; %borde...
% plot results from might.m close all; %clear all; load('mat/might_knn_rsa=6_us=0_r=6.6667_znone.mat') %load('mat/might_lda_shrinkage_rsa=5_us=0_r=2.6667_znone.mat'); %load('mat/might_knn_rsa=5_us=0_r=6.6667_zrun.mat'); %load('mat/might_knn_rsa=5_us=0_r=6.6667_znone.mat'); %load('mat/might_knn_rsa=5_us=1_r=6.6667_zno...
clear all close all % Vector array length N=1024; %% Matlab Task 2, Section 1 e = randn(N,1,'double'); %% Matlab Task 2, Section 2 e_p = fft(e); for i=1:N per(i) = 1/N*e_p(i)*conj(e_p(i)); end %% Matlab Task 2, Section 3 num=[1]; den=[1 -0.9 0.5]; P = tf([1], [1 -0.9 0.5], 1); sample = [0:1:N-1]; w = lsi...
% Plotea la curva de Kinetic-over-Noise (opcionalmente muestra los errores muestrales): function [] = konPlot(errors) clc; grey = [0.7, 0.7, 0.7]; konN40 = table2array(readtable('kon-N40.data', 'ReadVariableNames', false, 'FileType', 'text', 'Delimiter', ' ')); konN100 = table2array(readtable('kon-N100.dat...
function varargout = DPABI_SelectROIIndices(varargin) % DPABI_SELECTROIINDICES MATLAB code for DPABI_SelectROIIndices.fig % DPABI_SELECTROIINDICES, by itself, creates a new DPABI_SELECTROIINDICES or raises the existing % singleton*. % % H = DPABI_SELECTROIINDICES returns the handle to a new DPABI_SELECTR...
function play2(varargin) % MATLAB Tetris % To launch, simply type 'play2' in your command window. % Alternatively, you can choose run from this editor window, or press 'F5'. % % To start the game, place the cursor in the 'Start' edit box, and press Enter % on your keyboard. Controls are as follows: % % [Q/q]:...
function weight = measurement_model(z, x, l) % Computes the observation likelihood of all particles. % % The employed sensor model is range only. % % z: set of landmark observations. Each observation contains the id of the landmark observed in z(i).id and the measured range in z(i).range. % x: s...
function logp = logpolyapdf_counts_base_eqiv(nn, base, alphas, unWtBase) % logp = logpolyapdf_counts(nn,K,alphas) % % Compute the log-polya probability of data nn (a histogram) given Dirichlet % prior with parameter alpha. % Make alphas a column vector, zcts and ncts row vectors alphas = alphas(:); nn = nn...
% Gütefunktion für Maßsynthese von Robotern (allgemein); vektorisierte Form % % Eingabe: % R % Matlab-Klasse für Roboter (SerRob/ParRob) % Set % Einstellungen des Optimierungsalgorithmus % Traj_W % Trajektorie (bezogen auf Welt-KS) % Structure % Eigenschaften der Roboterstruktur % P [Nf x Np] % Matrix mit Ve...
function MPCs = simulation_MPCs(p,simvals,income,basemodel,grids) % This function is called by simulate.m to compute MPCs. Outputs are % cell arrays, each cell associated with one mpcamount. Tmax = p.freq * 4; ynetsim_mpc = simvals.ynetsim; diesim_mpc = simvals.diesim; csim_baseline = simv...
function [ distMat ] = calcDistMat(x_center, w, h) % distMat is of size (h, w) h_list = 1 : h; w_list = 1 : w; distMat_h = (ones(w, 1) * h_list)' - ones([h, w]) * floor(h/2); distMat_w = ones(h, 1) * w_list - ones([h, w]) * floor(w/2); distMat = (distMat_h .^ 2 + distMat_w .^ 2) / (w ^ 2 + h ^ 2); distMat = ones(h...
% % Example to use igtlreceive() % %%% read image data sd = igtlopen('localhost', 18944); if sd == -1 error('Could not connect to the server.'); end for n=1:10 DATA = igtlreceive(sd); end igtlclose(sd);
Dalpha_23_t = abs(alpha_2_t-alpha_3_t); Dalpha_23_m = abs(alpha_2_m-alpha_3_m); Dalpha_23_h = abs(alpha_2_h-alpha_3_h); % Incidence: i_opt_stat = Ksh*Kth*i0_10+n_LIE*teta Ksh_i = 0.7; % for DCA q = 0.28/(0.1+(th_c)^0.3); Kth = (10*th_c)^q; p_tip = 0.914+sigma_S_t^3/160; p_mid = 0.914+sigma_S_m^3/160; p_hub = 0.914+...
function [hand L Elast TendS] = readfile %UNTITLED7 Summary of this function goes here % Detailed explanation goes here finger = parseXML('finger.xml'); tendons=parseXML('tendons.xml'); hand=[]; for i=1:3 for j=1:(size(finger.Children,2)-1)/2 data=str2double(finger.Children(1,j*2).Children(1,2+i*2).Child...
function peaks = peak_finder(x,fs,thresh,blank,doplot) % peaks = peak_finder(X,thresh,blank,doplot) % X is a sensor structure % or % peaks = peak_finder(X,fs,thresh,blank,doplot) % x is a vector % This function detects peaks in a signal that exceed a specified % threshold and returns each peak's start tim...
function [A] = sourceContributionNormal(panels,N) %UNTITLED6 Summary of this function goes here % Detailed explanation goes here A = zeros(N); n = 0.5*ones(N,1); A(1:(N_panels+1):end) = n; for i=1:max(N_panels) for j=1:max(N_panels) if (i ~= j) A(i,j) = (0.5/pi) * integrate_radial(panels(...
%% MATLAB xUnit Test Framework: Architectural Notes % This document summarizes the key classes and design choices for MATLAB xUnit, % a MATLAB unit testing framework based on xUnit patterns. % % Note: Testing pattern and smell terminology in this document is drawn from % _xUnit Test Patterns: Refactoring Test Code...
function xyr = Xr(s) x = 1 ; y = s ; xyr = [x ; y] ;
clear; clc; close all; f0 = 76500; f1 = 85400; fS = 4000000; sps = 100; %Samples Per Symbol n = 0:(sps-1); t = n*1/fS; SymbolZero = 1 + sin(...
% Returns the index of the screen on which most of the figure window lies. % Copyright (c) 2012 Howard Hughes Medical Institute. % All rights reserved. % Use is subject to Janelia Farm Research Campus Software Copyright 1.1 license terms. % http://license.janelia.org/license/jfrc_copyright_1_1.html functio...
function [ V ] = create_input_EFIE(k,theta,Ezo,r_s) %create_input Summary of this function goes here % Detailed explanation goes here % K = [k*cos(theta) k*sin(theta)]; m_s = [(.5*((r_s(:,1)-r_s(:,2)))+r_s(:,2)) (.5*((r_s(:,3)-r_s(:,1)))+r_s(:,1))]; P_in = m_s(:,2)-m_s(:,1); P_in = [P_in(1) P_in(2) 0]; % Ezo = [ 0 1 ...
rng(3); %{ %% Housekeeping clc; close all; clear all; %% Add paths addpath('classes'); %% Read data [accel, grav, gyro, accel_lin, mag, euler,... gps, displacement, speed, heading] = parseRawData('data/rawdata'); %} %% Estimated displacement vector [estimate] = getEstimatedDisplacement(accel_lin, gyro); %% Anim...
function Ei200_uvw110_at0m11TPmod2Peaks(varargin) root = fileparts(pwd); data_source= fullfile(root ,'sqw','Data','Fe_ei200.sqw'); bragg = [0,-1,1]; dE = 5; dK = 0.05; repPoints1= [-0.3,-0.09,0,0.1,0.25; 85,10,0,10,60]; repPoints2 = [-0.25,-0.09,0,0.1,0.28; 60,10,0,10,85]; repPoints3 = [-0.28,-0.09,0,0.09,0...
function AAtensorP = computeTensorProductAsub_Asub(dimi, AiTensor, dimj, AjTensor) dim = [] ; for k = 1 : 3 dim = [dim, dimi(k), dimj(k)] ; end AAtensorP = zeros(dim) ; for i1 = 1 : dimi(1) for i2 = 1 : dimj(1) for j1 = 1 : dimi(2) for j2 = 1 : dimj(2) for k1 = 1 ...
%% PARAMETER SPACE EXPLORATION SCRIPT % this script's purpose is to explore the parameter space for the ocular % artefacts extraction procedure, in order to determine the parameter % values that produce a best trade off of number of saccades detected and % and accuracy of gaze prediction %% RESET + LOAD LIBS ...
function mask = computeMask(img_cell) % Initialization num_img = size(img_cell, 1); mask = zeros(size(img_cell{1})); % Overlay all masks from other images for i = 1:num_img mask = mask | im2bw(img_cell{i}, 0); end end
clc clear close all % Matric A0138993L % Classes not chosen: 9 and 3 load('characters10.mat'); %set seed for reproducibility rng(234); train_idx = find(train_label ~= 3 & train_label ~= 9); TrLabel = train_label(train_idx); train_x = train_data(train_idx, :); % normalizing train data train_x = mat2gray(train_x(:,:))';...
% Takes a chromosome and a mutatino probability and returns a mutated chromosome function newChromosome = Mutate(chromosome, mutationProbability) newChromosome = chromosome; chromLength = length(chromosome); for i = 1:chromLength r = rand; if r < mutationProbability newChromosome(i) = 1 - chrom...
reset_data_analysis_environment % P_initial_profile=PTOT_profile_interp_ini; % load('NBI_Phot_data.mat') load('NBIco_Phot_data.mat', 'deltaW_fast_hat') deltaW_fast_hat % rescaling to use only the passing contribution % deltaW_fast_hat=(1359049/1992454)*deltaW_fast_hat % save('NBI_Phot_data.mat','-append','deltaW_fast_h...
function feat= StabilitySelection(X,Y,M,thr,options) % options in glmnet; % options.lambda: Predetermined lambda sequence % options.alpha: Elastic-net mixing parameter % thr: Threshold value for feature selection % M: Number of iterations % X: n x m data matrix, where n is the number of datapoints and m is the % dim...
function [Ytest] = new_classifier(Xtest, mu1, mu2) m1Minusm2 = mu1 - mu2; b = 0.5*(mu1 + mu2); Ytest = sign((m1Minusm2*(Xtest - b)')/(norm(m1Minusm2)));
function D = polyD(P, n) % Returns the nth derivate of a set of polynomials. if(nargin==1) n=1; end if n==0 D=P; return; end D=zeros(size(P,1), size(P,2)-n); for i=1:size(P,2)-n k=1; for j=i:i+n-1 k=k*j; end D(:,i)=k*P(:,i+n); end end
function varargout = untitled122(varargin) % UNTITLED122 MATLAB code for untitled122.fig % UNTITLED122, by itself, creates a new UNTITLED122 or raises the existing % singleton*. % % H = UNTITLED122 returns the handle to a new UNTITLED122 or the handle to % the existing singleton*. % % UNTITLED1...
classdef TrainBrain < handle %GENOME, this class contains the entire gene pool for the neural net % AI that controls the computer mallet, genome can be shared across % various, simultaneous simulations of mallet properties (SetAccess = private) % NETWORK PROPERTIES height; % h...
function Y = FastLegendreTransform(lp,T) %p == the degree of the Legendre polynomial %T == the domain, a=T(1)<...<T(end)=b %Returns Y, which satisfies Y(i)=Lp(ksi(T(i))), where Lp is the %legendre polynomial of degree p,and ksi is the transformation %ksi(t)=(2*t-(a+b))/(b-a), -1<=ksi<=1. ...
%Use two different points in different views to triangulate a match-point %and the match-error of this point. Unit: mm. function [P,error] = my_triangulate_new(point1, point2, m, n) % a=[298.42,416.69]; % b=[996.32,398.53]; % a=undistortPoints(a, calib(1).cameraParams); % b=undistortPoints(b, calib(4).cameraParams); %...
function [x, y, r] = three_point_circle(P) % solve circle equation for all points % x^2 + y^2 + A*x + B*y + C = 0 % A*x + B*y + C*1 = -1*x^2 + -1*y^2 % [x1, y1, 1] [A] [(-x1*x1 -y1*y1)] % [x2, y2, 1] [B] = [(-x2*x2 -y2*y2)] % [x3, y3, 1] [C] [(-x3*x3 -y3*y3)] % Ts = Q % s = T\Q %...
function [d,U] = HermitianEigen(H,tol) %HERMITIANEIGEN Returns the eigenvalues and eigenvectors of a hermitian matrix H. % Returns the eigenvalues and eigenvectors of a hermitian matrix H. % Args: % H (ndarray): n x n hermitian matrix % tolerance (float): the relative precison % Returns: % d (ndarray):...
import gtsam.* fsize = 16; % font size set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex'); %% Parse the data from the front end global measurement_path global steps measurement_path = 'observations'; steps = 100; [gt, Measurements, Transform] = Data_Parsing(measure...
clear all; clc; x = (0:0.01:10)'; BdataFull = 0.4*(1-exp(-2.2*x))+0.55*exp(-3.6*x); bEstimate = fittype(@(A,B,C,D,x) A*(1-exp(-1*B*x))+C*exp(-1*D*x)); [Bfit, gof] = fit(x, BdataFull, bEstimate, 'StartPoint', [0.5, 2.5, 0.5, 3.0]); figure; plot(x,BdataFull); hold on; plot(x,Bfit(x)); hold off;
function [beta, sdd, sid, offcenter_dis, delta_theta] = Xu2DPmatrixGetSDDSIDetcFromPmatrix(pmatrix,det_elt_counts) [paras, delta_u] = Xu2DPmatrixGetParasFromPmatrix(pmatrix); theta = paras(1); x_do = paras(2); x_s = paras(3); y_do = paras(4); y_s = paras(5); beta = angle(x_s+1i*y_s); delta_theta = theta-beta+pi/2;...
function net = residualDenseBlock(net,d,nch,f,k,C,inname,outname) leak = 0; % Relu nch0 = nch; inname0 = inname; prevout = {inname}; for c=1:C % Convolution block = convBlock(k,k,nch,f); name = ['conv_' num2str(c) '_rdb_' num2str(d)]; coutname = ['c' num2str(c) '_rdb_' num2str(d)]; weights = {['w...
% add Add object(s) to the group % % This method adds one or more BoundaryCurve objects to the group. % >> add(group,bound); % >> add(group,bound1,bound2,...); % An empty boundary is added when no existing bounary is specified. % >> add(group); % % See also BoundingCurveGroup, remove % % % created December...