text
stringlengths
8
6.12M
function printRobotCmdMsg(address, message, connectionName) % Useful for receiving getKp, getKi, getStraight messages. % These are only for diagnostics, hence no way to turn this off. global COTSBOTS; RC = COTSBOTS.RC; switch(message.get_type) case(RC.GET_STRAIGHT) temp = message.get_data; disp(spr...
function embedding=gb_lmnn(X,Y,K,L,varargin) % Nonlinear metric learning using gradient boosting regression trees. % 'X' (dxn) is the input training data, 'labels' (1xn) the corresponing labels % 'L' (kxd) is an initial linear transformation which can be learned using LMNN % L corresponds to a metric M=L'*L % 'mod...
function count = rollFive() %Simulates yatze with no max number or %rerolls, and returns the number or %rolls it took to attain 5 identical %results count = 1; %a minimum of one...
function [mdataell,mdatasph,mdatamad] = hdrobscaleSM(mdata,robpar) % HDROBSCALE, High Dimensional data ROBust reSCAling % Does various types of robust normalizations of the data % for use in robust PCA, etc. % Can use first 1 or 2 arguments. % Steve Marron's matlab function % Inputs: % mdata ...
function image = customReaderImage(location) [img, ~, msk] = imread(location, 'png'); image = struct('original', img, 'mask', msk, 'location', location); end
function Hd = LeastSquaresOrder8(stop1,pass1,pass2,stop2) %LEASTSQUARESORDER8 Returns a discrete-time filter object. % MATLAB Code % Generated by MATLAB(R) 9.4 and Signal Processing Toolbox 8.0. % Generated on: 25-Jul-2019 19:07:11 % FIR least-squares Bandpass filter designed using the FIRLS function. % All frequenc...
function [] = imageMask(Filename, Xmax, Xmin, Ymax, Ymin) % Apply a mask to the RGB image. iterations = size(Xmax); lastImage = ''; mkdir(strcat(pwd,'\Dataset\train\images\masked\')); for i = 1:iterations originalImage = imread(strcat(pwd,'\Dataset\train\images\', char(Filename(i)))); outputImage = applyMask(or...
load Cougar_GT1.mat; load Cougar_GT2.mat; load Cougar_GT3.mat; load Cougar_GT4.mat; load Cougar_GT5.mat; % Converting to logical Cougar_GT1 = logical(Cougar_GT1); Cougar_GT2 = logical(Cougar_GT2); Cougar_GT3 = logical(Cougar_GT3); Cougar_GT4 = logical(Cougar_GT4); Cougar_GT5 = logical(Cougar_GT5); % Converting to struc...
%********** Function decription *********** % This is a leave-one-out cross-validation (LOO-CV) experiments, which is used to calculate the accuracy and precision of the calibration results of Landmark algorithm. % It also calculates the Min_AE, Mean_AE, Max_AE, SD, RMSE of the calibration results. % Input: eul_P_R...
%% Rotation model images stitcher % A basic example on image stitching. % % <http://docs.opencv.org/3.2.0/d8/d19/tutorial_stitcher.html> % <https://github.com/opencv/opencv/blob/3.2.0/samples/cpp/stitching.cpp> % %% Input images (two or more) im1 = imread(fullfile(mexopencv.root(),'test','b1.jpg')); im2 = imread(fullf...
A = [1 0 0; 2 1 0; 3 6 4]; b = [1; 20; 2+1i*3]; % A = sprand(100,100,1); % b = rand(100,1); x = b*0; M = eye(size(A)); restrt = 3; max_it = length(b); tol = 1e-6; format long %[x, error, iter, flag] = gmres2( A, x, b, M, restrt, max_it, tol ); [x1,flag1,relres1,iter1,resvec1] = gmres(A,b,restrt,tol,max_it); ...
%% Parameters param.L_0 = 0.1; % Range: 0.23m - 1.605m param.init_x1 = 0; param.phi_0 = 0; param.T_K = 0.03032; param.T_G = 0.0247; param.K_K = 1; param.K_G = 1; param.r_K = 0.046; %m param.r_G = 0.021975; %m param.ue_dreh = 75; param.ue_K = 6; param.ue_G = 3; param.d = 0.02; % Daempfung param.box_sequence = [1,4,5,...
%% upsample and top hat all the expanded images % close all; clear; clc; %% prepare pixelSize=[0.4 0.4 1]; PSF = [.4 .4 2.5]; pixelSize2=pixelSize./2; A=eye(4)*2; A(4,4)=1; R=makeresampler('cubic','bound'); tform=maketform('affine',A); structure = distStrel3D(0.5, pixelSize2); %% all directories under database [a, nam...
function statsBoxplotsDraw(~,~,fig,man) %statsBoxplotsDraw - draw boxplots based on the selection % Get the guidata sts = guidata(fig.fig); % Get the value of the clicked items... str = man.list.String; val = man.list.Value; mzrt = str{val}; % And the groupings str = man.groups.String; val = man.groups.Value; [grp] ...
%% ZeroCrossing - To ensure segments following Staba method do not cross the zero line more than 10 times % Megan Entzinger % 17-Jan-2019 load Mario03_Filter_8min.mat; %load filtered data datadata = data; load mario03Staba.mat; %load data containing segments following Staba method filtereddata = testTable; i...
function [X,Y,Z,lightSource,lightIntensity] = defaultAssign(n) switch n case 0 X = []; Y = []; Z = []; lightSource = []; lightIntensity = []; case 1 X = -100; Y = []; Z = []; lightSource = []; lightIntensity = []; ca...
function openMVG_global(folder,numberOfClusters) %% Replace matches.e.txt matchesPath = [folder filesep 'SfM' filesep 'matches']; matchesFile = [matchesPath filesep 'matches.e.txt']; matchesFullFile = [matchesPath filesep 'matches_full.e.txt']; if ~exist(matchesFullFile,'file') movefile(matchesFile,matchesFullFile);...
fs = sqrt(10.^(powers/10)/1e3*50)/0.004; yyaxis right plot(powers,real(y5v_power_epsilon(75,:)),powers,real(pb_power_epsilon(75,:)),'--',powers,real(yig_power_epsilon(75,:)),'*-') yyaxis left plot(sqrt(powers/50),imag(y5v_power_epsilon(75,:)),powers,imag(pb_power_epsilon(75,:)),'--',powers,imag(yig_power_epsilon(75,:))...
clear all; close all; clc; load HW1_Testdata.mat %%% Name: ROSEMICHELLE MARZAN %%% Course: AMATH 482 %%% Homework 1, Due 1/24/2019 % VARIABLE NAMES FOR SIGNAL % Undata = raw (noisy) data % Unt = noisy data in the frequency domain % Unft = filtered data in frequency domain % Unf = filtered data in time domain % setti...
%% Finding monetary policy instruments % Interbank Market Equilibrium MPCC_bankblock_ii; MPCC_interbank_vecs; Dr = r_b_vec-r_d_vec; mu_index=(mu_vec>surplus_cut & mu_vec<deficit_cut); [~,index_aux] =find(mu_index==1,1,'first'); if index_aux<length(mu_index); mu_index(index_aux+1)=1; end mu_ss_target = interp...
function [f_model] = mTRFtransform(b_model,resp,recon) %mTRFtransform mTRF Toolbox transformation function. % F_MODEL = MTRFTRANSFORM(RECON,RESP,B_MODEL) tansforms the coefficients % of the backward model B_MODEL to the coefficents of the corresponding % forward model F_MODEL as described in Haufe et al., (2...
function hdr = get_hdr( bufferD, hdr ) % hdr = get_hdr( bufferD ) if bufferD.running try hdr = buffer('get_hdr', [], bufferD.host, bufferD.port ); catch %hdr = []; bufferD.running = false; warning( 'hdr = buffer(''get_hdr'' : FAILED!' ) end end
% [comp_closeprices,comp_closeprices1,residual]= PCA(closeprices,0.9); function [princomp_closeprices,princomp_closeprices1,residual]= PCA(closeprices,threshold) % 将closeprices标准化 mean_closeprices = mean(closeprices,1); std_closeprices = std(closeprices,0,1); standard_closeprices = (closeprices-repmat(mean_closeprice...
clear all; clc;close all; data_set = 'D:\50_set\'; addpath(data_set); data_1 = (dir(fullfile(data_set,'*.asc'))); data_1 = {data_1(~[data_1.isdir]).name}; for j = 1:length(dir(fullfile(data_set,'*.asc'))) a = char(data_1(j)); X = load(data_1{j}); save X=X'; filename=[a([1:9]),'.pcd']; savepcd(filename,X); x...
%*********************************************** % COMPUTATIONAL ECONOMICS WS15/16 % Prof. Alexander Ludwig % % PROBLEM SET II % Despoina Balouktsi - 5917774 % Maddalena Davoli - 5701809 % Jorge Quintana - 5702248 % %**********************************************...
function m_VarAuxElem = f_OperPosConv_MixStrInj_quad_q1(m_VarAuxElem,m_VarAuxGP,e_DatMatSet,m_CT,e_VG) %parfor iElem = 1:nElem % for iElem = 1:nElem % % condBif = m_VarAuxElem(1); % if ~condBif % %Para el análisis de bifurcación se toma el tensor de punto de gauss 5 para el imp...
In Matlab kun je met de quote operator (') een vector veranderen van rijvector naar kolomvector.
function [ ] = removeCol(obj, idx) % 删去一行,改变obj.yProps和obj.data和obj.Ny % [ ] = removeCol(obj, idx) % idx: 待删除列列号 % ---------------- % 程刚,20150519,初版本 % TODO: 能否改成接受参数idx 或 nameStr %% 预处理 % 判断idx范围正常 if idx < 0 || idx > length(obj.xProps) error('idx=%d,超出范围!',idx); end %% main obj.xProps(idx) = []; obj....
%% Function, calculate Jacobian % For the two linkages function j_out = cal_J_wr(th1, th2, th3, th4, l1, l2) % thetat degree 2 rad th1 = deg2rad(th1); th2 = deg2rad(th2); th3 = deg2rad(th3); th4 = deg2rad(th4); % first col j_c1_1 = 0; j_c1_2 = - l2*(cos(th4)*(cos(th3)*sin(th1) + cos...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function yc = classifyNaiveBayes(trnData, tstData) % % Machine Learning Project % Naive Bayes vs Perceptron % Muhammad Usman Akram % muhammadusman.akram[at]studenti.unitn.it % 08/02/2014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
clc; %% Declaração de variáveis A = input('Digite a matriz A: '); b = input('Digite o vetor b: '); nmax = input('Digite o número máximo de iterações: '); tol = input('Digite a tolerância do método: '); C = A; g = b; it = 0; m = size(A, 1); n = size(b, 1); %% Construção de matrizes for i=1:m for j=1...
function smooth_vec = Gaussian_Smooth_TA2(original_vec, my_N) if my_N~=0 g = gausswin(1000,my_N); g = g ./ sum(g); %% Since this code might be used for EEG, we must rectify first !! original_vec = abs(original_vec); % taped_vector=[original_vec(floor(5/my_N):-1:1) original_vec orig...
%cd('0704'); clear all code_folder = pwd; exp_folder = 'D:\GoogleDrive\retina\Chou''s data\211217'; % exp_folder = 'D:\GoogleDrive\retina\Troy''s data\20211126'; cd(exp_folder) all_file = dir('*.mcd') ; % change the type of the files which you want to select, subdir or dir. n_file = length(all_file) ; for m = 1 fi...
A = [1 2; 3 4; 5 6]; B = [11 12; 13 14; 15 16]; C = [1 1; 2 2]; A * C A .* B %element wise op multi one by one V = [1; 2; 3] 1 ./ V log(V) exp(V) abs(V) -V % same as -1 * V V + ones(length(V), 1) % add 1 to each element %or directly V + 1 A' %transpose (turn left) max_val = max(V) [max_val, max_index] = max(V) %...
%Example 3.23 % clf reset; setfsize(300,300) echo on clc % INITC - 对竞争层初始化 % TRAINC - 训练竞争层 % SIMUC - 仿真竞争层 pause clc P = 0.1 ./ [(1/11):0.001:1] - 0.1; pause clc plot(P,P*0,'+r') pause clc net=newc(minmax(P),6,0.02,0.001); pause hold on plot(net.iw{1,1},net.iw{1,1}*0,'ob') hold off pause clc net.trai...
function [s,Sol_2,sol] = bvp_tube_2(mesh,alpha0,initSol, C0, R0, Z0, F0, ZF, bpoint) global k0 lam dc c0 a0 g delta p pw wd P iSol gt r0 z0 f0 aF aa tt P=0; r0=R0; z0=Z0; aa = bpoint; x=mesh*aa; s = x; c0 = r0*C0; % dimensionless preferred curvature g = 20; gt = x; delta = 1; k0 = 320; p = P*R0...
% % se cargan los datos A1 = load('289x289/A289.dat'); b1 = load('289x289/b289.dat'); p = load('289x289/nodos.dat'); %289x2 e = load('289x289/fronteras.dat');%64x7 t = load('289x289/elementos.dat');%512 x 4 % se trasponen los nodos, frontera y elementos p0 = p'; %2x289 e0 = e';%7x64 t0 = t';%4 x 512 u = linsolve(A1,b1...
%% %%###################################################################### %% %%################## Define Parameters Here ################### %% %%###################################################################### %%_____________________________Fixed Parameters___________________________ g = 9.81; ...
function options = checkFields(options,params,value,fieldname) % checkFields - checks whether fieldname exists in options, if not checks if it exists in params and sets this value; elseif value is used % % Syntax: % options = checkFields(options,params,value,fieldname) % % Inputs: % options - [struct] options str...
% Copyright 2014 % % Licensed under the Apache License, Version 2.0 (the "License"); % you may not use this file except in compliance with the License. % You may obtain a copy of the License at % % http://www.apache.org/licenses/LICENSE-2.0 % % Unless required by applicable law or agreed to in writin...
% circle continuation example close all clear all clc global gp globalsolution gp=5; newton('fun1',-3300) globalsolution=[ans;gp]; gp=7.5; newton('fun1',-3300) globalsolution=[globalsolution,[ans;gp]]; run_continuation('fun1',12000) B = globalsolution'; plot(globalsolution(1,:),globalsolution(2,:)); axis('image') ...
% bruteforce search best patch residents time for two patch types close all; clear all; more off; PATCH = [50 100]; PN = 2; TAU = [10 50 100 500 1000 5000 10000 50000 100000 500000]; TN = 10; prt = zeros(PN, TN); maxRate = zeros(PN, TN); collected = zeros(PN, TN); patchA = load(sprintf('avgGainFct_%d.dat', PATCH(...
function plotRF(obj,k,varargin) params.background = 'stim'; params = getParams(params,varargin); import vis2p.* % get stims files [kk.x, kk.y, kk.exp_date] = fetch1(vis2p.Scans(k),'x','y','exp_date'); stims = fetchn(VisStims('exp_type = "MouseDotMapping"') & vis2p.Scans(kk,'problem_type = "none!"'),'stim_file'); s...
function [tref,tins]=an_href(g,t) %Genera il vettore dei nodi (partizione estesa) raffinamento del vettore %dei nodi t % function [tref,tins]=an_href(g,t) % g --> grado della spline % t --> vettore dei nodi partizione estesa % tref <-- vettore dei nodi raffinato partizione estesa % tins <-- vettore di nodi inse...
function a=fun2mat_sym(fun,n) % return matrix a such that a*u(:) = (fun(u))(:) for 3d u size n u = zeros(n); outn = size(fun(u));% size of output a = sparse([],[],[],prod(outn),prod(n),5*prod(n)); k=0; for i3=1:n(3) for i2=1:n(2) for i1=1:n(1) u(i1,i2,i3)=1; k=k+1; out = ...
function [w1, w2, ell_angle] = Covariance2EllipseParameters(CovarianceMatrix, Pr) K_square = -2*log( 1 - Pr ); % log = ln -> (logaritmo naturale) [ eig_vectors, eig_values ] = eig( CovarianceMatrix ); % Get the largest eigenvalue max_evl = max(max(eig_values)); % Get the index of the largest eigenvector ...
% Homework1a % Engineering 240 % Cody Antonio Gagnon 7/2/15 % Vector and matrix definitions %% Store C, D, y, z C = [2 9 -3; 0 pi 5] save A1.dat C -ascii D = [0 7; 8 3; -3 0]; save A2.dat D -ascii y = [2; 1] save A3.dat y -ascii z = [1; exp(1); -1] save A4.dat z -ascii % Loading files and Accessing Elements T = dlmre...
function [ distance ] = WassersteinLoss( mu1, Sigma1, mu2, Sigma2 ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Wasserstein Inverse covariance Shrinkage Estimator % Viet Anh NGUYEN, Daniel KUHN, Peyman MOHAJERIN ESFAHANI %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [V...
function [k,flag] = checkpass(word,password) k = 0; for jj = 1:length(password) if (word(jj) == password(jj)) k=k+1; disp ('match'); else disp ('no match'); break; end end if (k == length(password)) flag = 1; e...
close all D = importdata('Wing_Polar_Graph_0CD.csv'); % plot WEISSINGER vs XFLR5 --> Cd vs Cl figure(10) plot(D.data(:,1),D.data(:,2),'k','LineWidth',5); hold on plot(Cd_vec,Cl_vec,'or','LineWidth',5); grid on grid minor xlabel('$C_{D}$','Interpreter','latex'); ylabel('$C_{L}$','Interpreter','latex'); legend('XFLR5',...
function [arch_str,archs] = SMAP_retrieve_archs() r = global_jess_engine; MAX_ARCHS = 100000; MAX_INSTRS = 5; archs = zeros(MAX_ARCHS,MAX_INSTRS); arch_str = cell(MAX_ARCHS,1); % results.instrument_orbits = cell(MAX_ARCHS,1); fact_archs = r.listFacts(); ii = 1; while(fact_ar...
T = 1000 numInputs = 100 probInputSpike = 1e-2; %X = double(rand(numInputs, T) <= probInputSpike); X = double(rand(numInputs, T)); w = randn(numInputs, 1); th = 1; u = X'*w; z = double(y-th); y = double(u >= th) figure(1); clf; subplot(4,1,1); imagesc(X); colormap(1 - gray(255)); title('Raw') %ylabel('No') subplot(4,...
close all; clear all; %JMA: uiPtbCorgiData loads project data ptbCorgiData = uiGetPtbCorgiData(); %Set some figure options: figurePosition = [0 0 1000 500]; %JMA: Next let's loop through each participant and each condition. % for iParticipant = 1 : ptbCorgiData.nParticipants, %JMA: get the data for this par...
%% addpath ./eeglabfuncs/ % Load wavelet or hanning TFR: %load ../new/TFRhann_avg_bc2.mat %load ../TFRs/TFRhann_avg_bc3.mat %load ../TFRs/TFRmult1_avg_bc2.mat load TFRwave_bc_st_cl.mat %load TFRmult_bc_st_cl.mat %% Prepare data structure for statcond nSubj=size(TFRwave_CTR_bc, 2); % Data structure: (1,2) cell array...
function []= plot_result_matrix(input_matrix, input_labels) [rows, columns]= size(input_matrix); figure; imagesc(input_matrix); title('Confusion Matrix'); xlabel('Predicted Class'); ylabel('True Class'); set(gca, 'XTick', 1:rows, 'XTickLabel', input_labels, 'YTick', 1:columns, 'YTickLabel', input_labels); for ii=...
function error = checkTrackingBoris(data, ids) teMap = [0, 0]; % maps true objects to estimated ones nAllObjs = 0; nMissed = 0; for iFrame=1:data.nFrames frame = data.Frames(iFrame); id = ids{iFrame}; nObjs = frame.nObjects; trueId = getIdsFromDataFrame(frame); for i = 1:nObjs ti...
function [centroids,idx,J] = best_result(X,K); centroids_cell = cell(50,3); %% %% for i = 1:30, initial_centroids = Kmeans_intialization(X,K); [centroids idx] = MYkmeans(X,initial_centroids,15); J = costFunction(X,centroids,idx); centroids_cell{i,1} = centroids; centroids_cell{i,2} = J; ...
% Es 8 % Given x(n) = [3, 11, 7, 0, -1, 4, 2] , n in [-3, 3] % Given h(n) = [2, 3, 0, -5, 2, 1], n in [-1, 4] % Compute y(n) as x(n) convolved with h(n), n in [-7, 7]. close all clearvars clc %% signals % let us define the signals in the same n-domain. --> put zeros where % signals are not defined. n_x = -3:3; n...
%MRI_CLASSIFY Perform statistical image classification (requires updates) % While this script is mostly complete, you are responsible for modifying the % contents of this function to make it fully operational. Be sure to create an % "output/classification" directory within your personal directory and modify % ...
clc; clear all; close all; x=input('enter the first sequence'); h=input('enter the second sequence'); y=conv(x,h); figure; subplot(3,1,1); stem(x); ylabel('amplitude-->'); xlabel('(a)n-->'); title('first sequence'); subplot(3,1,2); stem(h);ylabel ('amplitude-->'); xlabel ('(b) n-->0'); title('second sequence'); subplo...
pkg load symbolic; clear -g; % clear all global variables if(~exist('netlist', 'var')) [baseName, folder] = uigetfile({"*.net","LTSpice Netlist"}); netlist = fullfile(folder, baseName); end %%%%%%%%%%%%%%%%%% Helper Functions %%%%%%%%%%%%%%%%%%%%%%%%% global nets numNets; global numAddIds; glob...
function [ ] = convert_to_tif() Maindatapath = uigetdir('D:/','Select DATA directory for files'); Maindatapath = ([Maindatapath '/']); cd (Maindatapath); prompt = {'\bf \fontsize{12} Please enter the format of your videos (eg .avi):',... }; dlgtitle = 'Video format'; dims = [1 88]; ...
function mustBeAfter(date, year) tz = date.TimeZone; assert(date >= datetime(year, 1, 1, "TimeZone", tz), ... "Must be after %4i.", year); end
function [C] = FactorialMN(N) A = [1]; B = [1]; C = [1]; while isSmallerOrEqualMN(A,N)==1 %disp(C); %disp(A); %disp(' '); C = MulMN(A,C); A = AddMN(A,B); end end
function datasum = sumB1pos(data,param,position) % function datasum = sumB1pos(data,param,position) % % Sample position 'position' overrides sample name, so be careful. % % Created 28.11.2007 energies = []; sd = size(data); for(p = 1:sd(2)) % Search for all different energies if(isempty(find(energies==param(p).Ene...
function Flag = isround(X) % isround True if variable is round number. % % Syntax % ======= % % Flag = isround(X) % % Input arguments % ================ % % * `X` [ numeric ] - Variable that will be tested. % % Output arguments % % * `Flag` [ `true` | `false` ] - True if the input variable `X` is a...
function [x] = chinese_remainder(n,b) %UNTITLED Summary of this function goes here % Detailed explanation goes here leng = length(n); product = prod(n); x = 0; for i = 1:leng p = product/n(i); [g,y,z] = gcd(p,n(i)); x= x + b(i) * p * y; end x = mod(x,product) end
function [dObj,dObjGrad]=objFun_d(x,p) % q = x(1:p.numJ,:); % dq= x(p.numJ+1:2*p.numJ,:); u = x(p.numJ+1:2*p.numJ,:); s_var = x(p.numJ*2+5:p.numJ*2+6,:); dObj = 0.5*sum(p.jointW.*sum(u.^2,2).'); dObj = dObj-0.5*sum(s_var.^2,'all')*10; dObjGrad = [zeros(p.numJ,size(x,2));diag(p.jointW)*u;zeros(4,size(x,2));10*s_v...
function [CORRELATION_VALUES, GAMMA, BETA, ALPHA] = ... read_soft_results_file(RESULTS_FILE_PATH, BAND_WIDTH, IS_REAL) % This function reads a correlation volume produced by the c function % test_soft_fftw_correlate2. % % INPUTS % RESULTS_FILE_PATH = Path to the output file produced by % test_soft_fftw_corr...
clc;clear; close all; % img_name = 'test00.png'; % img_name = 'test01.png'; % img_name = 'test02.png'; % img_name = 'test03.png'; % img_name = 'test04.jpg'; img_name = 'amy_portrait.jpg'; % img_name = 'test05.jpg'; myimg = imread(img_name); mysize = size(myimg); if (length(mysize) == 3) myimg = myimg(:,:,1); end % ...
function [ storeOutputs ] = getRespons(data,weights,theta,T,daysBack,nH) storeOutputs = zeros(T,1); for i = 1:T-daysBack input = data(i:i+daysBack-1,:); output = RunNetwork(input(:),weights,theta,nH); storeOutputs(i+daysBack-1) = output{end}; end storeOutputs(storeOutputs<-0.5)=-1; storeOutputs(storeOutputs>0....
function mat = rotateZ(row, col, ang) % ROTATEZ Generates rotation matrix % like rotz in phase array system toolbox % % 15Aug2017 - SSP - created fh = figure(); ax = axes('Parent', fh); ln = line(row, col, 'Parent', ax); if isnumeric(ang) rotate(ln, [0 0 1], ang); end mat = [ln.XData...
function [cepstra,aspectrum,pspectrum] = melfcc(samples, sr, varargin) %[cepstra,aspectrum,pspectrum] = melfcc(samples, sr[, opts ...]) % Calculate Mel-frequency cepstral coefficients by: % - take the absolute value of the STFT % - warp to a Mel frequency scale % - take the DCT of the log-Mel-spectrum % - retu...
%% Parameters for Techinal indicators inc_macd = 1; % Moving Average Convergence/Divergence (MACD) inc_stochosc = 1; % Stochastic oscillator inc_tsmovavg = 1; % simplean and exponential moving average inc_tsmom = 0; % Momentum between times inc_rsindex = 1; % Relative Strength Inde...
clc; clear all; % close all; warning('off', 'all'); Clk_M = 1; Clk_M_Value = 5e-9; mu = 5; sigma = 2; leftDiscard = 0; rightDiscard = 2; numIter = 100; numAddresses = 100; numBits = 32; bitReadTime = 1* Clk_M; switchDetectTime = 0.2 * Clk_M; global rwArray; % Offset Multiplier Tests writeBufferSize = 5; % 1:10; ma...
function FeatureStore=SyncFeatureParams(Module, FeatureStore, FeaturePrefixStr, ModulePara) TempIndex=strmatch(FeaturePrefixStr, Module); if ~isempty(TempIndex) FeatureName={FeatureStore.Name}'; TempIndex=strmatch(FeaturePrefixStr, FeatureName); if ~isempty(TempIndex) for i=1:length(Temp...
%clear all %load('dt_0.001000 damp_30.000000 N_800 k=80.000000 br=14.000000 cr=92.000000 var=1.mat'); load('Two_BDAC_offset_dist_330_184core_GNC_sep_1nm_copy.mat'); [Xs,Ys,Zs]=sphere(20); %hf=figure; %ha=axes; hold on for i=1:1600 xs1=(Xs*16e-9)+xt(i,1)*1e-9; ys1=(Ys*16e-9)+xt(i,2)*1e-9; zs1=(Zs*16e-9)+xt(i,3)*1e-9; ...
function [ b ] = beta( g,g_old ) %Actualización de Fletcher-Reeves b=(g'*g)./(g_old'*g_old); b=diag(b,length(b)-1); end
classdef TPA_PositionManager % TPA_PositionManager - Detects position info and update this info according to view. % Resonsible for time zone and data rescaling % Inputs: % different % Outputs: % different %----------------------------- % Ver Date Who Descr %------...
function [ out ] = moving_avg( in, windowSize, overlap) %MOVING_AVG Summary of this function goes here % Detailed explanation goes here l_in = length(in); halfWindow = windowSize/2; i = halfWindow; iMax = l_in - halfWindow; noOverlap = windowSize - overlap; %window = (hamming(windowSize))'; % hamming window wind...
% Copyright 2014 % % Licensed under the Apache License, Version 2.0 (the "License"); % you may not use this file except in compliance with the License. % You may obtain a copy of the License at % % http://www.apache.org/licenses/LICENSE-2.0 % % Unless required by applicable law or agreed to in writin...
NET.addAssembly('C:\Users\sunsh\source\repos\Spectrometer\Spectrometer\bin\x64\Debug\Spectrometer.dll'); instance = Spectrometer.Detect(); x = 'flower'; raw = instance.Test(1); spectrum = double(raw); ds = datastore % for i=1:8 % raw = instance.Test(i); % spectrum = double(raw); % save(x,'spectrum...
fol_name = 'data/behav_w_css'; all = dir(strcat(fol_name,'/*.mat')); load('data/metadata.mat'); for k = 1:length(all) load(strcat(fol_name,'/',all(k).name)); css_input = metadata.stimuli==metadata.cues; css_response_neutral = ((subject.behav.raw.responses(1,:))'==metadata.cues)*1; css_response_aversive ...
function [A,V] = VMT_ProcessTransectsV3_new(z,A,setends) % Not used by current version %This routine acts as a driver program to process multiple transects at a %single cross-section for velocity mapping. %V2 adds the cpability to set the endpoints of the mean cross section %V3 adds the Rozovskii computations ...
function genplot_err_func_lambda_mu_fine_mmx(mu, lambda, id) addpath ../ addpath ../Datasets/Synthetic' data'/ addpath ../mmx_package/ addpath ../Tools fprintf('%f - %f - %f', mu, lambda, id); % clear; % close all; % clc; synthdata_2; % lambda = [1 8:1e-1:12 20 50]; % mu = 5:5:110; % lambda = [10]; % mu = 1e3; N...
% test for in-circle test n = 100; vertex = randn(2,n); face = compute_delaunay(vertex); % every edge should pass the test T = check_incircle_edge(vertex,face); % should be 0 sum(T~=1)
function noiseless_EDGE = detect_that_edge(I,stripewidth) %This is the main edge detection algorithm used %Input: Image (.JPG) %Output: EDGE2 variable with detected edges and 2 images plotted to show %the results visually % %Created by: Jaco Verster (versterrie@gmail.com) %Manual override %imagename = 'canoncrop.jpg'...
function [newImg,pixelCount] = BorderObjects(img) %Invert to make the objects white: img = imcomplement(img); %Apply morphology: %newImg=bwmorph(img,'remove'); SE = strel('square',3); i = imdilate(img, SE); %Create border: newImg = i-img; %Count border pixels: pixelCount = ...
function movieList = loadMovieList() %GETMOVIELIST reads the fixed movie list in movie.txt and returns a %cell array of the words % movieList = GETMOVIELIST() reads the fixed movie list in movie.txt % and returns a cell array of the words in movieList. %% Read the fixed movieulary list fid = fopen('movie_ids.txt...
function gen_BEMs %% assemble path restoredefaultpath; addpath(genpath(... '/usr/pubsw/packages/MMPS/MMPS_238/matlab')); addpath(genpath(... '/usr/pubsw/packages/MMPS/external/external.2013.11.08/matlab/')); %% subjs_dir = '/home/bqrosen/projects/bqrosen/CC/RECON'; subjs = dir([subjs_dir '/CCEP*']); subjs = {subj...
% Initialize Constants for F16 Simulation clear clc %% Define Constants % x - State Vector % VT = x(1); % Freestream Airspeed % Alpha = x(2)*RTOD; % Angle of Attack normalized to Degrees % Beta = x(3)*RTOD; % Angle of Sideslip normalized to Degrees % ...
function [dX_dEta] = dX_dEta(p,eta,xi) dX_dEta = 0; end
function image = customImageCrop( image ) % parameter definition format longg; format compact; fontSize = 20; % Crops and image automatically grayImage = image; % Get the dimensions of the image. % numberOfColorBands should be = 1. [rows columns numberOfColorBands] = size(grayImage); % Get all rows and columns wher...
load('iris.mat') n_train = length(X_data_train(:,1)); n_test = length(X_data_test(:,1)); %Only Consider features X2 and X4 d = 2; X_test = [X_data_test(:,2),X_data_test(:,4)]; X_train = [X_data_train(:,2),X_data_train(:,4)]; m = 3; ytrain_binary = [ones(35,1);-1*ones(35,1)]; ytest_binary = [ones(15,1);-1*ones(15,1)];...
classdef pepitoTools < fourierTools & imageTools & covarianceTools & psfTools & fittingTools end
function vp_param_experiments() timeHorizon = 12; % Create Automaton automaton = MHyProHAutomaton(); dummy_reset = MHyProReset(); dummy_reset.setMatrix(eye(11)); dummy_reset.setVector(zeros(11,1)); % Add basic settings settings.timeBound = 12; settings.jumpDepth = 20; %settings.uniformBloating = false; settings.cl...
clear, close all load('finnstats.merged.corrected.mat'); data = trigrams; gutenb = data(strcmp(cellstr(squeeze(meta(:,2,1:9))), 'gutenberg'), :); punk = data(strcmp(cellstr(squeeze(meta(:,2,1:9))), 'punkinfin'), :); yle = data(strcmp(cellstr(squeeze(meta(:,2,1:3))), 'yle'), :); sample_size = 100; ...
% This script breaks down the differences between the Bayesian % metropolis-hastings acceptance probability in textbooks and papers, and % the form in takes when it is implemented in algorithms. In books it % written as p(y|theta')*p(theta')/p(y|theta'')*p(theta''). However in % algorithms in term is evaluated as it's ...
%Function which return the perpendicular distance between a point and a %line % %Input: % [x,y]: point coordinates % l: struct with the segment defining the first line : l.A and l.B % %Return: % dist: The perperdicular distance between the point [x,y] and the line l % %Example of use: % l=struct('A',[-4,0],'B',...
function [ret_checks, ret_names] = uq_check_toolboxes() % UQ_CHECK_TOOLBOXES checks the availability of Matlab toolboxes fun = @(x)100*(x(2)-x(1)^2)^2 + (1-x(1))^2; x0 = [-1,2]; A = [1,2]; b = 1; %% check optimization toolbox try x = fmincon(fun,x0,A,b,[],[],[],[],[], ... optimset('Maxiter',1,'Display',...