text
stringlengths
8
6.12M
function [found,I,J,L] = in_element(V,F,P,varargin) % IN_ELEMENT test for each p in P whether it lies inside each f in F defined % over V. % % [found,I,J,L] = in_element(V,F,P) % [found,I,J,L] = in_element(V,F,P,'ParameterName',ParameterValue,...) % % Inputs: % V #V by dim list of vertex positions ...
function qp_opt(tol) % qp_opt(tol) % Optimize QP until relative difference between lower and upper bound is below 'tol' % If tol = 1, then optimization will stop when lower bound stops increasing global qp; if nargin < 1 tol = .05; end C = 1; I = 1:qp.n; [id,J] = sortrows(qp.i(:,I)'); id = id'; eqid = [0 all...
function [classes] = nn1PtsClassifier(pts, selClasses, selIxs) %Klasyfikuje punkty 1-nn na podstawie przypisania do klas podzbioru punktów. %Parametry: % pts - wszystkie punkty % selIxs - indeksy wybranych punktów % selClasses - klasy podzbioru punktów %Zwracane: % classes - przypisanie do klas dla wszystkich pu...
% Author: Saadman Sakib clf colormap('gray'); im1 = imread('image1.jpg'); subplot(4,1,1); imagesc(im1); axis off; title('Plane 1','fontweight','bold'); im2 = imread('image2.jpg'); subplot(4,1,2); imagesc(im2); axis off; title('Plane 2','fontweight','bold'); diff = im1 - im2; subplot(4,1,3); imagesc(diff); axis off...
novelObjectPathPattern = '~/Projects/lab-palmeri/trainedImagenet/novelObjects/original/*.tif'; % Novel object files [novelObjectFiles, novelObjectNames] = getFilepaths(novelObjectPathPattern); % Images to use for getting feature matrix % populates global images var for reuse fprintf('Loading novel object images from %s...
function [ BestPOP,BestSigma ,BestPrice ] = elitist_Sig(POP, Sigma, Cost, NumPop) %ELITIST - Chooses the best elements % This function orders the cost of each individual and chooses the ... % best elements of the population [Cost_order, index] = sort(Cost); BestPrice = Cost_order(1); for i=1:NumPop Bes...
function [rankTable, ranks] = rankingTable(data, varargin) % [rankTable, ranks] = rankingTable(data, settings) % Creates and prints table containing rankings for different evaluations. % % Input: % data - cell array of data % settings - pairs of property (string) and value or struct with % propert...
%Script to read in the forest loss data from Hansen et al. (2013, Science) %https://earthenginepartners.appspot.com/science-2013-global-forest/download_v1.2.html %and calculate the disturbance rotation period for each 10 deg x 10 deg section of the globe. % %Note that these disturbance rates are corrected for land-use ...
function [ pik, mu, sigma ] = gmmClustering( data, k, initialMu, initialSigma, initialPik ) %This function returns the wieghts, the means and variances of k gaussians % k is the number of gaussians in mixture % D is the dimensionality of the data % N is the number of data points % mu - k by D matrix % sigma - D by D...
function [xCenter, yCenter] = dmCenter(data, unit) K = naomi.KEYS; xCenter = data.getKey(K.XCENTER, []); if isempty(xCenter) warning('Could not found centering information in data header assuming this is half of the number of sub aperture'); nSubAperture = data.getKey(K.WFSNSUB); ...
function [l,s]=sslq(a,b,q1,q2,mode,mon) %------------------------------------------------------------------------- % usage: [l,s]=sslq(a,b,q1,q2{,mode,mon}) % Programmed by Niels K. Poulsen % Department of Mathematical Modelling, % Technical University of Denmark %--------------------------------...
function getKeyAssignment % % get key assignment global keys design % Target keys for response keys.upKey = KbName('UpArrow'); keys.downKey = KbName('DownArrow'); keys.space = KbName('Space'); FlushEvents('keyDown');
function [PSNR, yRGB_est] = CBM3D(yRGB, zRGB, sigma, profile, print_to_screen, colorspace) % % CBM3D is algorithm for attenuation of additive white Gaussian noise from % color RGB images. This algorithm reproduces the results from the article: % % [1] K. Dabov, A. Foi, V. Katkovnik, and K. Egiazarian, "Color image ...
function ok=examineTreeForArbitrages(tree,rets) % this function examines the returns rets associated to tree % looking for arbitrages, using the algorithm from Klassen. T= length(tree(1,:)); ok=1; t=2; while(ok==1 && t<=T) cv = tree(1,t-1); %set the reference value ip = different_values(tree(:,1:t-1)); %count the p...
function [ out ] = dealAllRoadLocation( data,label ) [dataRow, dataColumn] = size(data); [labelRow, labelColumn] = size(label); remember = []; for i = 1:labelRow i for j = 1:dataRow if cell2mat(table2cell(label(i,3))) == cell2mat(table2cell(data(j,2))) remember = [remember j]; ...
EEG.etc.eeglabvers = '14.1.2'; % this tracks which version of EEGLAB is being used, you may ignore it cd('') path=pwd; files=dir('*.set'); for i=1:length(files) % for i=1:7 filename=files(i).name; EEG = pop_loadset('filename',filename,'filepath',path); ECG=EEG; ECG.data=EEG.data(64,:); ...
function doty=IANnetW(t,y) global init b mm nn pp rr mmm nnn dphi phi d R q n m T r alpha Nalpha... qP qM qDp qDm beta q0 theta0 dq Pinfty Minfty gamma myInf... cclalpha taskstartangle; global Talpha aa J R_noise C_noise gol;% neural network global flag1 flag2 flag3 flag4 flag5 flag6 flag7 flag8 flag9; n=8; ...
function [] = plotOrderingNodesValues(ordering_table) ordering; % put ordering to row names position_nodes = ordering_table{'Position','Nodes'}; smallest_init_domain_nodes = ordering_table{'Smallest_Initial_Domain','Nodes'}; smallest_constraint_nodes = ordering_table{'Smallest_Constraints','Nodes'}; largest_constrain...
function [v] = gradn(u) [M,N] = size(u); dx = u(1:M-1,2:N)-u(1:M-1,1:N-1); dy = u(2:M,1:N-1)-u(1:M-1,1:N-1); v = dx.^2+dy.^2; v = sqrt(v); end
clc; clear all; close all; x=input('input value of MUX'); y= input( ' input value of MUX'); if (x==0 && y==0) disp('z=D0'); elseif(x==0&&y==1) disp('z=D1') elseif(x==1&&y==0) disp ('z=D2') elseif(x==1&&y==1) disp('z=#'); else disp('Nan'); end;
function data_out = generate_Q(size,num) I = eye(size); count = 0; data_out = zeros(size,size,num); for ii = 1:size for jj = ii+1 : size temp = eye(size); temp(ii,jj) = 1; count = count + 1; data_out(:,:,count) = temp; if count == num break; end end ...
%%Dynamic LAdelay (DynLAdelay.m) %Team J^4 + B %Written by John Stuart clear; ARR=importdata('ARR.csv'); %(flights x data types) ARRn=ARR.data; ARRt=ARR.textdata; %---------Include DEP in excel file------- %----------------------------------------- A=10; %length(ARRn); %number of aircraft R=7; %number of...
classdef ImagingManager < Base.Manager properties set_colormap = 'gray'; dumbimage = false; % If true (useful for experiments), no ROI/crosshairs or listeners (only applies in CC) end properties(SetAccess={?ImagingManager,?StageManager}) current_image = []; % H...
% 2-layer deep learning model for SFDI % need Matlab 2018b to execute clear;clc; load('random_test_data_100x100.mat'); % load random test data load('weights_2_layer_deep_learning_SFDI_model.mat'); % load parameters of DNN model %% Estimate optical properties from random test data X = Rd_vec; % Layer 1 n1 ...
% 对识别错的样本,看他们的码流是什么 clear; addpath ./1 load down_1.mat test=down_1{53}; [codes,plane] = funGesDir(test); plot(codes); % save('cwv_1_codes.mat','codes'); %% functions function [dir,plane] = funGesDir( sample ) ppX=max(sample(:,1))-min(sample(:,1)); ppY=max(sample(:,2))-min(sample(:,2)); ppZ=max(sample(:,...
function texto=descifro_hill(A,m,cifrado) %DESCIFRO_HILL %Función que descifra un mensaje cifrado mediante la matriz A %Parametros %A: Matriz con la que se cifró el mensaje %m: Modulo en el que se cifro el mensaje %cifrado: Mensaje cifrado %NOTA: con cifro_hill se puede hacer todo, pero por sencillez creo esta funcion ...
function stageStats = plotSleepStats(stageData, outname) % Stephanie Greer and Jared Saletin % Walker Lab, UC Berekeley 11/22/2010 % % stageStats = plotSleepStats(stageData, outname) % % Required Inputs: % stageData - a scoring struct from sleepSMG scoring % must have the following fields: % stages - complete ...
% agcvsfading.m: compensating for fading with an AGC n=50000; % # steps in simulation % Generating the sin function fs = 8e3; t = 1/fs:1/fs:n/fs; r=5*cos(2*pi*1000*t); % generate the signal % Fading profile % The specifications state that the signal must be 1, then reduced 16 db...
%ex 1 pc b function [] = prob1B(miu, sigma) Z = zeros(1000); vect = Z(1, :); for i = 1:1:1000 vect(i) = prob1(miu, sigma); end [N C] = hist(vect, 15) N = N/(1000*(C(2)-C(1))); bar(C, N, 1); hold on; v = min(vect):0.01:max(vect) plot(v, n...
function F = tcml(theta,u,v) %TCML Maximum Likelihood Function for t copula. % F = TCML(ALPHA,U,V) returns value of Logarithm from Maximum % Likelihood Function multiplied by -1, for bivariate sample [U V] % and copula parameters THETA. THETA contains correlation coefficient % and number of degrees of free...
% First of all, add stc toolbox to search path addpath('G:\My Drive\EECE562_Steganography\Final_stego_project\Matlab_lib\') % =============== Step 1: Prepare stego images for each payload =========== % Generate_stego_images(0.05); % Generate_stego_images(0.1); % Generate_stego_images(0.2); % Generate_stego_images(0.3...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function doEvaluateMatchingLocalObjectDb % Evaluate the chi-square distance between the object and the % background's histograms % % Input parameters: % % Output parameters: % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function plotSelectedErrorbars(data, error, name, resolution, yMax) h=errorbar(1:resolution:length(data),data(1:resolution:end),error(1:resolution:end)); %k = get(h,'Children'); %set(k(1),'Color','w'); hold on plot(data) ylim([0 yMax]) saveas(h, strcat(name, 'ErrorAverage2', '.png')); sa...
f = imread('Fig1027(a)(van_original).tif'); f = tofloat(f); gSobel_best = edge(f, 'sobel', 0.05); gLoG_best = edge(f, 'log', 0.003, 2.25); gCanny_best = edge(f, 'canny', [0.04 0.1], 1.5); figure; subplot(1,3,1);imshow(gSobel_best);title('Sobel best'); subplot(1,3,2);imshow(gLoG_best);title('LoG best'); subp...
%% Question 1 and 2 clear all; close all; u=[5; 9; 17; 17; 5; 125;1]; v=[9;5;9;121;1;1;1]; for i=1:1:size(v,1) f=figure; set(f,'name',['2-dimensional inverse Fourier Transformation (p=', num2str(u(i)), ', q=', num2str(v(i)), ')'],'numbertitle','off') fftwavetemplate(u(i),v(i)); end %% Q...
stabilize('input','output', '.jpg', 55, 2);
function [distant_wing_area,WE_is] = WingExtension(we_or_agg,fly_apart_error,fly_body, fly_with_wing, initial_body_area,initial_wing_area,initial_body_MajorAxisLength,initial_body_MinorAxisLength,ROIs,frame) %WINGEXTENSION Summary of this function goes here % Detailed explanation goes here if fly_apart_error > 0 ...
clc clear all load Data_singleLambdaMTC_25T.txt ; load Data_singleLambdaMTC_50T.txt ; load Data_singleLambdaMTC_100T.txt ; format long e m =30; %Give Credits lambda=[0.01 0.05 0.1 0.5 1 3 5 7 9 10 30 50 70 90 100]; lambda2=[0.01 0.05 0.1 0.5 1 3 5 7 9 10 30 50 70 90 100]; T = [25 50 100] ; %Timer T2...
function dx = scalexaxis( xnorm, xrange, ax) % function dx = scalexaxis( xnorm, xrange, ax) % % Scale an axes by a normalized height z_norm % % KIM 01.2016 if nargin<3 ax = gca; end % if no yrange is input, use the axes limits if nargin<2 xl = get(ax, 'XLim'); xrange = range( xl ); end % get the size...
% Model3S1: Model 3, Step 1 --> initialize optimization close all; clear all; setupstart = tic; % open parallel pool parpool(10); options = optimoptions('ga','UseParallel',true); % six parameters: export scaling factor, mean TA, x_calc, m_calc, x_arag, m_arag lb = [0.15 2375 0 0 0 0]; ub = [0.8 2425 20 2 20 2]; % G...
function [ profil ] = determineProfil( BW, box, nbLines ) %determineProfil Retourne le profil du chiffre de la sous image de BW %basé sur les coordonnées de la box box. % BW image binaire source % box coordonnées de la boite englobante à prendre en compte % nbLines est le nombre de lignes à prendre en compte pour le ca...
% Question 2.3 % Choose level 3 for data sequence 1 % Choose level 5 for data sequence 2 clear all; I1=im2double(rgb2gray(imread('dog1.png'))); I1=imresize(I1,[512 512]); [rows cols]=size(I1); I2=im2double(rgb2gray(imread('dog2.png'))); I2=imresize(I2,[512 512]); % Using Reduce function for both images I...
function x = sgplvmOptimisePoint(model,x,Y,display,iters,comps,gradcheck) % SGPLVMOPTIMISEPOINT Optimise the latent location. % FORMAT % DESC Takes a sgplvm model structure, observed point and latent initialisation % and optimises latent location % ARG model : sgplvm model % ARG x : latent initialisation % ARG Y : ob...
function A = hw2p10(m,n) ey = ones(m,1); DY = spdiags([ey -ey ey],[1-m 0 1],m,m); dy = kron(eye(n),DY); ex = ones(m*n,1); dx = spdiags([ex -ex ex],[m-m*n 0 m],m*n,m*n); A = [dx;dy]; end
function writeBDL(filename,V,F) % WRITEBDL Write a mesh to a .bdl file % % writeBDL(filename,V,F) % % Inputs: % filename path to .bdl file % V #V by dim list of mesh vertices % F #F by 3 list of triangle indices function headerStart = writeBDLChunkHeader(fp, chunktype, nBytes) % writes ch...
function [phi, h] = intcor(u, y) % we assume same length for the signals u and y len = size(u,1); % we compute correlations for h in [-half, ..., 0, half] half = ceil(len/2); h = (-half:1:half)'; phi = zeros(size(h, 1), 1); M = size(h,1); for i = 1:M phi(i) = sum(u .* circshift(y, -h(i))); end phi = 1...
%% This is the modelling of neuron (deterministic kinetic model) iter = input('enter the iteration(time in milli second): '); k = 6; I = [-3 0 1 6 8 12]; %% defining function alpha_n = @(V) 0.01*(10 - V)/(exp((10-V)/10) - 1); alpha_m = @(V) 0.1*(25 - V)/(exp((25-V)/10) - 1); alpha_h = @(V) 0.07*exp(-V/20); beta_n...
%% Load NNetwork into microctrl fprintf('\t***************************'); fprintf('\t\tLoad neural networks and put into Microcontroller\n'); fprintf('\t\tLoad network files\n'); if exist('GazeCalNetFile','var')==1 if exist(GazeCalNetFile,'file') ==2 GazeNet = load(GazeCalNetFile,'-mat'); [...
function state = new_trial(program, conf) state = ptb.State(); state.Name = 'new_trial'; state.Entry = @(state) entry(state, program); state.Loop = @(state) loop(state, program); state.Exit = @(state) exit(state, program); end function entry(state, program) structure = program.Value.structure; data = sfix.task.Da...
function [ x ] = pareto_sample(n, lb, ub, alpha) % U=rand(n,1); %x=(-(U.*ub.^alpha-U.*lb.^alpha-ub.^alpha)./(ub.^alpha*lb.^alpha)).^(-1./alpha); x= (-(U .*(1-(lb/ub).^alpha)-1)./(lb.^alpha)).^(-1/alpha); end
function varargout = DPABIFiber_Install(varargin) % DPABIFIBER_INSTALL MATLAB code for DPABIFiber_Install.fig % DPABIFIBER_INSTALL, by itself, creates a new DPABIFIBER_INSTALL or raises the existing % singleton*. % % H = DPABIFIBER_INSTALL returns the handle to a new DPABIFIBER_INSTALL or the handle to %...
clear all; N=1000; teta=0.3; Z=0; F=zeros(1,20); for u=1:20 Z=0; for i=1:N K=geornd(teta/(1+teta)); X=exprnd(1,1,K); if sum(X)>u Z=Z+1; end F(u)=Z/N; end end plot(F,'b*') hold on u = [0:20]; psi = (1/1.3) * exp(((-0.3/1.3) * u)); plot(u...
%% Estimate optimal Granger causality order to determine causality between component time series % Requires the Multivariate Granger Causality toolbox, available at % http://www.sussex.ac.uk/sackler/mvgc/ % Toolbox version used: mvgc_v1.0, last updated on March 27 2014 % % Author: Marrit Zuure, January 2019 % Drawing ...
function [X,y] = read_mnist(filename) train = dlmread(filename,",",1,0); X = train(:,2:end); y = train(:,1); end
function [ pStack, OvMat1, OvMat2, OvMat3] = generateSpecularFlowEquations_WeakNeighbors_SparseFlow(X_fl, Y_fl, X_sta, Y_sta, X_stp, Y_stp, R, pSizeR, pSizeC, pShiftR, pShiftC, verb) RTrans = R'; r11= R(1,1); r12 = R(1,2); r21 =R(2,1); r22 = R(2,2); nPRow = floor((size(X_fl, 1)-pShiftR+1)/pShiftR); nPCol = fl...
clc; clear; im_0=imread('../data/1.tif'); [m,n]=size(im_0); im_temp=true(m,n); im_temp(2:m-1,2:n-1)=false(m-2,n-2); im_label=im_0 & im_temp; %se=logical(ones(3000,3000)); %im_dilate=imdilate(im_label,se); %im_next= im_dilate & im_reverse; im_next=myReconstruction(im_label,im_0); im_h=im_0 & (~im_next...
function stlfp = getSTA4mp(lfptrace, lfptime, spktime, wnd, fs) %% % generic function to get spike-triggered averaging LFP % note that the input 'lfptrace' must be a 0-mean vector % if isempty(spktime) stlfp = nan; return end % 0-mean vector % lfptrace = lfptrace - mean(lfptrace(lfptime >= spktime(1) & lfptim...
function [eff]=CAT_SLAB_nth(kv,D,L,Cs,m) % Function solves catalyst particle. slab geometry. nth order reaction. % Only Interal mass transfer. % equation: % c'' - lamda^2*c = 0; cii = second derivative of c to theta. % lamda = L*(kv/De)^0.5 % c is the concentration % theta is dimensionless length of the slab x/L, ...
clc clear all close all tic javaaddpath('/Users/hroarty/Documents/MATLAB/HJR_Scripts/radial_database/mysql-connector-java-5.1.6-bin.jar'); % Declare time for a single year plot % year.num=2014; % year.str=num2str(year.num); % t1 = [year.str '-1-1 00:00:00']; % t2 = [year.str '-12-31 00:00:00']; %% Declare time fo...
function kern = mk_updateKernWeight(kern,weight) % 更新核函数的权重 num_kerns = length(kern.comp); for i = 1:num_kerns kern.weight(i) = weight(i); end end
function [newobj] = findCars(imgray) bw = edge(imgray, 'sobel');colormap gray; bw = imdilate(bw,strel('disk',4)); %imagesc(bw);colormap gray; [L, num] = bwlabel(bw, 4); %hold on %imagesc(imgray) zero=0*imgray; %B=zeros(size(imgray),num); a=0; for i = 1:num pix = L==i; obj=zero; obj(pix)=1; objsize=bw...
N=100; col=ones(N,1); % make differentiation matrix D=-spdiags([col,-2*col,col],(-1:1),N,N); % solve eigenvalue problem [F,V]=eigs(D,10,'sa'); % fix boundary points F=[zeros(1,10);F;zeros(1,10)]; plot(F(:,1:4),'linewidth',3), grid on, axis tight title('Standing waves') % Copyright 2008-2009 The MathWorks,...
base_1500_loads; %clear ISO; ISO=dsim.ISO(); ISO.init(); load('combined_june_model'); errorP=@(t) loadmodel(t)-forecastmodel(t); T_w=60*5; %5 minutes numLoadDays=8; startTestDay=7*24*60*60; endTestDay=startTestDay+1*24*60*60; timeTestDay=startTestDay:10:endTestDay; timeTrainDay=1:10:startTestDay-1; PrMWtokW=1/10...
function [] = computeconditionalpdf(ds,dimx,dimy,methodk,methodc,N) %This function use copulae to compute the conditional probability %distribution of f_y/x %inputs % ds: the dataset % dimx: x dimension % dimy: y dimension(s) % methodk: kernel method for estimating marginals % (normal,box,...
%Under the main direction, [apd/ccd int; mesh ccd with int,ave el; mesh newccd with lf; normalized dtime along time.] %is plotted. the origin data is from dataset. clearvars; close all; letter_char=num2cell(1:120);letter_box=cell(1,120); for i=1:120 if i<=26 letter_box{1,i}=char(64+letter_char{1,i}); e...
function output = get_standard_colors(color_index) % Get the default plot colors used by matlab. % Color resource: https://nl.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html colors = [0 0.4470 0.7410 0.8500 0.3250 0.0980 ...
function test_suite = test_triangleArea3d %TEST_TRIANGLEAREA3D Test case for the file triangleArea3d % % Test case for the file triangleArea3d % Example % test_triangleArea3d % % See also % % % ------ % Author: David Legland % e-mail: david.legland@grignon.inra.fr % Created: 2011-08-23, using...
function A = DHCraig(alpha, a, d, tetha) A = [cos(tetha) -sin(tetha) 0 a;... sin(tetha)*round(cos(alpha)) cos(tetha)*round(cos(alpha)) -round(sin(alpha)) -d*round(sin(alpha));... sin(tetha)*round(sin(alpha)) cos(tetha)*round(sin(alpha)) roun...
%Generates the parameters structure for nscs long step with the default parameters pars = struct; %Set up the default parameters pars.max_iter = 100; %Maximum outer iterations pars.max_affine_backtrack_iter = 300; %Maximum affine backtracking steps pars.backtrack_affine_constant = 0.9; %Affine backt...
% % GOF Goodness of Fit statistics % % stats = GOF(V,Vfit,Ndof,sigma) % Given some input data (V) and its corresponding fit (Vfit), with (Ndof) % degrees of freedom and with an underlying error with standard deviation % (sigma), returns a structure (stats) with multiple statistical % indicators of good...
function p = older(y1, m1, d1, y2, m2, d2) if y1>y2 p=-1; elseif y1<y2 p=1; else if m1>m2 p=-1; elseif m1<m2 p=1; else if d1>d2 p=-1; elseif d1<d2 p=1; else p=0; end end end
function [ p ] = poly_val( c0, c, x ) if isempty(c) p = c0; elseif isscalar(c) poly = c0 + c*x; p = sum(poly(:)); else if size(c, 1) > 1 c = c'; end poly = [c0, c] .* ( x .^ (0 : length(c)) ); p = sum(poly(:)); end end
sflag=1; % System flag 0-3. % Physical system (0), Discrete time linear model (1), % Continous time linear model (2), Nonlinear model (3) % test model (4,5) w0=19; % set point - operation point if sflag==4, w0=0; end; % test if sflag==5, w0=0; end; % test global data t t0 % some data a...
function [ output ] = fract2float( y ) %FRACT2FLOAT Transform a signed 16bit integer in signed fractionary format to floating point number between 0 and 1. y(y>2^15-1) = 2^15-1; y(y<-2^15) = -2^15; y = double(y); y(y > 2^15-1) = -y(y > 2^15-1); %y = y - 2^15 output = y / 2^15; end
%=========================================================================% % getZeta.m % % Получение значения переменной zeta в заданной точке в history-файлах % %=========================================================================% function [dataO...
function [ Segements ] = segmentEMGperConditions( EMGdata, Condition , segmentLength ) %% SEGMENTEMGPERCONDITIONS Cuts EMG data into segements % % This function uses the output of importEMGbinaryfiles, and some paramers % % See also importEMGbinaryfiles Segements = struct; % Assiciate channels to the corresponding mu...
clear variables; clc; close all; % Create the bosonic creation and annihilation operators S = 4; s = arrayfun(@sqrt, 1:S); a = diag(s, 1); % Annihilation a_d = diag(s, -1); % Creation n = diag(0:size(a)-1); % Number operator = a * a_d I = eye(size(a)); % Identity operator % -------- % On-site inte...
function ind = g2seg(layer_g) %% sz = size(layer_g(:,:,1)); nL = size(layer_g,3)+1; ind = ones(sz(1), sz(2)) * nL; for i = 1:nL-1; tmp = layer_g(:,:,i)>=0; for j = 1:i-1; tmp = tmp & layer_g(:,:,j)<0; end; tmp = double(tmp); % visible in front layers tmp(ind < i) = 0.5; ...
format long a = input('Please input a positive real number: '); N = input('Please input the number of iterations: '); x = a/2; %Initial guess disp(x) %Display initial guess for i = 1:N x = (x + a / x) / 2; disp(x) end disp( 'MATLAB''s value: ') disp(sqrt(a)) disp('The difference is : ') disp(x - ...
function mskew = movskew(data, varargin) % function that calculate moving skew using a window determined by the % variable varargin. If varargin is empty a accumulated skew moving one day % is obtained % input: % data = variable to calculate the metric % varargin = window to calculate the metric % output: % m...
for i = 1:length(new_map) newPts = [new_map(i, 1) - 1, new_map(i, 2); new_map(i, 1) + 1, new_map(i, 2); new_map(i, 1), new_map(i, 2) + 1; new_map(i, 1), new_map(i, 2) - 1]; if(sum(inpolygon(newPts(:, 1), newPts(:, 2), pad_inpolygonMapformatX, pad_inpolygonMapformatY)) == 4) node_gra...
% book : Signals and Systems Laboratory with MATLAB % authors : Alex Palamides & Anastasia Veloni %Fourier Transfrom properties % Conjugation %x(t)=exp(-t)u(t) %F{conj{x(-t)}} x=exp(-2*t)*heaviside(t); x_=subs(x,t,-t) Left=fourier(x_,w) %conj{X(w)} X=fourier(x,w); Right=conj(X)
function ESAM445_WeightJacobi_MingfuLiang(K,N,omega,starting_method) % Author: Mingfu Liang % Date: 2019/05/07 % % Implementation of Weight Jacobi Method for solving Helmholtz equation. % % Input: % K: % Input -2, 0 or 2 to choose different Helmholtz equation. % % the par...
function plotFig1d(save_fig) % PLOTFIG1D Plots grid of threshold-direction maps (Mollweide projection) % Data should already be generated and saved in % mat/nrn_sim_data/<model_prefix>.mat if nargin == 0 save_fig = 0; end mat_dir = addPaths; nrn_model_ver = 'maxH'; tms_mode = 1; % monophasic cell_ids = 1:25; mod...
function varargout = text2( varargin ) % Wrapper for text.m that ensures displayed text fits in figure. % % When text is called, Matlab displays the text, but does nothing to ensure % that all of the text fits in the figure. This function, after calling % text, shrinks the axes until the text is fully visible. Note t...
typing_trials = tdfread('typing_trials.csv'); %% USING rm_anova2 %wpms = typing_trials.wpm; %participants = str2num(typing_trials.participant_id(:,2:3)); %sessions = typing_trials.session_id; %modes = typing_trials.mode_id(:,end); %fact_names = {'Session', 'Mode'}; %stats = rm_anova2(wpms, participants, sessions, mode...
clc; close all; im = 'Img_1.jpg'; % Read the image im22 = imread(im); [row,col] = size(im22); OutputMap = analyze(im); [m,n] = size(OutputMap); img = OutputMap; for i = 1:m for j = 1:n if(img(i,j) < 4) % Set the threshold img(i,j) = 0; else img...
clear all; P=[0.4036 0.4154 0.5352 0.5524 0.7709 0.7589;... 0.4365 0.4711 0.6408 0.6528 0.7812 0.7965;... 0.4860 0.4639 0.6145 0.6234 0.8204 0.8125;... 0.5161 0.4981 0.6299 0.6715 0.8425 0.8506;... 0.3419 0.3806 0.7154 0.7025 0.8622 0.8709]; net=newc(minmax(P),3,0.1); net=init(net); net.trainParam.epochs=...
pmos = csvread('../data/experiment1_pmos_1.csv', 1); pmos_downsample = vertcat(pmos(120:200, :), downsample(pmos(201:1000, :), 8)); % make sure to set N > 10 to N > 3 on line 49 of linefit.m [Is, VT, kappa] = ekvfit(pmos_downsample(:, 1), pmos_downsample(:, 2), 5e-3, 'on') % Is = 5.9167e-09 % VT = -0.6725 % ...
function status = XuShowFirstFrame(img) status = 1; imshow(img(:,:,1),[])
function [krQ, kriQ, smat]=kernelQ(v,x,tol) % KERNELQ checks whether the imputation x is a kernel element % of the TU-game v. % % Usage:[krQ, kriQ, smat]=kernelQ(v,x,tol); % % % Define variables: % output: % krQ -- Returns 1 (true) whenever the impuatation x is % a kernel element, otherwise 0 (f...
clear S3 S3_filt; %% S3=zeros(1,N_NU); for (n=1:N_NU) %% nu_test=nu_values(n); clear nu_surf_radius; r_count=1; nu_surf_radius=zeros(Nomega*N_NU,1); for (omega=1:Nomega) for (r=2:pos_psi_rx) r_value=scale_r(r); omega_value=scale_omega(omega); ...
function [y] = Griewank(x) dim = 30; sumsq = 0; prod = 1; for i=1:dim sumsq = sumsq + x(i)*x(i); prod = prod*(cos(x(i)/sqrt(i))); end y = 1 + sumsq * 1/4000 - prod;
n=1; for(p=1:NP) for(r=1:Nradial) %pressure_norm_PR_map(p,r)=finesse_data(n,end-31); pressure_norm_PR_map(p,r)=P_initial_profile(r); n=n+1; end end % Pnorm_XZ_map=griddata(finesse_data(:,1),finesse_data(:,2),finesse_data(:,end-31),XX,ZZ,'cubic'); % Pnorm_XZ_map(isnan(Pnorm_XZ_map)) = 0;...
% Graphs GKK Wealth Tax % Sergio Ocampo Diaz javaaddpath('jxl.jar'); javaaddpath('MXL.jar'); import mymxl.*; import jxl.*; %% Parameters % Grids n_a = 201 ; n_z = 7 ; n_l = 5 ; n_e = 5 ; Max_Age = 81 ; Ret_Age = 45 ; % Utility and technology sigma = 4.00 ; gamm...
function out = controller_linear_path(in) global dzeta om_d = in(1); v_d = in(2); theta_d = in(3); x_d = in(4); y_d = in(5); theta = in(6); x = in(7); y = in(8); kappa_d = in(9); j_S = [cos(theta_d+pi/2); sin(theta_d+pi/2)]; q_el = [x;y]; % (1.9) q_del = [x_d;y_d]; % (1.9) e_l_help = q_el - q_del; % (1.9) ...
% Conditional Blackout Size distribution for different destinations % Input parameter table clear all; close all;clc; load tail.mat % IEEE-118 bus system NumberOfLines=186; % Truncation (trick to reduce numerical solution time) L=186; epsilon=0.01; % Max number of capacities Capa=[20 80 200 500 800]; % Caps=[80 200 500...
function single_item_ROI_AssNonAssAverageBetas(TextFile) %+--------------------------------------- %| %| Robert C. Welsh %| 2002.10.20 %| %| University of Michigan %| Department of Radiology %| ...
function [validPlot, pulseData] = dataProcess(handles,firstProcess, hObject) %pulse process and plot to gui %process MPC data [validProcess, pulseData] = PulseProcessScope(handles,firstProcess, hObject); if validProcess %publish results into table validPublish = PublishResults(pulseData,handles); %plot s...
% Plot typical AMR solutions for darcy brinkman problems function Fig5FixedPorosityConvectionPlots(dataFolderNu, dataFolderVariablePorosity, figureDirectory) if nargin < 3 % dataFolderNu = getDataDir('AMRConvergenceTest/ConvectionDB/chi0.4-Da0.01-Ra1e5/'); % dataFolderVariablePorosity = getDataDir('AMRConverge...