text
stringlengths
8
6.12M
function cs = contour_curvature( cont ) ispl = 1 : 10 : size(cont, 1); cs = zeros( length(ispl), 1 ); for i = 1:length( ispl ) cs(i) = curvature( cont, ispl(i), 5 ); if isnan( cs(i) ) disp('sss'); end end
function [V,vsize,vdim,info,affineparams] = dicomVolRead(pathname) disp('This function fits with ReadAnalyze!') %DEFAULT_SLICE_THICKNESS = 3; if nargin < 1 pathname = uigetdir(pwd,'Choose dicom directory') ; if pathname ==0 error([ 'No directory selected.' ]) end end files = dir(pathname); disp(['Readin...
function [evaluation,fpred,model] = runGPFM(model,outputDirectory, prefix, train, test, conf, opt) %RUNGPFM runGPFM(outputDirectory,prefix train, test, conf, opt) % % INPUT: % - outputDirectory : directory to store the log and results % - prefix : prefix to use in the auto-generated result file name % (usually n...
%% Assemble Stiffness Matrix K = zeros((M+1)*(N+1),(M+1)*(N+1)); kk = [1/3, -1/12, -1/6, -1/12; -1/12, 1/3, -1/12, -1/6; -1/6, -1/12, 1/3, -1/12; -1/12, -1/6, -1/12, 1/3]; for i = 1:length(elements) nodes = elements(i,:); hx = verts(nodes(2),1) - verts(nodes(1),1); hy = verts(nodes(4),2) -...
%ReadBag % Copy the specified topic messages from rosbag to a table. % A discription file 'propertyTable.csv' is needed. % Gxb 2021-09-05 clc clear global typeName global typeNum [file,path] = uigetfile('*.bag',... 'Select One or More Files', ... 'MultiSelect', 'on'); if isequal(file,0) disp('User selected Ca...
function project_copes(session_dir, subject_name, copeNames, hemis, ROIs, funcs) % project_copes(session_dir, subject_name, copeNames, hemis, ROIs, funcs) % % Loop wrapper function for psc_copes. % % Input arguments: % ================ % % session_dir : path to the session directory; % subject_name : Freesurfer...
function hypKernel = medianTrick(samples, medianScale) if nargin < 2 medianScale = 0.1; end for i = 1:size(samples, 2) dist = maha(samples(:, i), samples(:, i)); hypKernel(i) = medianScale*median(reshape(dist, [], 1)); end
function epigraph % The epigraph of a convex function is a convex set. % % Code by Matthew Dunham f = @(x)(x-4).^2; domain = (0:0.01:8); subdomain = 0:0.1:8; xline = max([subdomain;subdomain+1]-1,min(domain)); yline = [f(max(domain))*ones(size(subdomain));f(subdomain)]; p1 = line(xl...
clear;clc load mydata.mat % 导入数据(共三列,分别是S,I,R的数量) global true_s true_i true_r n % 定义全局变量 n = size(mydata,1); % 一共有多少行数据 true_s = mydata(:,1); true_i = mydata(:,2); true_r = mydata(:,3); figure(1) plot(1:n,true_i,'b-',1:n,true_r,'g-') % 单独画出I和R的数量 legend('I','R') % 粒子群算法来求解 % beta1,beta2,a,b % 给定参数的搜索范...
function integral = compoundTrapezoid(a, b, m) h = (b - a)/(m - 1); integral = 0; xn = a; for i = 0: m - 2 xNext = a + h * (i + 1); integral = integral + h * (myFunction(xn) + myFunction(xNext)) / 2; xn = xNext; endfor endfunction
clear; close all; clc; % Step 1 : load data fprintf('Loading data...\n'); data = load('data.txt'); data_size = size(data, 2); % X = features, y = output, n = number of features, m = number of examples X = data(:, 1:data_size - 1); y = data(:, data_size); n = size(X, 2); m = size(X, 1); fprintf('Loaded %d features wi...
function [block64out] = des_final_permutation(block64in) % DES_FINAL_PERMUTATION(BLOCK64IN), permute bit, used after applying des last round ip = [40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31, 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29, 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51...
function err = naivePerfusionSSEIntegratorfullerStickP2X7(ton,toff,Ttot,amp,T,I) %#codgen; naive=zeros(1,13); naive(1)=1; V=-60*10^-3; err=errorIntegratorfullerStickP2X7(ton,toff,Ttot,amp,naive,T,I,V); end
function [mu, s, a, gf] = fit_logn(X, Y, varargin) %fits lognormal distribution to histogram data %FIT_LOGN fits lognormal distribution to histogram data (value and count), %initial guess for mean and standard deviation can be given as optional %arguments. Return values are mean, standard deviation, scaling factor ...
% book : Signals and Systems Laboratory with MATLAB % authors : Alex Palamides & Anastasia Veloni % % % % Discrete time convolution % x=[1,2,3,4,5],0<=n<=4 % h=[1,2,1],-1<=n<=1 %1st approach n=-1:4; x=[0,1,2,3,4,5]; h=[1,2,1,0,0,0]; subplot(121); stem(n,x); axis([-1.1 4.1 -.1 5.1]);...
% 描述竞争行为 function [pre_next_COORD, W] = compete(COORD, pre_next_COORD, W) global X global Y for i = 1:X for j = 1:Y N = ismember(pre_next_COORD, [i,j], 'rows') ; n = sum(N); if n <= 1 continue else M = find(N=...
function tests = barconTest( ) tests = functiontests(localfunctions); end% function setupOnce(this) close all this.TestData.Visible = 'off'; end% function testBarcon(this) if verLessThan('matlab', '9.1') return end x = Series(qq(2000,1), randn(40, 4)); y = sum(x, 2); figure('Visi...
function [fdcomm, radar, radar_comm, cov] = tsp_ini_wc(radar,fdcomm,radar_comm, cov) %%%%----------------------------------- %% Precoding matrices initialization I = fdcomm.UL_num; J = fdcomm.DL_num; K = radar.codelength; Mr = radar.TX; Nr = radar.RX; Mc = fdcomm.BSTX; %% Updating Sigma M = Mc + Mr; Sigma = zeros(M,M,...
function [k,notk] = eventon(cue,t) % % [k,notk] = eventon(cue,t) % k = 1 for points in t (time vector) when cue is on, 0 elsewhere. % cue is a list of events in the format: cue = [start_time,duration] % notk is the complement of k. if nargin~=2, help eventon return end k = 0*t ; cst = cue(:,1) ; ce =...
function func_ColorCSF % Show Contrast Sensitive Function (CSF) via color Sinwave stimulus % This function is part of the toolbox "Basic introduction to HVS" % % Command line % ---------------------- % func_ColorCSF % input: None % % output: CSF figure % % More information can be found in % S. E. Palmer, ...
clc clear all close all %% output file oid = fopen('results.csv', 'wt'); formatspec = '%0.4f, %0.4f, %0.4f, %0.4f, %0.4f, %0.4f, %0.4f, %0.4f\n'; fprintf(oid, 'Actual Height, Calculated Height, A, Pixel Height, Actual Skew Factor, Calculated Skew Factor, Percent Error, Distance\n'); dirname = 'test_images/'; label =...
% Offset_Reg_glm('lum', 'top'); clear all; % Offset_Reg_glm('lum', 'low'); clear all; % Offset_Reg_glm('lum', 'mean'); clear all; % % Offset_Reg_RF('lum', 'top'); clear all; % Offset_Reg_RF('lum', 'low'); clear all; % Offset_Reg_RF('lum', 'mean'); clear all; % % Offset_Reg_SVR('lum', 'top'); clear all;...
%% This script is used to create a 5 X 5 matrix function five_by_five_mat = five_by_five_mat(all_possible_comb_SS) for counter5=1:1:size(all_possible_comb_SS,3) collect_column=[]; for counter6=1:1:size(all_possible_comb_SS,1) column1 = (1/(sqrt(6)))*[all_possible_comb_SS(counter6,5,cou...
function energy = meshEnergy(vertices, faces) %MESHENERGY Computes the energy of a tesselation, as the sum of second area moments. % % This function can be used to check that the total energy of Centroidal % Voronoi Tesselation (CVT) decreases with the iterations of the Lloyd % algorithm. % % E = meshEnergy(V, ...
clear all figure(1); clf; termination = 100; x = linspace(-2,1,640); y = linspace(-1,1,480); x_index = 1:length(x) ; y_index = 1:length(y) ; M = zeros(length(y),length(x)); for k=x_index for j=y_index z = 0; n = 0; c = x(k)+ y(j)*i ;%complex number while (abs(z)<2 && n<termination...
function sirius_comm_connect(varargin) % sirius_comm_connect: conecta ao servidor de estado do anel UVX do LNLS. import java.net.Socket; import java.io.*; default_ip_address = '10.0.5.11'; default_ip_port = '53131'; ip_address = default_ip_address; ip_port = default_ip_port; AD = getad; if isfield(AD, 'PVServer')...
% sample from the conditional Indian Buffet Process % (one iteration of Gibbs update) % % inputs: % Z - sample to be conditioned on % alpha - as is % iord - a permutation of row indices % % outputs: % Z - updated sample % % Note: Samples can be lof-equivalent to each other in this case. % % Written by Minjie Xu (ch...
function sphere3d [x,y,z]=sphere(30); axis equal; surf(0.5*x,0.4*y,0.5*z); disp('Dalej? Enter'); pause; close; return
function [glmModel] = designMatrixBuilder_session(glmModel,glmnetOpt,selectedFeatures) %selectedFeatures is a vector with values corresponding to the values in %the DmatFields DmatFields = fields(glmModel{1}.io.components); for i = 1:length(glmModel) DmatX = []; dims = []; for g = 1:length(select...
% Cluster yeast data using Kmeans % This file is from pmtk3.googlecode.com % modified by E. Benetos 2017 load('yeastData310') % 'X', 'genes', 'times'); figure;imagesc(X); xlabel('time') set(gca,'xticklabel',times) ylabel('genes') title('yeast microarray data') colorbar figure; plot(times,X,'o-'); xlabel('time')...
function [mean_img,mean_diff_img,var,M,N] = parse_video_dataset2(fileformat,start_idx,end_idx,color) img_start = double(imread(sprintf(fileformat,start_idx))); prev_img = img_start(:,:,color); mean_img = img_start(:,:,color); mean_diff_img = img_start(:,:,color); [M,N] = size(img_start); var = size(M,N); pt_r = 1...
function dat = getchannel(ds, dname, syn) % Retrieves a specific data channel by name from ds.trd array % if syn is specified, gets a certain synapse's data % chdat will be an array: ntrain x sgdim(1) x sgdim(2) x sgdim(3) [ x 3 for color] if(~strcmp(dname, '')) chidx = find(strcmp(ds.trdlist, dname)); if(nume...
clear all; clc; fid = fopen('result.txt'); result = zeros(101,101); no_of_rows = 101; no_of_col = 101; for step = 1:50 for i=1:101 for j=1:101 result(i,j) = fscanf(fid,'%f',1); end end surf(result); pause(1); end %surf(result);
function [k, tab]=reson(ordre,period,fen) % reson(ordre, period, fen) % Recherche des droites de resonance a x + b y = c % passant dans la fenetre [x1 x2 y1 y2] % Ordre de la resonance |a| + |b| % Critere de recherche c = period * entie % eg: % Soleil % [k, tab] = reson(4,1,[18 19 10 11]) % % ALS % [k, tab] = reson(4,1...
%此程序研究多期下只收单一价格货物(当天发送,推迟到第二天则提供赔偿)的最优仓容问题---总量 %遍历法确定最优仓容,迭代法的解与之比较,表明迭代法可行 %试验最优值的稳定性--不同的随机种子 %固定歩距法 clc clear close all %% 参数设置 sj=100; %产生随机数的次数 n=100; %观测多少天 rate=1; %运价 fare=0.6; %仓容单位价格 p=0.2; %每延后一天,赔偿p D1=0.2E4; %试验仓容的最低值 D2=10.2E4; %试验仓容的最高值,D1和D2的取值是根据到货的分布 Gap=1000; %仓...
%% Test for distance assert(round(calcWD(32.8,3.4,1920,76))==150,'A 32.8p bullseye at "distance settings" should be 150cm away') %% Test for near assert(round(calcWD(41.1,3.4,640,76))==40,'A 41.1p bullseye at "near settings" should be 40cm away')
%function [IndicEq]=EquaIndic(ic,ir,rf,nx,ny,nSc,Indic) function [IndicEq]=EquaIndic(ic,ir,rf,nx,ny,Indic) %IndicEq: Indicator values for constant F %data (Indic) written as: %x1,yn ... xn,yn %x1,y1 ... xn,y1 % IndicEq=zeros(length(-rf:rf)*length(-rf:rf)*nSc,1); iEq=1; %for iSc=1:nSc %loop on scenarios %look for...
%% preprocess and store coordinates into a struct % drag the csv file to workspace and it will be stored as a table % change the name of the table to 'coords' framerate_Hz = 10; if ~exist('str','var') if width(coords)>=13 coords(:,[4,7,10,13])=[]; % delete the probability columns tableVariableName...
clc; clear; close all; % Deklarasi fungsi soal = @(x) 10.4 + x(1)*sin(3*pi*x(1)) + x(2)*sin(13*pi*x(2)); xbawah = [-2.0 3.27]; xatas = [15.5 8.75]; disp('************************************************************') disp('= *** GENETIC ALGHORITHM *** =') disp('= ** Fungsi fit...
function solution = main(conf) for m = 1:conf.NREPETS conf.I = m; fprintf('Executing run %d...\n',m); % Specified dataset is generated or loaded [Xtrain,Ytrain,Xtest,Ytest] = load_data(conf); % Specified algorithms are used for ialg = 1:length(conf.machine.algs) conf.machine.functio...
dataset_statistics = d([6 7 12 13],:); sizes = [500 1000 1500 8500; 500 1000 1500 2600; 500 1000 1500 8500; 500 1000 1500 8500]; for i=1:numel(public_datasets_training_validation) s = sizes(i,:); datatset = dataset_statistics(i,:); nonTest = datatset.docs - 1000; t = s ...
%read in the results data - you need both the text elements and the numeric elements [num text]=xlsread('results.xlsx'); %extract the maths, english and history data into vectors %this data is in the numeric part of the result of xslread [maths]=xlsread('results.xlsx', 'D2:D31'); [english]=xlsread('results.xlsx', 'E...
function [ts] = rstart(logicalState, varargin) % timings = pds.plexon.rstart(word) % % Set RSTART pin via (24-bit) datapixx digital outputs % RSTART pin may depend on pinout of particular datapixx-to-Plexon event cable config. % ...for whatever reason, our standard cable ties RSTART to Datapixx output pin 18 (==2^17) ...
function [ cos_i ] = cos_i_func( h_1, h_2 ) % rotate by angle: - acttan(h_2 / h_1) cos_i = h_1 / sqrt( h_1^2 + h_2^2 ); end
clear all; clc; close all noise = 1; tau = 0.02; T = 0.42; t = tau/2:tau:T - tau/2 ref = importdata('./results/reference_GT/p_drop_ref_h4_C60_est_sin_teman_beta_01.csv') subplot(2, 4, 1) A = importdata('./results/pressure_drop/pdrop_h0.1_tau0.02_noise0.csv') plot(0:0.002:0.45', -ref); hold on plot(t, A(:,1)) plot(t...
function v = mat2vec(I) v = I(1,:); n = length(I); for j = 2:n v = [v , I(j,:)]; end end
function [wp_dist_m]=get_wpdist(host, port) % [WP_DIST_M]=GET_WPDIST(HOST, PORT) % % Read distance WP_DIST of aircraft from current waypoint in % Flightgear over socket connection (HOST, PORT). % Run Flightgear on HOST (e.g. '127.0.0.1' = localhost) with % parameter "--props = PORT". import java.net.Socket i...
function [s,c,y] = graphComponents(A) %GRAPHCOMPONENTS finds the connected components in an undirected graph %using relaxation. % [S,C,Y] = GRAPHCOMPONENTS(G) finds the strongly connected components % using a relaxation algorithm. It is recommended only for SMALL GRAPHS. % % A strongly connected component ...
function A = P_2_A(P, Msize, non_self) % Given inter-modular connection probability matrix P % and module size vector Msize, generate full random connection matrix % based on E-R random graph. % % By defualt, no_self = 1 and all of the self-connection entries are % removed % Generate node module index Mnum = length(...
% test fitting acousto-optic mod split %% M = zeros(21,50); betas = linspace(0,8,50); ks = -10:10; for kk = 1:length(betas) for k= ks M(k-min(ks)+1,kk) = besselj(k,betas(kk)).^2; end end figure pcolor(betas, ks, M); shading flat %% load('./optical_mode_data/BTD7O1_1541nm_28dB_blasted_20190801T11...
function setAxes(handle, numData, simInterval) intervalsPerHour = 60/simInterval; startData = numData - 24*intervalsPerHour; endData = numData; displayInterval = 4; % show every 4 hours on x axis tickInterval = displayInterval*intervalsPerHour; HourTicks = [startData:tickInterval:endData...
addpath('./TSC1'); t = [0:0.01:500]; x = sin(t); A = 1.0; B = [0.1,0.5,0.9]; for Bstep = 1:1:length(B), fprintf('-- B = %.3f --------------------------------\n',B(Bstep)); y = zeros(length(x),1); for iter = 2:1:length(x), y(iter) = A*x(iter-1) + B(Bstep)*rand(); end xd = zeros(...
clc; clear all; close all; %rgb image input %path to sample image to perform convolution f=imread('C:\User.....'); f=rgb2gray(f); % incase of grey image input %taking the kernal as input w=input('Enter kernal values:'); %taking type of padding as input pad=input('Enter type of padding:\n1.Zero/Clip\n2.C...
clc clear close all %Izbacen je cevovod tople vode %% %Parametri Cp = 4181.3; %toplotni kapacitet [J/kgK] ro = 1000; %gustina vode [kg/m^3] Cdh =0.65; %koeficijent praznjenja ventila za hladnu vodu Cd1 = 0.65; %koeficijent praznjenja ventila za rezervoar 1 Cd2 = 0.65; %koeficijent praznjenja ventila za rezerv...
clear clc %% Time Specifications: Fs = 100; dt = 1/Fs; StopTime = 1; t = (0:dt:StopTime - dt)'; N = size(t, 1); %% Sine Wave: Fc = 12; x = cos(2 * pi * Fc * t); %% Fourier Transform: X = fftshift(fft(x)); %% Frequency Specifications dF = Fs/N; f = -Fs/2:dF:Fs/2-dF; %% Plot the spectrum: figur...
%function: sunriseandsetmeeus.m %calculates the time of the sun rising and setting for any given day and %location %inputs: %obslong: longitude of the observer's location, in degrees (west = %positive; east = negative... ) %obslat: latitude of the observer's location, in degrees (north = positive, %south = neg...
function [minim,difusiv,efusiv,phi,beta,tiempo] = DE_ajuste(m,bL,bU,Cr,gmax,fob) tic; n = length(bL); % Población ------------------------------------------ X = [rand(m,n).*(bU-bL) + bL]; % for g = 0:gmax g++; % Mutantes ----------------------------------------- V = zeros(m,n); for i = 1:...
function [J, grad] = lrCostFunction(theta, X, y, lambda) %LRCOSTFUNCTION Compute cost and gradient for logistic regression with %regularization m = length(y); % number of training examples J = 0; grad = zeros(size(theta)); b=X*theta; h=sigmoid(b); J=J+((1/m)*((-1*log(h')*y-(log(1-h')*(1-y)))+(0.5*lambda*(theta(2:end...
% get 2d-coordinate pair from 1d-coordinate. % columns are stacked on top of one another % V=[1, 2, 3, 4] % Vx = 3 % raise_1d_to_2d(2,Vx) = [1,2] function [y,x]=raise_1d_to_2d(Y,x1d) if isempty(x1d) y=[];x=[];return end x=(ceil((double(x1d))/double(Y))); y=(x1d - (x-1)*Y); end
function [D S] = albero(D,S,ind,pesi) % albero: costruisce un albero partendo da un grafo diretto D, % e da una struttura S con i seguenti campi: nodo1, nodo2, peso. ...
tic obj = analysis.void_finder; obj.loadExpt(2); obj.loadStream(1,1); obj.filterCurStream(); obj.findPossibleVoids(); toc
function dx = fundispnolin(t, x, ffxfy) dx(1) = x(2); dx(2) = ffxfy{1}(t,x(1),x(2)); dx(3) = x(4); dx(4) = ffxfy{3}(t,x(1),x(2))*x(4) + ffxfy{2}(t,x(1),x(2))*x(3);
%Author: Matthew Mansell (mcm36) %Tests an input audio file/MFCC data against the each model, %outputting the closest match. input = extract_mfccs('ExamplePIN.wav'); %!Use this for audio input! %input = splitMFCC(MFCCarr, Enarr, 0.075); %!Use this for MFCCarr & Enarr input! pin = ''; %PIN string holder %compare again...
function force = instantforce(t) global N if t<0.1 force = [-20;zeros(N-2,1);20]; else force = zeros(N,1); end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This code reproduces stimuli and data analysis from the paper: % % Mitchell, Harris, Benstock & Ales (2020). The reliability of pseudoneglect is task dependent. Neuropsychologia % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function test_suite = test_thatFails initTestSuite; function test_case assertTrue(false);
function h = computeHistogram(cellMag, cellDir, numBins) h = zeros(1,numBins); % The bins will be 0 to 180 (unsigned) cellDir = cellDir+(pi.*(cellDir<0)); binSize = pi/numBins; %The bin to which the gradient should fall. %This number is decimal points. The vote will be decided on which int %number id closer. bin = ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function [imgTgtNN, imgTgtNNW, centersSrc, weightsSrc, centersTgt, weightsTgt, flowEMD, pixelShift] = % recolorImageFromSignatures(imgSrc, imgTgt, indSrc, indTgt) % Recolors an image by computing color shifts from its signatures. % % Input...
function [ I ] = mutual_info( w1,lambda1, w2,lambda2 ) %MUTUAL_INFO for two Poisson r.v's % Calculate Mutual Information through numerical approximation % w1 = weight of Poisson r.v. with mean/rate lambda1 % w2 = weight of Poisson r.v. with mean/rate lambda2 I = poisson_mixture(w1,lambda1, w2,lambda2) - cond_ent...
% NE PAS OUBLIER : switch2sim %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% mode vertical BUMP FERME en cellule 3 (20 mai 2006) ORB = setorbitbump('BPMz',[ 3 6;3 7],[-0.3 -0.3],'VCOR',[ -2 -1 1 2 ],'Absolute') ORB.CM.Delta ORB.CM.DeviceList stepsp('VCOR',ORB.CM.Delta,ORB.CM...
% Signal Generators % % pprbs % prbs % rampf % randg % sgnstp % sqwave % stepf
function [IM,Impath,Imfile,Imf,Zstack,fig] = LoadImage(varargin) global IM u = varargin{1}; v = varargin{2}; if strcmp(u,'small') && strcmp(v,'single') Zstack = []; [Imfile,Impath] = uigetfile({'*.*'},'Pick a file'); Imf = imfinfo(fullfile(Impath,Imfile)); if Imf(1).Width > 20000 || Imf(1)...
function edges = computeMeshEdges(faces) %COMPUTEMESHEDGES Computes edges array from face array. % % Deprecated, use 'meshEdges' instead. % % See also % meshes3d, meshEdges % ------ % Author: David Legland % e-mail: david.legland@grignon.inra.fr % Created: 2011-06-28, using Matlab 7.9.0.529 (R2009b) ...
function [output] = prediksi(data) output = ''; if data<25 output = 'cover'; elseif data>=25 & data<75 cekcover = (75-data)/(75-25); cekstego = (data-25)/(75-25); if cekcover > cekstego output='cover'; else output='stego'; end else ...
function [lor_vert,lorst,lor_vol,P,Lsol]=LorenzSet(v,idx,tol) % LORENZSET determines the Lorenz set of game v. % The cdd-library by Komei Fukuda is needed. % It is recommended to install the cdd-library that accompanies % the Multi-Parametric Toolbox 3. % http://people.ee.ethz.ch/~mpt/3/ % % % Usage: [lor_vert,lorst,...
function drawBox3d(box, varargin) %DRAWBOX3D Draw a 3D box defined by coordinate extents % % drawBox3d(BOX); % Draw a box defined by its coordinate extents: % BOX = [XMIN XMAX YMIN YMAX ZMIN ZMAX]. % The function draws only the outline edges of the box. % % See Also: % boxes3d, drawRect2, drawR...
function [fData] = bRLCenco_cvip(originalImage,Section) % bRLC_Compress_CVIP - A bitplane run-length coding compression algorithm. % % Syntax : % ------- % bRLC_Compress_CVIP(fileName,originalImage,Section) % % Input Parameters include: % ------------------------- % fileName - Location of compressed output ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % CH-mechanical coupled equation % Spectral method with semi-implicit time marching % Dealiasing--padding aap2.m % debug version % 2D model % Sifan Yin % % 2...
% This file is to calculate the minimal separation between two atoms, and % there are only two atoms in the atomic set. % % Based on [Tang, 2015], [Xu, 2017] % % Created by JYI, 11/04/2019 % %% % rng(0) % N = 127; n = N-1; t = 0:n; % f = rand(3,1); % AtomSet = exp(sqrt(-1)*2*pi*kron(t',f')); % aDist = norm(AtomSet(:...
function results=gab_task_eeg_mergeset(args) %wrapper function for pop_mergeset from eeglab. %EEG should already be loaded global EEG EEG = pop_mergeset(EEG,1:length(EEG)); results='done';
% book : Signals and Systems Laboratory with MATLAB % authors : Alex Palamides & Anastasia Veloni % % % problem 9 - This script measures the execution time of the functions circonv2.m and circonv3.m n1=0:10e3; x1=1.01.^n1; n2=0:9e2; x2=cos(n2); disp ('circonv2') tic y=circonv2(x1,x2); toc disp ('circo...
function G = rayxgridfRVC(F, transla, val) %------------------------------------------------------------------------------ % Multiplies gridfunction F with element of stencil given by its value % val and its position transla. % Excess area is filled by Vertex-Centered (VC) Reflection across boundaries. % % Design and i...
function pheromone = updatepheromone(city,ant,pheromone,rho,delta) %UPDATE THE PHEROMONE MATRIX len = length(city); len1 = ant; for i = 1:1:len for j = 1:1:len pheromone(i,j) = pheromone(i,j)*(1 - rho); end end for i = 1:1:len for j = 1:1:len for k = 1:1:len1 pheromone(i,j) = ph...
maindir = '/Users/caoyupeng/Desktop/EEE408/Lab2Material'; subdir = dir( maindir ); for i = 1 : length( subdir ) if( isequal( subdir( i ).name, '.' )||... isequal( subdir( i ).name, '..')||... ~subdir( i ).isdir) continue; end % subdirpath = fullfile( maindir, subdir( i ...
% yyyy-MM-dd'T'HH:mm:ss.SSS'Z' time format degreeSymbol = char(176); L2datatt = table2timetable(L2Datarawtable2); figure(1) newYlabels = {'B_x(nT)','B_y(nT)', 'B_z(nT)','B_tot(nT)','n(#/cc)',['T (' degreeSymbol 'K)'],'V_x(km/s)','V_y(km/s)','V_z(km/s)','V_tot(km/s)'}; L2plot = stackedplot(L2datatt,'Title','THEMIS-B-D...
function theta = vectorAngle3d(v1, v2) %VECTORANGLE3D Angle between two 3D vectors. % % THETA = vectorAngle3d(V1, V2) % Computes the angle between the 2 3D vectors V1 and V2. The result THETA % is given in radians, between 0 and PI. % % % Example % % angle between 2 orthogonal vectors % vectorAngl...
%%% SET INPUT VARIABLES %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Set atmospheric conditions and cycle parameters T0 = 27 + 273.15; % ambient temp, K p0 = 1e5; % ambient pressure, Pa pmax = 250e5; % top pressure, Pa PRch = 3.0; % charge ...
% script for process %% from simulink X = ScopeData.signals.values; Fs = 1/0.0001; % sampling frequency from simulink freq = 100; % frequency of sinusoid %% % compute fft for increasing periods t_period = 1/freq; % signal period n_samp_period = t_period*Fs; % sample period of signal (samples in one period)1 n = 1 * n_...
close all; clc; %wmask = [1 1 1; 1 1 1; 1 1 1]; %wmask = [1 2 1; 2 4 2; 1 2 1]; r = imread('child2.jpg'); gr = rgb2gray(r); figure(1); subplot(1,2,1); imshow(gr); title('Original Image'); %w = gr(1:4,1:4); [H,W] = size(gr); new = zeros(H,W); R=H+2; C=W+2; temp = zeros(R,C); for i=2:R-1 for j=2:C-1 t...
function landmarks = create_landmarks(nest, visibility, number_landmark) range_landmark = [nest(1) - 2*visibility, nest(1) + 2*visibility]; landmarks = zeros(number_landmark,2); for i = 1:number_landmark x = randi(range_landmark); if (x == nest(1)) x = x + 1; end lim = sqrt(4*visibi...
function control = galvoOptimizeSignal2(control, feedback, target, ioDelay, ax) % galvoOptimizeSignal() optimizes the control signal from the feedback % signal, but there the target voltages refer to the control signal itself. % Thus, the scale, offset, and IO delay are compensated for before % computing the error. Th...
clear all; BG=csvread('compressed/color/train/BG.csv');BG=reshape(BG',200*17120,1); CG=csvread('compressed/color/train/CG.csv');CG=reshape(CG',200*17120,1); TG=csvread('compressed/color/train/TG.csv');TG=reshape(TG',200*17120,1); Human=csvread('compressed/color/train/Human.csv');Human=reshape(Human',200*17120,1); Human...
%% % COURSE: Signal processing problems, solved in MATLAB and Python % SECTION: Time-domain denoising % VIDEO: Gaussian-smooth a time series % Instructor: mikexcohen.com % %% %% create the signal % create signal srate = 1000; % Hz time = 0:1/srate:3; n = length(time); p = 15; % pole...
allKeys=keys(mapOfCompToVarshaCategory); k=0; j=0; m=0; for i=1:length(allKeys) if isequal('help',allKeys{i}), continue, end value=mapOfCompToVarshaCategory(allKeys{i}); ptr=pointerFromAtoC(allKeys{i}); if size(ptr,1)<=3, continue, end if length(find(abs(cell2mat(value(:,2)))==1))==1 ...
// // MyoSDKTests.m // MyoSDKTests // // Created by Michael Yagudaev on 10/17/2014. // Copyright (c) 2014 Michael Yagudaev. All rights reserved. //
%% VVX-lab. %% Derivatafil med n st T (i vvx) + ipart för regulator %% function der = labtest(t,in,flag,regpar,vvxpar) rho = vvxpar(1); cp = vvxpar(2); Fk = vvxpar(3); Fv = vvxpar(4); k = vvxpar(5); Tkin = vvxpar(6); Tvin = vvxpar(7); Atot = vvxpar(8); Vtot = vvxpar(9); regk = regpar(1); i...
function [xmin,vars,costmin,LOG]=nesterov_solver(x0,vars,data,opts) % [x,cost,vars]=iterative_solver(x0,vars0,data,opts) % function doing function executing iteratively an update function until % convergence conditions % input: % x0 : value of x before the descent (x is a column vector) % vars0: stucture needed by ...
function limitProb = limitPi_j( jcolumn, m ,lambda ,T) limitProb = 0 ; if jcolumn == 0 limitProb = 1/L1(m ,lambda ,T) ; elseif jcolumn == 1 limitProb = ( 1/L1(m ,lambda ,T) ) * ( 1- exp(-lambda* T ) ) ; else limitProb = ( 1/L1(m ,lambda ,T) ) * ( 1- exp(-lambda* T )...
function [cx, cy, cz] = component(a, b, jv, x, y, z) %e [m,n] = size(x); syms r1 r2 c1 c2; if a == 1 r1 = m; else r1 = a - 1; end %%%%%%%%%%%%%%%%%%%%%%%%% if b == 1 c1 = n; else c1 = b - 1; end %%%%%%%%%%%%%%%%% ...
function p = predict(model,filename) % The following code reads in one of these emails and then uses your % learned SVM classifier to determine whether the email is Spam or % Not Spam. % Read and predict filename=strcat('./TestEmails/',filename); file_contents = readFile(filename); if(size(file_contents,1)==...