text
stringlengths
8
6.12M
function verify_cl_stability(system, realization, xsize, c_mode, varargin) % % Checks robust stability property violation for closed-loop digital systems using a bounded model checking tool. % Function: VERIFY_CL_STABILITY(system, realization, xsize, c_mode) % % Where % system: represents a struct with digital system...
function [ output_args ] = TestTest( input_args ) %TESTTEST Summary of this function goes here % Detailed explanation goes here clc; ws = load ('classes2.mat'); class1 = ws.class1; class2 = ws.class2; pr = 2; % Amain(class1, class2, pr) % 68.5000 18.0000 45.0000 global w; plot(class1(:,1),class1(:,2),'ro',class2(...
clc clear all close all %% Read files [LabelTrain FeatureVectorTrain] = svmlread('books.train'); [LabelTest FeatureVectorTest] = svmlread('books.test'); LabelAssigned = -1*ones(size(LabelTest)); %% Pre-compute Norms for every vector NormTrain = zeros(1,length(FeatureVectorTrain(:,1))); NormTest = zeros(1,length(Feat...
classdef Archive < handle properties dim = 1; % dimension of the input space X (determined from x_mean) X = []; % archive - input-space data y = []; % archive - dependent-space data gens = []; % archive - generations of the data where they come from tolX...
function ulti_ErrGradDec(ang_X,ang_Y,nr) %Michael Williams 2015, Email:michael.williams.hy@gmail.com %I use the gradient decrease method to find the proper step lenth for the X %axis rotation and the Y axis rotation format compact clc tic numStep=100000; %prelocating of numStep to increase the speed rads = [10,13,17,2...
function [img_skel, branch_pts_image, labeled_vess_segs, vess_radius, binary_hs_image, hotspots_pts_image_dil, results_table_um_new_table, hs_diameter_table] = vessel_ntec_analysis_func(vessels_seg, dapi_img, particles, px_per_um, save_dir,sample_name) tic shortfile = sample_name; display(['Analyzing vessels for ' s...
function [ mass_assem, stif_assem] = be_beam_fe( n, m, ei, l, alpha ) me = m/n; le = l/n; [ mass_matr, stif_matr] = be_beam_matr( me, ei, le, alpha ); mass_assem_temp = zeros(2 * n + 2, 2 * n + 2); stif_assem_temp = zeros(2 * n + 2, 2 * n + 2); for j = 1:n mass_assem_temp(2 * j - 1 : 2 * j + 2, 2 * j - 1 : 2 * j...
function [x,n] = zeropad(x,n,N) if(min(N)<min(n)) for i = min(N):min(n)-1 x = [0 x]; end else for i = min(n):min(N)-1 x(1) = []; end end if(max(n)<max(N)) for i = max(n):max(N)-1 x = [x 0]; end else for i=max(N):max(n)-1 x(length(x)) =[]; end end n = N end
function [xhist, Phist] = mekf(x0, P0, W, V, rN, whist, yhist, dt) xhist = zeros(7,size(yhist,2)); xhist(:,1) = x0; Phist = zeros(6,6,size(yhist,2)); Phist(:,:,1) = P0; for k = 1:(size(yhist,2)-1) [xp, A] = prediction(xhist(:,k),whist(:,k),dt); P_p = A*Phist(:,:,k)*A' + W; [yp, C] = measurement(xp(1:...
clear, clc, clf %load('threes.mat') load threes -ascii %% Construct the mean three clc, clf colormap('gray') three_mean = mean(threes, 1) imagesc(reshape(three_mean,16,16),[0,1]) %% Plot eigen values mean_vector = mean(threes, 2)'; threes_zero_mean = threes' - mean_vector; covariance_matrix = cov(threes...
% This script analysis the relation between blocklength , power allocation % coefficient and user 2 distance under different power % calculate blocklength and power allocation coefficient according % different conditon clc; clear variables; close all; N = 1e6; N1 = 80; N2 = 80; eplsion1R = 10^-5; eplsion2R = 10^-4; ...
function [trcfiles,dwtfiles] = findTracesDwt( filenames ) % FINDTRACESDWT Look for .traces and .dwt files associated with input files %% Process input arguments narginchk(1,2); if ischar(filenames), filenames={filenames}; end %% trcfiles = cell(size(filenames)); dwtfiles = cell(size(filenames)); for i=1:num...
% Start EEGLAB [ALLEEG EEG CURRENTSET ALLCOM] = eeglab; % Replace this fields with your path and filenames datapath = '/home/mdynamics/Desktop/noahSPROJ_participants/5/uncut/'; datafilename = '5_uncut.edf'; datafile2save = 'test_export.edf'; % Import EDF using BIOSIG EEG = pop_biosig([datapath datafilename]); % Wri...
function main() addpath('~/asigDSIC/ETSINF/apr/p2/BNT') addpath(genpathKPM('~/asigDSIC/ETSINF/apr/p2/BNT')) for g=[1,2,4,8,16] out = sprintf('Numero de Gaussianas: %d',g); disp(out); for i=[1,2,4,8,16] out = sprintf('Numero de iteraciones: %d',i); disp(out); ...
%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ % DRIVER ROUTINE FOR THE B5200 EQUATION. % WITH F, MAS AND PDERV TO BE SAVED AS !SEPARATE! M-FILES. % AUGUST 2005. %^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function B5200 global MYtagSTIFF MYtagSTIFF = 1; ...
clc clear load('AdjustedCRNH02032016GANewton8W.mat') DataTable=CRNH02032016GANewton8W; clear AdjustedCRNH02032016GANewton8W ts = length(DataTable.LocalDay); sampleSizes = zeros(12,1); [prevMonth,prevDay] = convertDate(DataTable.LocalDay(1)); allpoints = zeros(365,24); seasonlabels{365} = []; % seasonlabels = zeros(1,3...
%Surface plot 3d [X,Y] = meshgrid(1:0.5:10,1:20); Z = sin(X) + cos(Y); surf(X,Y,Z) %phase one [X,Y] = meshgrid(1:0.5:10,1:20); Z = sin(X) + cos(Y); C = X.*Y; surf(X,Y,Z,C) colorbar %phase 2 [X,Y,Z] = peaks(25); CO(:,:,1) = zeros(25); % red CO(:,:,2) = ones(25).*linspace(0.5,0.6,25); % green CO(:,:,3) = ones(25).*...
function [C, sigma] = dataset3Params(X, y, Xval, yval) %EX6PARAMS returns your choice of C and sigma for Part 3 of the exercise %where you select the optimal (C, sigma) learning parameters to use for SVM %with RBF kernel % [C, sigma] = EX6PARAMS(X, y, Xval, yval) returns your choice of C and % sigma. You should co...
function y = CEC2020_functions(x) global fun_num; y = feval(@cec20_func, x', fun_num); end
maxTime = []; for ii=1:size(alltpAll,2) maxTime(end+1) = alltpAll(ii).maxTime; end maxTime = reshape(maxTime, lp.dims(2),lp.dims(1))' figure; imagesc(maxTime);
function Sigma_Vector=alpha_generator(l,M,nk) if l==0 || l>M-1 || nk>M display('wrong input parameter') Sigma_Vector=[]; return end flag_one=0; for k=1:nk-1 temp(k)=exp(j*2*pi*k/nk); if temp(k)==exp(j*2*pi*l/M) flag_one=1; end end if flag_one...
// // Game.m // MoonHerder // // Created by Roger Engelbert on 10/9/12. // Copyright Done With Computers 2012. All rights reserved. // #import "Game.h" // Game implementation @implementation Game @synthesize screen = _screen; @synthesize sounds= _sounds; @synthesize images = _images; @synthesize gameData = _gam...
clear;clc; syms q1 q2 o_x o_y o_theta dq1 dq2 do_x do_y do_theta ddq1 ddq2 ddo_x ddo_y ddo_theta real syms m_l L I_l w m_o I_o g real syms tau_1 tau_2 real theta = [q1;q2]; dtheta = [dq1;dq2]; ddtheta = [ddq1;ddq2]; x = [o_x; o_y; o_theta]; dx = [do_x; do_y; do_theta]; ddx = [ddo_x; ddo_y; ddo_theta]; % Local coord...
function ring=atsetshift(varargin) %ATSETSHIFT sets the misalignment vectors % % RING=ATSETSHIFT(RING, ELEMINDEX, DX, DY) sets the entrance and exit misalignment vectors % of one element or a group of elements in the globally defined lattice THERING. % % ELEMINDEX contains indexes of elements to be misaligned % DX, DY...
function init_lgear global Lgear global Geom NN=2; % Main Gear Parameters %-------------------------------------------------------------------- % Local Parameters: %-------------------------------------------------------------------- xpos = Geom.Wing.xwac + (6.05*0.3048 - 0.25*2.865); % X pos of...
function [q_right, q_left] = move_legs (Ts, T_tot, q0_right, q0_left) Tss = 1.5; %time for the step in single support Tds=1; Tstop=1.5; T = 2*(Tss+Tds); % step conditions L = 0.07; %step length %************************************ % double support phase on right leg * %**********...
% MOROZOV(A, M, DELTA, INIT_GUESS) % Calculates the alpha parameter using Morozov's discrepancy principle. % Parameters: % - A = the filter matrix from the matrix model % - M = measurement data % - DELTA = approximation of the level of noise in measurement data % - INIT_GUESS = initial guess of the alpha parameter % % ...
clear all n = 10; M = [1:n]'; I = (2:n); tic; N = cumsum(M(I),'reverse')'; toc tic; sum(triu(ones(length(I)),0).*M(I)',2)'; toc tic; sum(triu(repmat(M(I)',length(I),1)),2); toc
%% Esempi di errore figure(1) img_nprocs = imread('errore_nprocs.png'); image(img_nprocs) title('Errore: numero di processori non positivo'); figure(2) img_dim_int = imread('errore_dim_non_intere.png'); image(img_dim_int) title('Errore: le dimensioni devono essere valori interi'); figure(3) img_dim_neg = imread('erro...
model = createpde; importGeometry(model,'Torus.stl'); pdegplot(model,'FaceLabels','on')
% PART A | Initiation clear all; close all; clc exlPath = 'D:\UMD\764 Quantitative Investment Strategy\Matlab Exercises'; exlFileListInSample =... {'lab5_data_2003_2004.xlsx', 'lab5_data_2004_2005.xlsx',... 'lab5_data_2005_2006.xlsx', 'lab5_data_2006_2007.xlsx','lab5_data_2007_2008.xlsx'}; exlFileListOutOfS...
function fx = example6_2_9_2(OutTol,InTol) %OutTol 外层dblquad精度 %IntTol 内层dblquad精度 m = 1; n = 1; a = 1; b = 1; km = 2 * m * pi/a; kn = 2 * n * pi/b; function z = Tf_Integrand(u,v) f_rel = @(x,y)(1 - cos(km * x)).* (1-cos(kn * y)).* cos(u.* x + v.* y); f_img = @(x,y)(1 - cos(kn * x)).* (1-cos(kn * y...
%%% Stochastic runs calculating extinction times for the SEIR model with %%% a varying level of disease induced mortality alpha for fixed %%% other parameters \gamma, \beta_F and \beta_D %%% Both population extinction and disease extinction are considered %%% In all scenarios an outbreak, defined as the susceptible p...
function [y_cp] = SpanLoading(l_s, l_t, CL, geo, panel) %Determine center of pressure and spanwise loading %due to bound vortices and trailing vortices. BV = [panel.BV]; BV1 = [panel.BV1]; s = [panel.s]'; y_cp.alpha = sum([l_s.alpha].*BV(2,:)' + [l_t.alpha].*BV1(2,:)')/(0.5*CL.alpha*0.5*geo.b); %Eqn 35 in N...
% function ndhist % (MEX FILE) % H = ndhist(S,bins,mins,maxs) % % inputs: % S -- nD x nSamples matrix of elements to be histogramed % bins -- nD x 1 vector of # bins for each dimension % mins -- nD x 1 vector of min values for each dimension % maxs -- nD x 1 vector of max values for each dimension % % H -- n...
%sc50 -1st Line of script sc50 clc clear all N = 100; kr = 16; k1=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]; pr=[0.3028 0.21 0.147 0.1029 0.072 0.0504 0.0352 0.0247 0.0172 0.0121 0.0084 0.0059 0.0041 0.0029 0.002 0.0014]; xd(1:N)=0; for k=1:N xd(k)=gen57(k1,pr); end %матожидание заданной СВ m = 0; for i=1:kr m =...
function [F] = pFlux(u,V0,a) % Calculates the flux vector for a system of nonlinear advection % equations in polydisperse sedimentation % % [F] = pFlux(u,a) % % F: calculated flux % u: states vector of dispersed phases % V0: relative velocity law constant % a: exponents vector %...
% Funkcja Rungego f = @(x) (1)./(x.^2+1); % I jej pochodna (taką mam nadzieję...) fd = @(x) (2).*x./(x.^2+1)./(x.^2+1); % Zakres, do którego należy n Z = 1:10; E = []; Es = 1; for n = Z % Liczba próbek wynosi 2^n N = 2^n; X = linspace(-5, 5, N); Y = f(X); Yd = fd(X); pp = hspline(X, Y,...
function M = get_M_flag( R_rho, R_th, h0, nel, nb, parms ) %Builds the mass matrix for the DIMENSIONLESS system of equations. %The dimensional form has a factor rho*A that pre-multiplies the matrix, %where rho is the mass per unit volume and A is the cross sectional area. %In the dimensionless form of the equations,...
function sOut = makeHtmlTable(M, T, rowNames, colHeaders, colors, strPrecision) %MAKEHTMLTABLE Display matrix contents as an HTML table % makeHtmlTable(M) where M is an array % makeHtmlTable(M, T) where T is a cell array of strings equal in size % to M. The contents of T are displayed preferentially when T i...
path_arr = strsplit(mfilename('fullpath'), {'/', '\'}); path_arr(end) = []; base_path = strjoin(path_arr, '/'); addpath(base_path + "/robot/");
function symbol = detect_symbol(mask) % Devuelve la forma de las figuras de cada carta. % Calculamos las distintas componentes conexas de la m�scara y las CC = bwconncomp(mask); labels = labelmatrix(CC); % Proporciona el grado de inclinacion de la componentes conexas con % respecto a la horiz...
%========================================================================= % % Empirical power of the Breitung test % %========================================================================= clear all clc % Parameters t = 1000; cv = [0,-5,-10,-15,-20]; reps = 100000; tdf = zeros(reps,length(cv)); rho = zero...
function f_disprof_clustPlot(result,txt,top,scale) % - plot dendrogram of a DISPROF-based custer analysis % % USAGE: f_disprof_clustPlot(result,txt,top,scale); % % result = structure of results obtained from 'f_disprof_clust' function % txt = cell array of row labels, if empty autocreate % e.g., txt = {'A' ...
function [ kl ] = kl( p, q ) %KL calculates Kullback-Leibler divergence for given input densities if isstruct(p); p = p.z; end if isstruct(q); q = q.z; end p = p ./ sum(p(:)); q = q ./ sum(q(:)); assert( all( p(:) >= 0 ) ); assert( all( q(:) >= 0 ) ); kl = p .* log(p./q); kl(isnan(kl))=0; if any(isinf(kl(:))) %warni...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Created: 04-Apr-2014 16:53:06 % Computer: GLNX86 % Matlab: 7.9 % Author: NK %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % integrates over depth to calculate % -Brunt Väisälä frequency % -Rossby Radius % -Rossby wave first baroclinic phase speed % TODO redo ALL !!! function S01b_fromRaw...
%Name: David George %StudentID: 251004930 T = input_data(); %Part A) ans = var_prob(T, 'npreg', 2); disp(ans); %Part B) compareFigure(T); %Part C) D = table2array(rmmissing(T(:,[1:6]))); D = squareform(pdist(D)); %Classical MDS MDS = cmdscale(D, 2);...
function [ w ] = weight_update( X, w, mu ) %WEIGHT_UPDATE Update weights using gradient ascent. % The ascent step is given by solving for the gradients of % F[w] = 1/n * \sum_i w_i + \sum_i \int_{V_i} |x_i - x|^2 - w_i d\mu % % Explicitly, we can compute % dF/dw_i = 1/n - \int_{V_i} d\mu % which leads t...
load 'file' N_hidden = 12; learningrate = 0.0015; iter = 300; A = imread('image.jpg'); row = col = A = A(row,col,:); imshow(A); A = rgb2gray(A); A = resize(A, [16 16]); A = double(abs(A-255)/255); A = A'; A = reshape(A, [1 256]); [percenterror W_1 W_2] = ANNRun(N_hidden,learningrate,iter); [neg_loglike,output_y] =...
clc clear csi_trace=read_bf_file('G:\无源感知研究\数据采集\2019_04_02\sample_2_1.dat'); L=length(csi_trace); amplitudeA=zeros(L,30); amplitudeB=zeros(L,30); amplitudeC=zeros(L,30); phaseA=zeros(L,30); phaseB=zeros(L,30); phaseC=zeros(L,30); for m=1:L csi_entry=csi_trace{m}; csi=get_scaled_csi(csi_entry); %csi1=...
function [corr_reg,mse_reg] = CreateScatter(bctarget,target,output,flagRegioMat,iSc,nx,ny,nomeDir,aqi,absdel) %independent scenario validation scatter %create scatter for abs and delta values nameFile={'absValScatter-sce-n','delValScatter-sce-n'}; if absdel==0 scatterTarget={'target','bctarget-target'}; scatte...
function out=jdDpxExpHalfDomeRdkAnalysisSpeed_LK_NoPool_unlim_deltaFF_opt2(files,option,gainOrYaw,phiOrIhp) % Analyze halfdome mouse on ball data % see also: % jdDpxExpHalfDomeRdkAnalysisSpeedSlidWin % jdDpxExpHalfDomeRdkAnalysisSpeedEarlyLate % if ~any(strcmpi(gainOrYaw,{'gain',...
function clearKeyboard % clear keyboard buffer %% prepare keyboard while KbCheck; end
function [ti, seq, exitflag] = detectStructure(tout, nu) % ok if exitflag = 1 ti = []; seq = []; exitflag = -1; LW = 1.5; axisColor = 'k--'; fini = 0; while(fini==0) fini = 1; textt = ['Click on the figure to give the structure (press enter when it is done): all time...
clear; importfile('Falmouth2004.dat'); % Choose proper wind speed data from all data set speed=data(51:800,1); speed=speed'; % use autoregressive train=speed(1,1:500); forpredict=speed(1,501:700); RMSE=zeros(1,11); MAPE=zeros(1,11); for i=2:12 model= ar(train,i); [m,n]=size(model.a); coef=zeros(m,n-1); for p=2:n ...
function [model] = softmaxClassifierL1(X,y,lambda) % Compute sizes [n,d] = size(X); k = max(y); W = zeros(d,k); % Each column is a classifier [W(:) ] = proxGradL1(@softmaxLoss,W(:),lambda,500,X,y,k); model.W = W; model.predict = @predict; end function [yhat] = predict(model,X) W = model.W; [~,yhat] = max(X*W,[],2); ...
x=0:pi/180:2*pi; for i=1:20, phi=2*pi/20*i; plot(x,sin(x+phi)); drawnow; M(i)=getindexedframe; end; aviwrite('sinewavemovie.avi',M,4);
function A = gs3_readstatus(serobj) %A = GS3_READSTATUS(SEROBJ); % % gets the GS3 multiplexer status % %-------------------------------------------------------------------------- %-------------------------------------------------------------------------- % Sharad J. Shanbhag % sshanbha@aecom.yu.edu %--------...
function [cv_abs_err, train_abs_err] = svr_exclude_feat(train, cv, exclude) train_inputs = train(:, 1:9); cv_inputs = cv(:, 1:9); train_m = size(train_inputs, 1); cv_m = size(cv_inputs, 1); train_y = train(:, 10); cv_y = cv(:, 10); train_reduced_X = reduced_features(tra...
clear all clc %% outline %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % load Mat_en_XP_anntest.mat re=dat_En_pr; si=out_si_pr_en_new; ind=find(abs(si-re)>0.01); h=fun_plot_res_sqr(re,si,['pr 17-60 rand 10000']); hold on plot(re(ind),si(ind),'ro') % fi_na=['../imgs/en/10en_atom_dis_anntest/cong...
function feature = tumour_histogram(tumour) tumour_h = reshape(tumour, numel(tumour), 1);%%将肿瘤图像拉伸为一维向量 k = 1; for i = 1:length(tumour_h) if tumour_h(i) ~=0 tumour_adjust(k) = tumour_h(i); k = k+1; end end %% 常规参数计算 tmax = max(tumour_adjust); %%最大值 tmin = min(tumour_adjust); %%最小值 tmean = mean(t...
classdef ClassificationTree < ... classreg.learning.classif.FullClassificationModel & classreg.learning.classif.CompactClassificationTree methods(Hidden) function this = ClassificationTree(X,Y,W,modelParams,... dataSummary,classSummary,scoreTransform) if nargin~=...
% function [imdb] = mining_tuples(imdb_in,total_fea,bthid,opts) % imdb = gen_tuples(imdb_in,total_fea,bthid,opts); % end function imdb = gen_tuples(imdb_in,total_fea,bthid,opts) mode = opts.mode; mining_per_batch_num = opts.mining_per_batch_num; batchsize = opts.batchsize; neg_num = opts.neg_num; ...
% summarize Sumarize object contents % % This method summarizes the contents of a group. % >> summarize(group); % results printed to command window % >> name=summarize(group); % object names returned as an output % % See also BoundingCurveGroup, view % % % created December 15, 2014 by Daniel Dolan (Sandia Na...
function replan = safety_entrance(replan, i) global robot zone total_path_len zone_diff = robot(i).next_zone - robot(i).cur_zone; % [-1,0], up % [1, 0], down % [0, 1], right % [0, -1], left all_cur_pos = cellfun(@(x)x(1,:),{robot(zone(robot(i).next_zone(1),robot(i).next_zone(2)).robot).path},'un',0); all_cur_pos = re...
function [y]=fun(k,x) A=k(1); t2=k(2); y=(A).*(exp(-x./t2)); % y=(A).*(exp(-x./t2));
%% Research Topic : Modeling multilayer Building Envelopes %% Author : Sajith Wijesuriya, Nick Kincaid, Paulo Tabares %% Institution : Department of Mechanical Engineering, Colorado School of Mines %% Research Group : Dr. Tabares Research Group %% File Feature : Discreetization intended fo...
function qsm_7T_bipolar(path_mag, path_pha, path_out, options) % Re-define the following default settings if necessary % % PATH_DICOM - directory for input GE dicoms % PATH_OUT - directory to save nifti and/or matrixes : QSM_SPGR_GE % OPTIONS - parameter structure including fields below % .read...
function p = OutputPath(R) %% 输出路径函数 % 输入:R 路径 R = [R,R(1)]; N = length(R); p = num2str(R(1)); for i = 2:N p = [p,'—>',num2str(R(i))]; end disp(p)
clc clear all eps = 1; % Погрешность etl = 100; % Конец отсчета % Синусоидальный сигнал mPi = 2.5; f = 20; % Частота f0 = 7; % Сдвиг (фаза) t = 0:eps:etl; s = 5 * sin(2 * mPi * f * t + f0); % Амплитуда 7 figure;...
function T67=T67(h) T67=-1.96e-3*h+373.2;
function portfTWR = calculatePortfTWR(PnlTable, totPnl0, ... tableAcc, dividendsTable, varargin) % this function calculate the TWR of the portfolio % input: % PnlTable = each asset pnl % totPnl0 = total value invested % tableAcc = historical purchases % dividendsTable = table with all dividends % varargin...
%Compute properties for parabolic cylinder coordinates clear all; syms u v p real X=[u*v*cos(p); u*v*sin(p); (u^2-v^2)/2]; J=[diff(X,u),diff(X,v),diff(X,p)]; bco=J; bcn=simple(inv(J).'); gco=simple(J.'*J); gcn=simple(inv(gco)); h=sym(zeros(3,3)); cs1=h; cs2=h; h(:,:,1)=diff(J,u); h(:,:,2)=diff(J,v); h(:,:,3)=dif...
% book : Signals and Systems Laboratory with MATLAB % authors : Alex Palamides & Anastasia Veloni % % % % Problem 8- Discrete time system % a)delay of two units num=[1 0 0]; den=[1 .2 .01]; Ts=0.1; H1=tf(num,den,Ts); H2=tf(num,den,Ts,'inputdelay',2) % b)impulse response of H1(s) n=0:8; h=dimpu...
clear; clc globalVariables rng(seed); load(strcat(data_dir, 'train_dataset.mat')) data = cell(0); label = []; counter = 0; for i = 1:length(data_set) d = data_set{i}; img = imread([data_dir d.name]); f_bs_len = length(d.false_bs); for j = 1:length(d.bs) counter = counter + 1; ...
function [s_val, s_time] = calculate_settling_values_f(time, func) s_val = func(end); s_time = time(end); for ii = length(time):-1:1 if ( abs(func(ii) - func(end)) >= func(end) * 0.05 ) s_time = time(ii+1); s_val = func(ii); break; end end end
% book : Signals and Systems Laboratory with MATLAB % authors : Alex Palamides & Anastasia Veloni % % % Frequency Response of a system described by the impulse response % h(t)=exp(-t)u(t) syms t w h=exp(-t) *heaviside(t) H=fourier(h,w) w1=0:.1:10; HH=subs(H,w,w1); plot(w1,abs(HH)); title ('Frequency r...
Img=imread('test.jpg'); imgsize=size(Img); subimg_width=round(imgsize(1)/2); subimg_height=round(imgsize(2)/2); num_width_spilt=ceil(imgsize(1)/subimg_width); num_height_spilt=ceil(imgsize(2)/subimg_height); num=num_width_spilt*num_height_spilt; for i=1:num_width_spilt for j=1:num_height_spilt if(i*su...
%% Random indoor environment generator % This matlab script makes random environments within a given boundaries of % an environment. The corridors are generated by virtual agents, started from % each location that the robot in the final environment will start from. This % script ensures that the generated corridors are...
function succes = infosave(infostr, filename, varargin) %<<<1 % input possibilities: % infostr, filename % infostr, filename, autoextension % infostr, filename, autoextension, overwrite % check inputs %<<<2 if (nargin<2 || nargin>4) prin...
function [q_rid,dist_pt,scales]=build_q_arr(dir,NppEdge) % build q values for plotting dispersion line on a spagetti plot. % Inputs: % dir -- cellarray of 3-vectors, defining spagetti plot ref points % NppEdge -- number of q-points for each spagetti plot direction % Outputs: % q_rid -- cellarray of q-points {qh,qk,ql} ...
close all clear all initialize_folder_names initialize_TAE_map_calculation_context; TAE_parameters; initialize_XZ_maps_dimensions; rescaling_to_XZsmall_maps; size_r_TAE=pTAE_sup-pTAE_inf+1 finesse_data_X=reshape((Rpos_PR_map(:,pTAE_inf:pTAE_sup)-R0),NP*size_r_TAE,1); finesse_data_Z=reshape(Z_PR_map(:,pTAE_inf:pTAE_su...
function y = reconstructMMSE(xn, tn, t, kernel, reg, eps) SS = kernel(tsh(tn,tn)); if reg == 1 if eps > 0 c = (SS+eps*eye(length(tn)))\xn; else c = pinv(SS)*xn; end; else c = SS\xn; end; y = kernel(tsh(tn,t))*c;
figure(1); clf; hold on; %% Using filter X = [1/2 1 1/2 0 0]; B = [1/4 1/4 1/4]; A = 1; Y = filter(B, A, X); N = [0:length(Y)-1]; stem(N, Y, '+'); %% After solving for the impulse response X = [1/2 1 1/2]; H = [1/4 1/4 1/4]; Y = conv(X, H); N = [0:length(Y)-1]; stem(N, Y);
%script to assemble data for HSMM testing clear variables; clc; %unique ID ID = 10; %number of observation symbols Nobs = 9; %% ================ INIT PARAMETERS ======================================= %number of hidden states Nhid = 8; %max duration Dmax = 50; %min duration Dmin = 1; [A1_init A_init Afull D_in...
function [x,y] = measureShift(ixcorr) % measure the shift of img relative to refImg from xcorr = fft2(img).*conj(fft2(refImg)) sz = size(ixcorr); assert(length(sz)==2 && all(sz(1:2)>=128 & mod(sz(1:2),2)==0), ... 'image must have even height and width, at least 128 in size') phase = fftshift(angle(ixcorr)); mag ...
result_path = 'D:\Documents\University\Year 3\Individual Project\Code\Experiment Setting\Results\ToyData'; for i = 1:10 %% plot for anomalies true_model = save_model_with_noise(5*i); path = 'D:\Documents\University\Year 3\Individual Project\Code\'; mtl = MultiTaskLearning('toy_data'); mtl.loadData('...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Basic parameters that may be varied Ncase = 1; % Forecast case number. DAYLEN = 1; % Forecast length in days. DtHours = 1; % Timestep in hours. %% Indicator for psi-form of equation StreamFunction = 0; %%%%%%%%%%...
function as_stats_barplot_2(mask_stats,P_color) if ~exist('P_color','var') P_color = zeros(size(mask_stats,2),3); P_color(:,3) = [128, 128, 128]; end figure(1); cont=0; for i=1:size(mask_stats,2) cont=cont+1; bar(cont,mask_stats(i).axon_diam_mean,'FaceColor',P_color(i,:)/255); hold...
function [rbin]=rdfcalc(C,xlim,ylim) %This file takes a file containing the co-ordinates of the centers as %input, and finds the rdf %xlim=512; % The maximum x co-ordinate of the image %ylim=512; % The maximum y co-ordinate of the image n=size(C,1); rmin=1; rmax=100; dr=2; rvecarray=rmin:dr:rmax; ...
%% init packages % tick2text addpath('/home/lab/yuvval/git/tick2text-pkg/tick2text'); addpath('/home/lab/yuvval/git/tick2text-pkg/parsepv'); %% Init path for figs nowstr = regexprep(datestr(now,0), '-? ?:?', '_'); %figpath = ['/figs/results_' nowstr]; figpath = '~/www/figs/comet/'; overwrite_fig = false; %% hdsl_res...
% testaStruct carro.fabricante = 'Ford' carro.potencia = 145 carro.portas = 4 carro.cores = ["amarelo";"azul";"vermelho";"verde";"branco"]
clc; clear all; close all; o1 = zeros(986, 1606); o2 = zeros(986, 1606); o3 = zeros(986, 1606); filenames = dir('/Users/alex/Desktop/TFM Videos/Sincronizados/Recording 5/Wrapped Images/Camera 1/*.png'); for i = 1:numel(filenames) image = imread(['/Users/alex/Desktop/TFM Videos/Sincronizados/Recording 5/Wrap...
clear clc close all disp('Please input n, rho as: [200,0.5]') ; disp('Feel free to vary nu between 1 and 0 to see the different effects') disp(' ') ; para=input('[n, roh]='); disp(' '); disp('Please input sig as: [1 0.5; 0.5 1]') ; disp(' ') ; sig=input('[sig]='); n=para(1); rho=para(2); [vector,value] =...
function varargout = DlgPseudo(varargin) % DLGPSEUDO MATLAB code for DlgPseudo.fig % DLGPSEUDO, by itself, creates a new DLGPSEUDO or raises the existing % singleton*. % % H = DLGPSEUDO returns the handle to a new DLGPSEUDO or the handle to % the existing singleton*. % % DLGPSEUDO('CALLBACK',hO...
function entropymeasure = entropyMeasure(dim, r, data, tau, method) % compute approximate entropy or sample entropy where measure is the method % used switch lower(method) case 'approximateentropy' entropymeasure = ApEn( dim, r, data, tau ); case 'sampleentropy' entropymeasure = SampEn( dim, r,...
dat = readtable("drugs-trial.csv"); dat.id = uint32(dat.id); dat.age = uint32(dat.age); dat.type = string(dat.type); dat.VL = double(dat.VL); % This creates a viral load measured from the blood sample and makes sense % of this shit %a) How many patietns arei in the whole data set n = length(unique(dat.id)); ...
function c = progprincipal(Ne,fun) X=feval(@pointmaillage,Ne); %tableau de maillage % Construction de la matrice M M=sparse(Ne+1,Ne+1); for(k=1:Ne) for(iloc=1:2) ig = k+iloc-1; for(jloc=1:2) jg = k + jloc-1; M(ig,jg) = M(ig,jg) + simpson('produitphi',X(k),X(k+1),k,iloc,jloc...
function [ E, t ] = evaluate( Pop ) E = zeros(size(Pop, 1), 1); for i=1:size(Pop, 1), s = 0; t = 0; for j=1:size(Pop, 2)-1, for l=j+1:size(Pop, 2), if Pop(i, j) == Pop(i, l) || Pop(i, j) == Pop(i, l) - (l-j) || Pop(i, j) == (l-j) + Pop(i, l), %linhas e diagonal ...
%calibrationFunc_hammingLoss_constrScores_numerical numerically computes the calibration function for the Hamming loss on binary variables % when the scores are oconstrained to be separable (Figure 1a, blue; Proposition 13). % The formal derivation is provided in Proposition 13: H(eps) = eps^2 /(8 * T), where T is the ...