text
stringlengths
8
6.12M
%im assuming that i need to take the integral for the x values, the y %values, the x*y val, x^2 val, x^3 val and x^4 val in order to solve them x0 = 2; x1 = @(x) x; x2 = @(x) x.^2; x3 = @(x) x.^3; x4 = @(x) x.^4; x5 = @(x) x.^5; x6 = @(x) x.^6; yval = @(x) exp(x);% int(y val) yvalx = @(x) exp(x).*x; yvalxsq = @(x) exp(...
%Zihang Zhou %861090400 %April 18, 2016 %CS 171 %PS 2 function [ err ] = regerr( w, X, Y ) [s, ~] = size(X); s = [s 1]; X = cat(2, ones(s), X); %add col of 1 to beginning w = w'; X = bsxfun(@times, X, w); err = sum(X, 2); err = (Y - err) .^ 2; err = sum(err); %returns total squared error end
function micro_F1 = Micro_F1(X,Y) X(X<=0) = 0; Y(Y<=0) = 0; XandY = X&Y; Precision=sum(XandY(:))/sum(X(:)); Recall=sum(XandY(:))/sum(Y(:)); micro_F1=2*Precision*Recall/(Precision+Recall); if isnan(micro_F1) fprintf('micro F1 is NaN'); micro_F1=0; end end
% dir_name = '/home/adutta/Workspace/SignatureVerification/Datasets/GPDS300/'; % subdir_names = dir(dir_name); % % fp = fopen( 'GPDS300.txt','w'); % % for i = 1:length(subdir_names) % if( ~strcmp(subdir_names(i).name, '.') && ~strcmp(subdir_names(i).name, '.') && subdir_names(i).isdir ) % file_names = dir...
function [ w,post,rllharr,garr] = EMPosteriorRegularized_batch(w,X,Y,Nvec,EMiterations,Miterations,lambda,gamma,option,lam) % alpha=1.5; % no_ins=size(X,1)-size(w,1)+1; % B=size(X,2); % Prior=zeros(size(w,2),no_ins,B); % for i=1:B % Prior(:,:,i)=PriorOneBag(w,X(:,i),option.priorType); % %%%%%adding weigh...
% Amir kabir University of Technology (Tehran Polytechnic) % Computer & Information Technology Engineering Department % Resource Allocation in Wireless Networks % DTPC Simulation using MATLAB % Programmer: SeyedHedayat Hosseini % Date: December, 2015 % Matlab Version: R2014b % ***********************************...
function net = train_classifier_re(layers, imgs_train, labels_train, imgs_val, labels_val, lrate, epoch) %--------------------------------- %Use this for the standard classifier options = trainingOptions('sgdm',... 'Shuffle','every-epoch', ... 'ValidationData',{imgs_val,labels_val}, ... 'Validatio...
function w = generate_reservoir(size, radius, degree) sparsity = degree/size; w = sprand(size,size,sparsity); %[i,j,s] = find(w); %s = -1 + 2.*s; %w = sparse(i, j, s); e = eigs(w); e = abs(e); w = (w./max(e))*radius;
% servo_cb(...) % Switchboard type function to handle all callbacks from the 'Servo Motor' % dynamic masked block. function servo_cb(blk, state, initrevsrc, initrev) switch state case 'init' servo_init_cb(blk, initrevsrc, initrev); case 'initrevsrc' initrevsrc_cb(blk); otherwise ...
function results = mergeRnnResults(results, rnnResults) if iscell(results) results = vertcat(results{:}); end if iscell(rnnResults) rnnResults = vertcat(rnnResults{:}); end results = table2dataset(outerjoin(... dataset2table(results), dataset2table(rnnResults), ... 'MergeKeys', true... )); end
% Example 101: point source through a spherical biconvex lens % compare to a Zemax model calculated by Norbert Sigrist % difference should be < 1e-14 mm in position, < 1e-15 in direction % (only 15 digits are provided in the data file) % lens front surface s1=struct(); s1.position = [0,0,40]; s1.direction=[0,0...
clear clc tic m = sort(randperm(1000,500)); n = setdiff(1:1000,m); times = 1000000; group = 20; data = csvread('function1.csv'); x0 = data(:,1)'; y0 = data(:,2)'; gene = zeros(group,64); len0 = zeros(1,times); league = zeros(4,64); datal = zeros(20,times); count = 0; lenf = 100000; len02 = zeros(1,times...
function [const]=getID % get subject ID const.vpnr = str2num(input('Wie lautet die Versuchspersonen-Nummer? ','s')); const.code = sprintf('SpStMob_%.2d',const.vpnr); if isempty(const.vpnr) const.vpnr = 00; const.code = sprintf('SpStMob_%.2d',const.vpnr); end
%% INITIALIZE OF SQUARE AND TRIANGULAR LATTICE % Developed by: Ibrahim Issah. % Msc. University of Eastern Finland % Ref. Igor Photonic crystals clear all close all clc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DASHBOARD %%%%%%%%%%%%...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% Dessiner un objet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%...
function p = selfstarter(zs, dz, w, cw, np, ns, c0, dr) k0 = w / c0; nz = length(cw); alpw = sqrt(cw / c0); alpb = ones(1, nz); ksqw = (w ./ cw) .^ 2 - k0 ^ 2; ksqb = zeros(1, nz); ksqb = complex(ksqb); u = zeros(nz, 1); rhob = ones(1, nz); iz = nz - ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% Initialization and Model/simulation parameters %%%%%%%%%%%%%% sim = 0; % simulation param (1 is sim qpsk, 0 is loaded from chipscope) OS_RATE = 8; make_srrc_lut; make_train_lut; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
clc clear all close all error_gain=2; P1n=[3.7]; P1d=[0.9125 1]; P2n=[4]; P2d=[1.075 1]; P3n=[1.78]; P3d=[0.7875 1]; Pn=[1.8]; Pd=[0.9 1]; Pn_2=[4.2]; Pd_2=[1 1]; % Pn=[3.18]; % Pd=[0.5525 1]; P=tf(P1n,P1d); [C,info] = pidtune(P,'PI'); % step(feedback(C*P,1)) C1n=[C.Kp C.Ki]; C1d=[1 0]; P=tf(P2n,P2d); [C,in...
function [phases, penalty, F_dev, numiter] = findPhasesFoGivenF(p, F_des, maxiter, restartAfter, phasesInit) %FINDPHASESFORGIVENF Finds phase shifts developing the required forces. % % Syntax: [phases, penalty] = findPhasesFoGivenF(p, F_des) % % The sedimentation force is not taken into account. The physical p...
% clear Y % clear xY xY.name = 'aaa'; xY.Ic = 0; xY.def = 'mask'; xY.spec = 'I:\DataAnalysis\TaskYoung\NoSeg_GlobCorr\PPI\Mask\Resliced\MCC.img'; nsess = 3; px_spm8_regions(xSPM,SPM,hReg,xY,nsess)
function r = bit2registre(vecteur, r, lon_ref, lat_ref) % Immatriculation, Compagnie aérienne, Catégorie, Pays if (isempty(r.immatriculation) || isempty(r.airline) || isempty(r.categorie)) [r.immatriculation, r.airline, r.categorie, r.pays] = adresse2immat(r.adresse); end % Type type = bin...
function previewVid_Callback(hObject, eventdata) global vid_fig_hand; selected_file = get(vid_fig_hand.listFiles_handle,'Value'); vid_list = get(vid_fig_hand.listFiles_handle,'String'); vid_name = vid_list{selected_file}; implay(vid_name); end
% function LAMBDA = finite_diff_varyDELTA(a1,b1,a2,b2,epsilon,DELTA,Ly,mx) %% Finite Difference BOUNDARY Honeycomb Spectra % clear %% set grid size a = 1.0; % mx = 200/(2*a); mx = 40/2; %% set up honeycomb lattice q = 4*pi/(a*sqrt(3)); k1 = q*[1;sqrt(3)]/2; k2 = q*[1;-sqrt(3)]/2; k3 = k1+k2; v1_h = [sqrt(3)/2;1/2]; ...
function [error] = output_result(header, input, output, parameters, IDmapper, option) % make sure that all results are generated for each family error = 0; disp(' '); disp('exporting results ...'); disp(' '); disp(['output folder: ', pwd]); disp(' '); if( option(1) ) ...
classdef NATNET_CONNECTOR_sim < CONNECTOR_CLASS % Motiveのsimulation用クラス:登録されたエージェントの位置と姿勢がわかる % motive = NATNET_CONNECTOR_sim(param) % param : % rigid_num : agnet number % marker_num % number of UnLabeledmarker % on_marker_num % total number of markers on agents % (opt...
%Definizione delle variabili L = 480; Sout = L/2; alpha = 2; %valore da modificare Sin = round(Sout * alpha); delta_k=20; [input_signal, Fs] = audioread('speech.wav'); in_length = length(input_signal); output_signal = zeros(round( in_length/alpha + L) , 1 ); win=hamming(L); %vettore che salva i valori...
function lp = logit(p) % LOGIT: logit function. % This is a one-to-one mapping from probability to log-odds. % I.E. it maps the interval (0,1) to the real line. % The inverse function is given by SIGMOID. % % log_odds = logit(p) = log(p/(1-p)) lp = log(p./(1-p));
im = imread('D:\\Google Drive\\CMU\\3rd\\semester 2\\261453 Digital Image Processing\\Assignment 2\\Cross.pgm'); im_resize = imresize(im, 0.5); fft = fftshift(fft2(im_resize)); %shift origin to center ampitude = log(abs(fft)+1); %start x axis at 1 ampitude = mat2gray(ampitude); % scale 0-1 figure; subplot(1,2,1)...
function [Distance_Matrix ] = shortest_path(Graph, Nodes,weightMatrix) % calculate the shortest path between each pair of nodes %Graph is the square matrix denoting a graph %Nodes is the vector denoting the name of each node %weightMatrix is the weight of operation num_Nodes = length(Nodes); %calculate the shor...
function lanzador_casos_nuevos(ejec,numero,clusters_fijados) ejec=str2num(ejec); numero=str2num(numero); % Solo para .exe clusters_fijados=str2num(clusters_fijados); % Solo para .exe rng(numero*10000+ejec*100+clusters_fijados); %Potencia fija 2D 200 gen 100 pob if numero==100 antenas=[0];senso...
function TextControl = EDMUpDownButton(PVName, x, y, varargin) % Defaults FontSize = 8; % 8 10 12 14 18 24 72 FontWeight = 'medium'; % 'medium', 'bold' HorizontalAlignment = 'center'; % 'left', 'center', 'right' FontName = 'helvetica'; CoarseValue = 1; FineValue = .1; Width = 30; Height = 20; AlarmBorder = 'O...
% PERFORMANCE2K returns an estimate of capacity K based on partial report task % % k = Performance2K(p,n,m) % % Given a subject's proportion correct p in a partial report task with n % objects and m alternatives, returns k, the number of remembered objects. % function k = Performance2K(p,n,m) k = n * (p - 1/m)/(1 ...
% PhyConnect.m - Manages memory mapped file and communication to phydev % % Copyright (C) 2013 Integrated System Laboratory ETHZ (SharperEDGE Team) % % This program is free software: you can redistribute it and/or modify it % under the terms of the GNU General Public License as published by the % Free Software Foundati...
function NDPrunFITC2D_wMASK(IM,Impath,Imregion,analysis,thresh,Mask,rect,rot) SizeofMask = size(find(Mask>0),1); ROIinUM = SizeofMask*0.0529; if isempty(thresh) Ifitc = IM(:,:,2); Idapi = IM(:,:,3); if max(Ifitc(:)) == 255 nucT = 26; elseif max(Ifitc(:)) >= 210 && max(Ifitc(:)) < 255...
if exist('s','var') fclose(s); end clc; clear; filename = 'glass_chopstick_20.txt'; s = serial('COM3'); set(s,'DataBits',8); set(s,'StopBits',1); set(s,'BaudRate',115200); set(s,'Parity','none'); fopen(s); pause(3); frameSize = 1000; step = 100; dt = []; tt = []; time = []; data = []; tic;...
function [maskArray,maskData] = pupillMask(bench, mask, maskCenter) % Make a mask for the WFS % - bench : the bench object % - mask : can be : % -a string: name matching a mask defined in config % bench.config.maskChoices gives a list of mask names % -a 3 cell arra...
function IsoDist = IsolationDistance(FD, ClusterSpikes) % IsoDist = IsolationDistance(FD, ClusterSpikes) % % Isolation Distance % Measure of cluster quality % % Inputs: FD: N by D array of feature vectors (N spikes, D dimensional feature space) % ClusterSpikes: Index into FD which lists spikes fr...
function ok = lin2oklab(lin) % LIN2OKLAB Convert colors stored in linear sRGB color space to OKLab color % space % % ok = lin2oklab(lin) % % Inputs: % lin #h by #w by 3 image of colors or #lin by 3 list of colors % Outputs: % ok converted ok colors (same size as lin) % % See also: rgb2lin, l...
% Set B and C for the plots B = 0.4; C = 0.1; % set signal length liblength = 500; % set spacing for impulses hitspace = 5; % set impulse peak hitpeak = 2; % build X and Y [x,y] = NoisyImpulseResponse(liblength,hitspace,hitpeak,C,B); %% plot X width = 8; height = 4; figure('Units', 'inches', ... 'Position', [0 ...
function mats = assemble_mats( parms, mats, soln ) %Assemble Jacobian matrix for full system using natrices obtained from %get_mats. display(' Updating Jacobian...') tic %--Various variables %# of x-vel (flux) points nu = get_velx_ind( parms.m-1, parms.n, parms.mg, parms ); %# of y-vel (flux) poin...
function [position] = COE_getPosition(COE) % Calculate radius r = COE.a * (1.0 - COE.e * COE.e) / (1.0 + COE.e * cos (COE.nu)); position = r*COE_getPositionUnitVector(COE); end
function n = factorial_recur(m) if(m==0) n=1; return end n = m*factorial_recur(m-1); end
function options = setdefoptions(options, defaultOptions) %SETOPTIONS Set options with default options optionNames = fieldnames(defaultOptions); for i = 1 : numel(optionNames) if ~isfield(options, optionNames{i}) options.(optionNames{i}) = defaultOptions.(optionNames{i}); end end end
function OUT=calc_DH(d,a,alpha,theta) OUT=[cos(theta), -sin(theta)*cos(alpha), sin(theta)*sin(alpha), a*cos(theta); sin(theta), cos(theta)*cos(alpha), -cos(theta)*sin(alpha), a*sin(theta); 0, sin(alpha), cos(alpha), d; 0, 0, 0, 1]; end
function medusaPgaInit(nodeid, addr) % function medusaPgaInit(nodeid, addr) % addr = device address of PGA submodule % % This is part of the Medusa software suite. % Pascal Stang, Copyright 2006-2012, All rights reserved. % % $LICENSE$ global MEDUSA global sock % initialize PGA %cmdlinkCmd(cmdlinksock, ...
% -------------------- % Set up public paths % -------------------- addpath learning; addpath detection; addpath visualization; addpath evaluation; if isunix() addpath mex_unix; elseif ispc() addpath mex_pc; end % directory for caching models, intermediate data, and results cachedir = 'cache/'; if ~exist(cachedir,...
clear all; close all; Working_Fluid_1 = {'R290'}; Working_Fluid_1 = Working_Fluid_1{1}; Max_Pressure = 4250000; % Non-Ideal Cycle using a compressor with an efficiency of .80 and a COP of 3.2 %%%%%%%%%%%%% % Constants for the Refridgeration Cycle for Durham, NH %%%%%%%%%%%%% Cold_Space = 273+20; % Kelv...
function xsreg = sreg(A,b,numit,del) xsreg = A\b; xsOld = xsreg; kk = 1; go = 1; while go == 1 smallinds = (abs(xsreg)<del); xsreg(smallinds) = 0; biginds = ~smallinds; xsreg(biginds) = A(:,biginds)\b; if norm(xsreg-xsOld)<1e-6 go = 0; elseif kk>numit go = 0; end xsOld ...
%Visualizations (subplots) for Arrest Paper % Maansi Desai, Garret Kurteff, Alia Shafi - April, 2018 % 1. Plotting errors per patient, showing duration of errors centered % around stimulation per trial % 2. Plotting all error types and timing info in relation to stim % 3. Plotting all regions and error types with timi...
hold off; clear; clc; t = linspace(0,1); % X ~ EXP(-2) F1 = 1-exp(-2*t); t_remaining1 = 1 - F1; % X ~ U(0,1) %Problem with this one F2 = t; t_remaining2 = 1 - F2; % X ~ fT(t) F3 = (((2*t)+2).^-2) - (((2*t)+1).^-2); t_remaining3 = 1 - F3 plot(t, t_remaining1); plot(t, t_remaining2); plot(t, t_remaining3); title("P...
function a = acc(t) t = t/60; a0 = 0.4/3600; % 0.4 km/min^2 -> km/s^2 if t>=15 && t<17 a = a0; elseif t>=17 && t<19 a = -a0; elseif t>=30 && t<32 a = a0; elseif t>=32 && t<34 a = -a0; elseif t>=45 && t<47 a = a0; elseif t>=47 && t<49 a = -a...
%pixel interpolation, digital straighten prof_smoo = 20; %set degree of filament profile smoothing pleng = 50; %set cross section length show_cross=0; %set to 1 to see direction of cross sections minlength = 15; %% clear perp loctor = 0.2; % set the location tolerance (1=no tolerance) away from centre of...
function[data] = initialize_data(M,N) % Hard code 2D nonlinear burgers theta=M*(M+1)/6; thetaT=M*(M+1)*(2*M+1)/6; Pdm1=M; Pd=M*M; Pdp1=M*M*M; deltax=6.28318530718/N; data.space_dims=2; data.boundsv1v2v3=zeros(6,1); data.Tfinal=0.4; data.boundsq=[-0.1000 1.1000]; data.Neqns=1; data.Fspeedmax=2.1; data.Gspeedmax=2.1; dat...
% % Cette énumération contient les type de fichier qu'Analyse pourra ouvrir/convertir. % % Le nom doit rester exactement comme il est écrit ici car nous utilisons ce nom pour % former le nom de la fonction qui sera appelé pour lire le fichier voulu. % % ex: pour un fichier texte, la classe s'appelle: CLireTexte ...
%function [H, R, active_UEs] = function_Setup_multiFrequency(L, Kdrop, B, noiseVardBm, Kmax, f, M, polarization,carrier_freq) %% Set Network Layout L = 16; Kdrop = 5; Kmax = 6; f =2; M =100; polarization = 3; noiseVardBm = -94; % Number of channel realizations num_subcarriers = 400; % Generate Simulation parameters...
%% Scientific computing Project %Manyfactured Solution Explicit Method %Omar El Gazzar clc clear %Iterations where delta_x = delta_y Nx = 15; Ny = 15; nt = 30; %Paramiter D = 1; %Domain ax = 0; ay = ax; bx = pi; by = bx; %Steps dx = (bx-ax)/(Nx-1); dy = (by-ay)/(Ny-1); dt = (min([dx,dy])^(2...
function Tests = labelExprnTest() Tests = functiontests( localfunctions ); end %#ok<*DEFNU> function testLabelExprnCell(this) import parser.Helper; c = {'"''Label''" X+1', 'Y', '^''"Label"'' Z+''a''' }; [actExprn, actLabel] = Helper.parseLabelExprn(c); expExprn = { 'X+1', 'Y', 'Z+''a''' }; expLabel = { '''Label''',...
%Script for particle tracking %parameter file for the mpretrack_init and mpretrack_brozik programs trtype=1; %track type initial setup=0; actual tracking=1; basepath= '~/Documents/research/Single Molecule Data/DMPC + incubated beads 5C 1 mW w Filter/'; savepath= '~/Documents/research/Single Molecule Data/DMPC + incuba...
function out = SECodegen(y) persistent firstrun classificationRate = 20; % Rate? fs=16000; win = hann(400,'periodic'); persistent trainedNet; if isempty(trainedNet) trainedNet = coder.loadDeepLearningNetwork('commandNet.mat'); % beinhaltet trainedNet und wird hier in das Workspace geladen %load('left_test.mat')...
[x, Fs] = audioread('fmt.wav'); sound(x, Fs);
% wczytanie obrazu testowego, zapis do struktury R, nast?pnie wst?pne % przetwarzanie, zastosowanie pierwszego okre?lonego arbitralnie progu, i pierwsza % binaryzacja obrazów clear all, close all; tic sciezka_data = 'C:\Users\Marcin\Desktop\Engineering_project\Inzynierka\W11p\obrazy-uczenie\'; spis_tst = 'pliki.txt'...
%½»²æ function [newpop]=crossover(pc,A) newpop=A; [M,N]=size(A); for i= 1:2:M-1 if rand < pc p = ceil(rand()*N); for j= p:N ch = A(i,j); newpop(i,j) = A(i+1,j); newpop(i+1,j) = ch; end end end
function [outputData, varargout]=FindmiRNAislands(REF_SEQ,TEST_SEQS,MIN_LENGTH,CONS_CUTOFF,varargin) % FindmiRNAislands % Finds islands of homology within the highly varying sequence using % an alignment to a reference sample. % % OUTPUT_DATA = FindmiRNAislands(REF_SEQ,TEST_SEQS,MIN_LENGTH,CONS...
function [ymin, ymax, xmin, xmax, ROI]=height_of_barcode(image, ep) % fonction permettant de supprimer les zones superflues se trouvant au % dessus et en dessous de la region d'interet imshow(uint8(image)); image2=image; [x, y] = ginput(2); x = floor(x); y = floor(y); xmin = min(x); xmax =...
function [ projy ] = proj_unitSimplex( y ) %See "Fast Projection onto the Simplex and the ?1 Ball", Laurent Condat, 2015 projy = max(y-max((cumsum(sort(y,1,'descend'),1)-1)./(1:size(y,1))'),0); end
function X_reshape = image_to_vector(I,n) %UNTITLED Summary of this function goes here % Detailed explanation goes here imSz = size(I); patchSz = [n n]; xIdxs = [1:patchSz(2):imSz(2) imSz(2)+1]; yIdxs = [1:patchSz(1):imSz(1) imSz(1)+1]; patches = cell(length(yIdxs)-1,length(xIdxs)-1); for i = 1:length(yIdxs...
img = imread('/Users/dc/TestCode/TestMatlab/week8/Cameraman256.bmp'); [N,M] = size(img);
global N Fs gain_range_0_500 gain_range_500_1000 gain_range_1000_1500 gain_range_1500_2000 gain_range_2000_2500 gain_range_2500_3000 gain_range_3000_3500 gain_range_3500_4000 gain_range_0_500 = 1.4; gain_range_500_1000 = 1.2; gain_range_1000_1500 = 1.5; gain_range_1500_2000 = 1; gain_range_2000_2500 = 2; gain_ran...
function [of fin_wealth]=runPbmSolver(run_file,model_file,data_file,wealth_file,of_file,fin_wealth_file) % this function generates a run file (run_file) in which the operation the ampl solver has to perform are written % Then, ampl is run and the result written in corresponding files f=fopen(run_file,'w'); fprint...
%% First add new data to the end of the data frame a =length(FINAL_DATA); % a=0; for i = 1:length(Green_MY_DATA) FINAL_DATA(i+a).name = Green_MY_DATA(i).name; FINAL_DATA(i+a).experiment = "Swc2 150mM noATP"; FINAL_DATA(i+a).line_time = Green_MY_DATA(i).line_time; FINAL_DATA(i+a).particle_tracked = Green...
clear clc addpath(genpath(pwd)) %% Load the data Type = '.nd2'; NameAll = ls(['.\ImageAnalysis\Demo', filesep, '*', Type]); FileName = ['.\ImageAnalysis\Demo', filesep, NameAll(1, :)]; [Path, ~, ~] = fileparts(FileName); for i = 1:8 % FileName=[PathAll,filesep,NameAll(i,:)]; % [Path,Name,~]=fileparts(FileN...
function plotMetric(B, varName) %PLOTMETRIC Plots the distribution of a normalized metric or PC. % Usage: % plotMetric(B, varName) % % Example: % plotMetric(epm.LobuleVII.Juven, 'EPM_OpenArmPref') % plotMetric(epm.LobuleVII.Juven, 1) % B.allLabels{1} == 'EPM_OpenArmPref' % plotMetric(epm.LobuleVII.Juven...
function [outputArg1,outputArg2] = update_robot(particles, weights, z, mu, std_R) %UPDATE_ROBOR Summary of this function goes here % Detailed explanation goes here % update for jj = 1:size(landmarks, 2) dist = vecnorm(particles(1:2, :) - landmarks(:, jj)); weights = weights .* normpdf(...
% Andrew Brown Homework 1 Problem 6 clc clear % Euler Leaf Part 1 %Initial Conditions x0=5.3; %position in meters v0=-0.5; %velocity in meters/second m=5.2; %mass in kilograms h=input('Timestep:'); %time in seconds %Part A: Find the new position and velocity after taking one timestep. %Force Function (in Newtons...
%% Train SAM weights code %% function [model_coefs] = train_coefs(seeds, sims_mat, dim, regression_type, lambda, corpus_name, lexicon, result_dir,an_scores,anew,w_flag) % Load files train_matrix = load(sims_mat,'-ascii'); emotion_ratings_seeds = load(an_scores, '-ascii'); unis = textread(anew,'%s',-1); %% Find Seeds...
function result = Func_DilateFill(dd,bw) comObj = Func_ObjStruct2Img(dd,bw); Func_PlotIndex(bw,comObj,dd,2); flag = 0; count = 0; oldInd = -1; while flag == 0 fInd = input('Input the index of nucleous to dilate or fill in the holes, if none, input 0:, input [1 1] to go back to original shape...
% File: SA2_9.m for Study-aid Example SA2-9 clear; % Calculate the IFFT for an RC Low-pass Filter M = 9; N = 2^M; n = 0:1:N-1; fo = 1; fs = 30; dt = 1/fs; T = N*dt; f = n/T; t = n*dt; % Creating Spectrum for (i = 1:1:(length(f))/2) H(i) = 1/(1+j*(f(i)/fo)); end; for (i=((length(f))/2):1:length(f)) H(i) = 1/(1...
function [output] = average_filter(image,row, col, size) sum = uint16(zeros(1,1,3)); count = 0; for r = row-size:row+size for c = col-size:col+size sum = sum + uint16(image(r,c,:)); count = count + 1; end end output = uint8(sum/count); end
clear; close all; rng(1234) %% === LCD Screens Quality Check Example ==== % Probability values to try: m = 200; p_star = linspace(0, 0.1, m) % Observations: N = 150; % number of screens sampled k = 3; % number of defective screens % Calculate likelhood values % for different probability values: % (see function...
clear all close all % load lattice load ../../ESRFLattice.mat % get indexes indm=indBPM'; indq=find(atgetcells(ring,'Class','Quadrupole')); %ring=atsetfieldvalues(ring,indm,'PassMethod','MonitorPass'); % define quadrupole alignment and rotation errors dx=1e-6*randn(size(indq)); % random errors of 1um dy=1e-6*randn(s...
% Drive 5 spheres in a discrete time fashion from starting to final % orientation. % Version 3 rolls the ball back and forth along the y axis, and controls % the x axis movement to make the balls align % DiscreteSpeller.m works, in that it steers the balls to positions to form % U, I, U, C. However, it relies on p...
function [x, y]= sprial_index(n) k = ceil((sqrt(n) - 1)/2); t = 2*k; m = (t + 1)^2; if n >= (m - t) x = k-(m-n); y = -k; return; else m = m -t; end if (n >= m - t) x = -k; y = -k + (m-n); return else m = m - t; end if (n >= m - t) x = -k + (m-n); y = k; return; ...
function value=getBandwidth(object) forceSettings(object); fopen(object.VISA); CU=onCleanup(@() fclose(object.VISA)); fwrite(object.VISA,'ACQUIRE:BANDWIDTH?'); value=strtrim(fscanf(object.VISA)); value=sscanf(value,'%g'); end
function [result,queryIndex,predict_b,unLabelIndexRandom]=randomLearning(labelIndexRandom,data,label,batchSize) % % % currentFolder = pwd; % % % addpath(genpath(currentFolder)); num=1:size(data,1); unLabelIndexRandom=setdiff(num,labelIndexRandom); A=randperm(length(unLabelIndexRandom)); queryIndex=unLabelIn...
clc;clear; %parameters lambda1 = 1; % It is just used to remind setting lambda1 in line 34. lambda2 = 1; % It is just used to remind setting lambda2 in line 35. T = 10; % Time. R = 4; % Freshness. W = 100; % Car capacity. c = 25; % Customers. s = c+2; % Space node. alpha2 = 2; % Time window penalty for deliver...
% DESCRIPTION % Generate the images by walking through the pca components % % INPUTS % [data] (vector [nxm]) Original data. % [K1] (vector [nx1]) Eigenvalues of PCA. % [P1] (vetor [1xn]) Eigenvectors of PCA. % [dim] (scalar) Image width. % [n] (scalar) Number of components you ...
% Script for loading images LoadImages.mat and retrieve HOG %Resizes the image to 4 times its value %Look at the HOG features obtained to understand need for this step %Stores features in .mat file so we dont have to run this repeatedly function [Features] = LoadImages() Features = []; for j = 1:5 num = num2str(j)...
function u = vort_update_multipole(mu,gam,rval,u,gvals,Nvorts,dt) pval = 10; % Build-out the tree tree_vals = multi_pole_kernel_build(u,gvals,pval,gam,Nvorts); tree_vals = multi_pole_list_maker(tree_vals,pval,Nvorts); k1 = dt*force_terms_multipole(mu,gam,rval,u,gvals,Nvorts,pval,tree_vals); uh1 = u + k1/2; tree_vals...
function [chains] = find_chain(Nodes_to_find_chains,G4) % this function read a vector of graph nodes with degree 1 and finds the % chains that start from source degree-1 node, traverse threough degree-2 % nodes and terminate in a non-degree 2 node. The chains corresponding to % each degree-1 node is stored in a cel...
function [Material,grad] = tanque_cilindrico(X) % Declarar variáveis com vetor de inputs raio = X(1); altura = X(2); V = pi*raio^2*altura; % Volume Material = 2*pi*raio*altura; % Material utilizado if V < 650 || Material<0% Caso V seja menor que 650 Material = in...
function [A,B] = linearize_in_x(f, x0, p, u, b, varargin) if ~isempty(varargin) t = varargin{1}; A = FiniteDifferenceJacobian_t(f, x0,p,u,b,t); f_at_x0 = f(x0,p,u,b,t,'nonlinearpart'); else % A = FiniteDifferenceJacobian_t(f, x0,p,u,b); % f_at_x0 = f(x0,p,u,b); error("add nonlinearpart flag") end K0= f...
function [Face m] = GenFace(n,k) Face = []; for i = 1:n-k Division(i) = 2*n; end [Base] = InitGrid(n-k, Division); m = 0; for g = 0:Base(n-k+1)-1 [F] = GridCoords(n-k,g,Base); [isface] = IsFace(n,n-k,F); if isface == 1 Face = [Face; F]; m = m+1; ...
function [r, lattice_title, IniCond] = sirius_ts_lattice(varargin) % 2013-11-26 created Ximenes (from V100) % 2016-09-28 V01.02 - new version (Ximenes) - see 'VERSIONS.txt' in Release/machine/SIRIUS %% global parameters % ================= d2r = pi/180; % --- system parameters --- energy = 3e9; lattice_version = '...
clear all clc %read adj. close price ds = tabularTextDatastore('c:\Users\wangz10\Documents\MATLAB\MA342 P3','FileExtensions','.csv');%path of csv file T = readall(ds); s=44; for i=1:s P(:,i)=T((i-1)*251+1:i*251,4); end P=table2array(P); R=(P(2:end,:)-P(1:end-1,:))./P(1:end-1,:); r=mean(R); C=cov(R); alpha=[0...
function [A, b] = bound_mat(dx, dt, Nx, Nt) A = sparse(Nx*(Nt+1), Nx*(Nt+1)+(Nx+1)*(Nt+1)); b = zeros(Nx*(Nt+1), 1); cnt = 0; for n = 1 : Nt+1 for j = 1 : Nx cnt = cnt + 1; A(cnt, labelrho(Nx, j, n)) = -1; end end % for n = 1 : Nt+1 % for j = 1 : Nx % cnt = cn...
function plot_results_testing(dat) % % figure; hold on; subplot(2,2,1); hold on; for x = 1:numel(dat.trials) plot(dat.trials(x).key_time,dat.trials(x).eye,'o'); end set(gca,'ytick',[-1 1],'yticklabel',{'L','R'}) subplot(2,2,2); hold on; title('total time'); bar([1 2 3],[mean(dat.left_timeSec) mean(dat.right_tim...
% poisson_class.m -- solve the Poisson problem u_{xx} + u_{yy} = f(x,y) % on [a,b] x [a,b]. Solving this with multigrid, 2-cycle % % The 5-point Laplacian is used at interior grid points. % This system of equations is also solved using backslash % to get uD, the exact discrete solution to compare with the % multig...
function [A,B,k,C,vare]=sysinit(dets) % Initialise system, ie. determine models and constants. % % Usage: [A,B,k,C]=sysinit(dets) % % dets: Deterministic (1) eller stochastic (0) simulation global t t0 Tnext Ts % Time administration global As Bs Cs Ds Xs % D-time Linear model Ts=0.1; %-----------------...
function [skew] = SkewnessCal(Y) sd =[]; for i = 1: size(Y, 1) for ii = 1: size(Y, 2) sd(i, ii) = std(Y(i, ii, :)); end end mn = mean(Y,3); % Calculate Skewness skew = []; for i = 1: size(Y, 1) for ii = 1: size(Y, 2) skew(i, ii) = sum((Y(i...
%% Exercise 4 M1 % Emil Airta % Parameters n = 128; a = .025; % Evalution points and point spread function delta_x = 1/n; xvec = delta_x*(0:(n-1)); v = floor(a*n); vvec = linspace(-a+delta_x,a-delta_x, v*2 + 1); p = (PSF(vvec,a)); f = targetf(xvec); % Calculate convolution matrix conA = convmtx(p, n); ...