text
stringlengths
8
6.12M
clear all; close all; clc; plot_linear = false; plot_quadratic = false; plot_tests = false; plot_serendipity = false; plot_serendipity_tests = true; plot_fem_sol = false; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % geometry % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function h = createSpecificityPlot(skel,trees,targetNames,individual,color,savingDir) %getSpecificityPlot create Specificity plot of annotated trees % INPUT trees: [1xN] vector of linear indices % % targetNames: {1xN} cell array of specifying the comment (even % partially) used for annotation of a sp...
function q=Manos_atras(Ts,q0) q0_right_leg = q0(1:6); q0_right_arm = q0(7:10); q0_left_leg = q0(11:16); q0_left_arm = q0(17:20); q0_waist = q0(21); q0_head = q0(22); q0_hand = 0; T=8; num_points = T/Ts; conversion = pi/180/209; % conversion from encoder values to radians %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
load('higher_loading.mat'); % load('lower_loading.mat'); figure1 = figure; % Create axes axes1 = axes('Parent',figure1); hold(axes1,'on'); % Create multiple lines using matrix input to plot plot1 = plot(time,Vout,'LineWidth',2); plot2 =plot(time,Is1*8,'LineWidth',2); yline(0,'LineWidth',3,'Color','k','Ha...
[a , fs] = audioread("test.mp3"); % Sinal [b , f2] = audioread("imp.mp3"); % impulso a = a(:,1); H = conv(a,b); figure (1); plot(a(1:1000000)) title('SINAL'); grid on; figure (2); plot(b) title('IMPULSO'); grid on; figure (3); plot(H(1:1000000)) title('CONVOLUă┬O'); grid on;
function sigmadot = omega2sigmadot(omega, sigma) % Convert angular velocity to MRP time derivative % Allow this function to accept omegas/sigmas for multiple time instances nSteps = size(omega,2); sigmadot = zeros(3,nSteps); % Do the conversion for each time step for i = 1:nSteps % N m...
function datactrl(nfig) % GUI to move a selected data point upward or downward by a user-defined amount % Input: nfig -- the number of the figure % Use: 1. push the "Select" button % 2. move the mouse unto the figure to select a data point to be % moved % 3. push "Up" or "Down" button to m...
%this is the alternative script for RRT journal, jan-2013 %the rrt# algorithm contains a supervised learning step and consists of the %following sections: % 1. initial learning phase to identify goal distributions G % 2. the RRT sample generation from G and H distribution % 3. RRT growth (standard RRT algorithm) % 4. e...
function update_plots global hnds global r nn asz G ps global hpb ht hi ax1=hnds.axes1; ax2=hnds.axes2; cla(ax1); cla(ax2); nn=str2num(get(hnds.nn,'string')); % number of cities ps=str2num(get(hnds.ps,'string')); % population size % to plot best path: hpb=plot(NaN,NaN,'r-','parent',ax1); ht=title(ax...
function [T,I,Y]=perfusionResponsepotentP2X4(y0,ton,toff,Ttot) ode=modelODEpotentP2X4(ton,toff); [T,Y]=ode15s(ode,[0 Ttot],y0,odeset('NonNegative',1:37)); I=getTotalCurrentpotentP2X4(Y); end
function [ FirstFile, Container ] = pft_FindImaContainer(Folder) % Set a default value for an early return - an empty array will yield true with isempty and false with ischar FirstFile = []; Container = []; % List all the files and folders below the top level - don't attempt to use a wildcard at this stage [ F...
function [cdexp_age] = build_cdexp_age(path,exp) % % % % % % % cdexp_age.animal_id = exp; cdexp_age.pen_names = tfexp_age_get_pen_names(path,exp); cdexp_age.pen_info = cdexp_age_get_pen_info(path,exp,cdexp_age.pen_names); [cdexp_age.resps, ... cdexp_age.dir, ... cdexp_age.other] = cdexp_age_get_summary(cde...
clear all; WINDOW_SIZE = 10; data = readmatrix('SAMPLES.TXT'); x = data(:, 1); y = data(:, 2); figure(1); plot(x, y); xlabel('Tiempo (s)'); ylabel('Voltaje (mV)'); title('Mediciones genAnalog'); amplitude = max(y); filtered_x = []; filtered_y = []; for index=1:WINDOW_SIZE:size(y, 1) upper_window = index+(W...
function [A, RHS]=fvm_ddt(factor, factor0, xn, V, dt, method) % Gives the temporal derivative matrix and corresponding RHS % d/dt x^(n+1)-x^(n)*V % % fvm_ddt(V,method) % % factor: slacar factor in term at time n+1 % factor0: slacar factor in term at time n % xn: column vector with x n s...
function output = triangle_bipolar_1(A, f, t, n) output = 0; for n=1:1:n if rem(n,2) == 0 output = output + (8*A)/pi^2 * 1/(2*n-1)^2*sin(2*pi*t * (2*n - 1)*f); else output = output - (8*A)/pi^2 * 1/(2*n-1)^2*sin(2*pi*t * (2*n - 1)*f); end end end
function [t,H,q,p] = LF(fcn, tspan, q0,p0, n, h) t0 = tspan(1); t_end = tspan(1)+(n-1)*h; h = (t_end-t0)/n; t = t0:h:t_end; H = zeros(1,length(t)); q = zeros(1,length(t)); q_half = zeros(1,length(t)); p = zeros(1,length(t)); H(1,1)=0; q(1,1) = q0; p(1,1) = p0; q_half(1,1) = q0 + (h/2)*(p0/0.9953); f...
% Program for calculating the PA element phases needed to correct for phase aberration at the one current focal % point using time reversal--that is, backward propagating a point source at the focal point, including steering, % back to the volume surrounding the transducer. The back-propagated pressure pattern is ...
%load the training data train_data = load('mnist_train.csv'); %pick the labels of the data train_labels = train_data(:,1); %pick the images of the data train_images = train_data(:,2:end); %normalize the images to create input ready data train_images = train_images(:,:)/255; %pick odd and even numbers a...
function [sys,x0,str,ts,simStateCompliance] = mav_dynamics(t,x,u,flag,P) switch flag, %%%%%%%%%%%%%%%%%% % Initialization % %%%%%%%%%%%%%%%%%% case 0, [sys,x0,str,ts,simStateCompliance]=mdlInitializeSizes(P); %%%%%%%%%%%%%%% % Derivatives % %%%%%%%%%%%%%%% case 1, sys=mdlDerivatives(t,x,u,P);...
function tu = matlab2unix(cyear, cmonth, cday, chour, cminute, csec, cmsec) datetime_str = datetime(cyear,cmonth,cday,chour,cminute,csec,cmsec); datetime_sec = datenum(datetime_str); tu = round(864e5 * (datetime_sec - datenum('1970', 'yyyy'))); end % function tu = matlab2unix_ez(tm) % tu = round(864e5...
function c = constDym(xVec, parms) [n,m]=size(xVec); if n<m xVec=xVec'; end c = zeros(parms.ndof*parms.totalKnotNumber, 1); for i=1:parms.totalKnotNumber xSeg = xVec( (1:parms.nVarSeg)+ (i-1)*parms.nVarSeg, 1); dymSeg = DineWraper(xSeg); %h is required c((parms...
% CSI 700: Midterm % Problem #4c % J Schott % 06 MAR 2011 function r = test_problem4(tol, alpha, c) x = [0.5;0.5]; for k=1:1:2000 xPrev = x; r(k,1) = k - 1; r(k,2) = x(1,1); r(k,3) = x(2,1); % calculate J(x) and f(x) J(1,1) = -2*x(2,1); J(1,2) = 1; J(2,1) = 2 * ...
function plotModulationIndex(experiments,expType,StimArea,RespArea,channels) %% By Mattia Path = get_path; parameters=get_parameters; countAnimal=0; GoodSpikes=[]; for n_animal = 1:length(experiments); experiment=experiments(n_animal); if ~isempty(experiment.animal_ID) && experiment.expression(1)==1 && strcmp(e...
clear all ;close all ; subs = {'alex','charest','esteban','fabio','gab','gabriella','genevieve','gina','guillaume','jeremie','julie','katrine','lisa','marc',... 'marie','mathieu','maxime','mingham','patricia','po','russell','sunachakan','tah','vincent'} ; stimnames = {'unperturbed','5% contrast','33% contrast'...
clear all; close all; Nq = 2; M = 2^Nq; L = 4; length_signal = 24; length_signal = length_signal*Nq; inputsig = randi( [0,1],length_signal, 1); [qam, M] = qam_mod(inputsig, M); nf = modnorm(qam,'peakpow',1); qam = qam*nf; P = 6; ofdm = ofdm_mod(qam, P, length_signal/Nq, L); %%%%%%%%%%% H(z) = 1 and SNR = infinty...
function [im,labels] = getBatch_(imdb,net,batch) im = single(imdb.images.data(:,:,:,batch)); im = bsxfun(@minus,im,net.meanVector); labels = imdb.images.labels(:,batch); end
function [points] = getHarrisPoints(I, alpha, k) % Finds the corner points in an image using the Harris Corner detection algorithm % Input: % I: grayscale image % alpha: number of points % k: Harris parameter % Output: % points: point...
function [ database ] = create_window_collisions( stream, k ) %CREATE_WINDOW Summary of this function goes here % Detailed explanation goes here %k - length of the window %stream - training data packet_size=40; % size of each packet and collision pat= 2*ones(1,packet_size); % create a pattern of collision to find i...
% Copyright (C) 2001-2009 Nicolas Guilbert %% %% This program is free software; you can redistribute it and/or modify %% it under the terms of the GNU General Public License as published by %% the Free Software Foundation; either version 2 of the License, or %% (at your option) any later version. %% %% This program is ...
% Copyright 2018, by the California Institute of Technology. ALL RIGHTS % RESERVED. United States Government Sponsorship acknowledged. Any % commercial use must be negotiated with the Office of Technology Transfer % at the California Institute of Technology. % -----------------------------------------------------------...
function Model = createInternalModelFactory(Model, Options, ObservationNames, ActionNames, InputSize, OutputSize) % CREATEINTERNALMODELFACTORY Create an internal model from user-defined model % Copyright 2019 The MathWorks, Inc. % InputSize and OutputSize only applicable to basis function model UseDevice = Options.U...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % classOSN includes all proprieties and methods specific for OSNs % % Licurgo de Almeida % 04/17/2013 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% classdef classOSN < classNoSpkNeuron properties AMPA...
%% Homework 1 % Roy E. Crippen IV % ENG 101 % Due 9/30/2019 %% Introduction % This m-file contains all of the problems for homework 1. I have each % problem separated in their own m-file if that is what you would prefer, just % let me know and I will resubmit those files instead. The homework is formatted in this w...
function [EEGres,timep] = remove_gradient2(EEG) % function [EEGres,timep] = remove_gradient2(EEG) % remove gradient from EEG dataset chanN = 48 ; % step 1: get the indices of the gradient epochs hp = eegfiltfft(EEG.data(chanN,:),5000,20,5000) ; allhp = eegfiltfft(EEG.data([1:31],:),5000,30,5000) ; stdh...
function [X, Out_tSVD_TNN] = tSVD_TNN(Xmiss,Omega,opts) if isfield(opts,'beta'); beta = opts.beta; else beta = 1e-2; end if isfield(opts,'maxit'); maxit = opts.maxit; else maxit=500; end if isfield(opts,'tol'); tol= opts.tol; else tol = 1e...
function [ path_length_log, path_safety_log, paths_log, x_nodes, y_nodes ] = safeQuasiPathService(prm_adj_list, configs, min_x, max_x, ... min_y, max_y, min_t, max_t, theta_config_count) %Safe Path: Find a safe path in a graph. % Detailed explanation goes here total_config = size(configs,1); startNodes = find(config...
function varargout = sure(varargin) % SURE M-file for sure.fig % SURE, by itself, creates a new SURE or raises the existing % singleton*. % % H = SURE returns the handle to a new SURE or the handle to % the existing singleton*. % % SURE('CALLBACK',hObject,eventData,handles,...) calls th...
function pgi=PGI_SV(sv) % PGI_SV computes the public good index from a simple game to determine the set of minimal winning coalitions. % % Usage: gpi=PGI_SV(sv) % Define variables: % output: % pgi -- The Holler/Public good index. % % input: % sv -- Data array of a single game of length 2^n-1. % % Autho...
addpath(genpath(pwd)) x = input('Would you like to save the path for the next session of MATLAB? (y/(n))','s'); if (isempty(x)) x = 'n'; end if x=='y' || x=='Y' savepath disp('Path saved.') else disp('Path added, but not saved. It will only be used for this session of MATLAB.') end
function displayBoardOnly( board, num ) %displayBoardOnly: Plots locations of ships onto a single figure plot. % % Input Arguments: % board = Board data type to display % num = Display iterator; used to decide if create or update figure % Global variables imported global boardSize; % Check if...
function [O_penalty, O_grad]=penalties_smoothness(O,sizeI,Scaling) % This function calculates the 2D or 3D equivalent of the 2D % bending energy of thin sheet of metal, for a 2D or 3D transformation % grid of cubic spline control points. % % [O_penalty, O_derivative]=penalties_smoothness(O,sizeI,Scaling); % %...
% function fns = expstruc(X,sname,ll,lname,mems) % % Recursively explode a structure to find all members. % % INPUTS % ------ % X; structure to be exploded % sname; structure name % ll; structure level (1= top) % lname; name of the field (string, completely expanded) % mems; structure containing field names and data ty...
function [Cells] = FilesToCell myDir = uigetdir; %gets directory myFiles = dir(fullfile(myDir,'*.csv')); %gets all wav files in struct Cells = cell(length(myFiles),3); for k = 1:length(myFiles) baseFileName = myFiles(k).name; NameArguments = strsplit(baseFileName, '_'); Cells{k...
function stan_ephys_getdata_su % % % % % scan for single unit files [options,dirs]=stan_preflight; files=robofinch_dir_recurse(pwd,'sua_channels*.mat'); for i=1:length(files) files(i).name % scan the metadata [pathname,filename,ext]=fileparts(files(i).name); su_info=stan_read_metadata_su(fullfile(pathname,'...
clear all; close all; clc % Lectura de DATA load datosm3.lvm % cargar data t=datosm3(:,1); % tiempo y=datosm3(:,3); % salida u=datosm3(:,2); % entrada figure subplot(211), plot(y,'r'), title('Salida') subplot(212), plot(u,'r'), title('Entrada') ident %% Fcn Ident MATLAB T=0.001; dato=iddata(y,u,T); % data objeto %% ARX...
function [delta, probData] = linSolve3(soln, probData, RHS) % This method implements a block solver for the Newton system. % -------------------------------------------------------------------------- % USAGE of "linSolve3" % delta = linSolve3(soln, probData, RHS) % -----------------------------------------------------...
clc clear all close all data = dlmread('old_faithful.dat','\t',26,0); data = data(:,2:3); X=data; figure; plot2 = gscatter(data(:,1), data(:,2)); hold on; x1 = min(data(:,1))-2:0.1:max(data(:,1))+2; x2 = min(data(:,2)):0.1:max(data(:,2)); [X1,X2] = meshgrid(x1,x2); % initialization step % declare p...
function srinit % This function sets up a bunch of storage ring parameters % BPMNumAverages = 16*16; % Set the BPM averaging setbpmavg(BPMNumAverages); fprintf(' BPM averaging set to %d\n', BPMNumAverages); % QD shunts off %fprintf(' Switch QD shunts off...\n'); %setqfashunt(1, 0);
function filtered = LowpassFilter2(input,r) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This function is a low pass filter. % Here the unit of r is pixel. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [yn,xn] = size(input); [XX,YY] = meshgrid(1:xn,1:yn); Filter = (XX...
% (ExampleDSB.m) % This program uses triplesinc.m to illustrate DSB modulation % and demodulation ts = 1.e-4; t = -0.04:ts:0.04; Ta = 0.01; m_sig = triplesinc(t,Ta); Lfft = length(t); Lfft = 2^ceil(log2(Lfft)); M_fre = fftshift(fft(m_sig,Lfft)); freqm = (-Lfft/2:Lfft/2 - 1)/(Lfft*ts); s_dsb = m_sig.*cos(2*pi*500*t);...
% Dobashi implementation % function [Pv,player] = main_v4 global Table NumSources NumSources=10; SampFreq=16000; ConstructTable; Pv = SoundPressure(SampFreq); % Sound rendering player = audioplayer(Pv,SampFreq); % figure, plot(Table(1).Texture) end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%...
rng('default'); load('testdata_scz_Z1_ctl_Z0.mat') mu0=mean(Z0); sigma0=cov(Z0); mu1=mean(Z1); sigma1=cov(Z1); %% smpsiz=100:100:2100; lamdav=1:0.2:5; Zc=cell(21,21); %% for kx=1:21 for ky=1:21 Sz=smpsiz(kx); Lv=lamdav(ky); p=ones(100,1); [kx ky] parfor k=1:100 ...
files=dir('roi*.mat'); numsubs=42; numatlases=length(files)/numsubs; d=25; % mnrfullrank=zeros(numatlases,d); % threshfullrank=zeros(numatlases,d); % mnrrank=zeros(1,numatlases); % threshrank=zeros(1,numatlases); % rois=zeros(1,numatlases); % D = zeros(numsubs, numsubs, numatlases); [mnrfull,threshfull,mnr,thresh,roi...
% book : Signals and Systems Laboratory with MATLAB % authors : Alex Palamides & Anastasia Veloni % % % % stability syms n h=1/(2^n) symsum(abs(h),n,0,inf)
function map_output = smooth_small_map( map_input ) % diag_coef=2*(1-sqrt(2)/2); diag_coef=0.5; filter_cell=[diag_coef 1 diag_coef ; 1 2 1; diag_coef 1 diag_coef ]; map_output=conv2(map_input,filter_cell,'same')/sum(sum(filter_cell)); end
function uvo = denoise_bilateral_filter(uv, im, occ) % Classify input flow into two regions: % edge region: bilateral filtering w.r.t. to reference image IM % smooth region: MF (9x9) to fit translational motion or robust affine % the bilateral used in particle video bfhsz = 10; % half bilateral filtering size sigma...
function cls_ws_set = classWiseSet(Table) %============================================================================================================================= % This function groups the objects or examples based on thier decision attribute values. % Input: % A table, whose first column repre...
I=ones(300,600,3); r=150; c=300; for i=1:size(I,1) for j=1:size(I,2) dist=sqrt((i-r)^2+(j-c)^2); dist=round(dist); if(dist<75) I(i,j,2:3)=0; end end end figure,imshow(I);
function hetero = get_hetero_locus(data, locus, member_list) hetero(1:3) = 0; for i = 1:length(member_list) seq = data(member_list(i), 6 + locus * 2 - 1 : 6 + locus * 2); if( seq(1) ~= 0 && seq(2) ~= 0 ) if( seq(1) == seq(2) ) hetero(1) = hetero(1) + 1; else hetero(2) = ...
function [C] = inm_strassen(A, B) %echivalent cu C = A * B [na ma] = size(A); [nb mb] = size(B); %if na > 8 || ma > 8 || mb > 8 % C = A * B; % return ; %end n = max(na, max(ma, max(nb, max(mb)))); %aflam cea mai mare dimensiune a matricilor, necesar pentru completarea cu 0 n = nextpow2(n); d = 2^n; % fi...
function [freq, port, s11, s21] = ParamMetaSlab(varargin) % Simulation of a Slab with two arrays of SRRs % % -Create a slab made of ground and substrate. % -Calculate the number of SRRs needed to fill the slab (on x axis) % -Fill the two edges of the slab with SRRs. (As a patch on the substrate % of the slab). The S...
function [F,J] = NashCondition(p, follows, langs, logt, constants, k) % follows: n-by-m (sparse) 0-1 matrix. follows(j,i) = 1 if i follows j % m = total number of users in graph % n = total number of bilingual users who are followed-by % langs : 2-by-m 0-1 matrix. langs(j,i) = 1 if i speaks languag...
clear; cam = webcam(2); cam.Resolution = '640x480'; preview(cam) pause(10) closePreview(cam) img = snapshot(cam); imshow(img);
pyrunfile("main.py")
function FootEventCell=FootFPInfo(plotFP, FootEventCell, trajectories, events, xv1, yv1, xv2,yv2, xv3, yv3, S, vicon) % Get extra info for the Foot Event Cell %Points in Trajectory MarkerNames=vicon.GetMarkerNames(S)'; LHEE=find(strcmp('LHEE',MarkerNames)); LTOE=find(strcmp('LTOE',MarkerNames)); RHEE=find(strcm...
Nr = 19200; % number of detector elements rLen = xLen * 1.5; % length of detector rVec = (0.5:Nr-0.5) * rLen/Nr - rLen/2; % r-axis p = ones(Nr); figure(13) domain = 'fourier1'; q = rampfilter(p, rVec, domain); axis([-0.1 0.1 -0.2 0.25])
function [lnpost x add_matrices]=likelihood_wrap_withstates( params,setup,data ) [ param ] = inv_transform( params,setup.index_log, setup.index_logit,setup.index_logit_general, setup.length_log,setup.length_logit,setup.length_logit_general,setup.logit_general_lb,setup.logit_general_ub ); current_matrices=zeros...
function [points] = SelectKRandomPoints(A,k) %SelectKRandomPoints.m is a function generates a list of k randomly %selected pixels from an image. All of these points are unique. %Inputs: % A = a 3D image array % k = Number of points to randomly select %Outputs: % points = A 2D array representing k rand...
clear; clc; N = 10; A1 = hex2dec('6058') + hex2dec('0002')*65536; A2 = hex2dec('7DB3') + hex2dec('0002')*65536; A3 = hex2dec('9873') + hex2dec('0002')*65536; A4 = hex2dec('A283') + hex2dec('0002')*65536; A5 = hex2dec('966B') + hex2dec('0002')*65536; A6 = hex2dec('79BC') + hex2dec('0002')*65536; A7 = hex2dec('5F55') + h...
data = load('ex1data1.txt'); X = data(:, 1); y = data(:, 2); m = length(y); % number of training examples fprintf('Running Gradient Descent ...\n') X = [ones(m, 1), data(:,1)]; % Add a column of ones to x theta = zeros(2, 1); % initialize fitting parameters % Some gradient descent settings iterations = 1500; alpha =...
classdef TDCFeatExtractor < handle & featpipem.features.GenericFeatExtractor %PHOWEXTRACTOR Feature extractor for cell deformation properties use_gpu features = containers.Map({'flow','rgb','idt'},... {{'pool1','pool2','conv3','conv4','conv5'},... {'pool1','pool2','conv3','conv4','conv5'},....
function [Jacobian,residual] ... = problem_jac_res_init(qstar,qpast,data) % Forms the %Jacobian of equations given by the DG data.method for a fiv1ed cell % written by data.Pierson Guthrey % ------------------------------------------------- % INdata.PUTS DGsubregion % prevcell % starcel...
function stim_movie(optstr,w,objID,arg) %function stim_movie(optstr,w,objID,arg) % % showex helper function for 'movie' stim class % % Each helper function has to have the ability to do 3 things: % (1) parse the input arguments from the 'set' command and precompute % anything that is necessary for that stimulus % (2) i...
% [peaks, idx]=findpeaks(scope_A.signals.values(:,2)); clear idxAo idxBo idxBi idxAi peaksA peaksB indcA indcB Axft Bxft inAxft inBxft max_valA max_valA2 max_valB max_valB2 idxA idxB timeA timeB FsA FsB prompt = 'What is the value of the A Amplitude? '; prompt2 = 'What is value of the B signal Amplitude '; if(isemp...
% This is an example use of the plot function % used in association with the finding of a root % problem solved earlier. % a is the lower value of the range % b is the upper value of the range a = 0; b = 3; hf= @testf; hderivf= @testderivf; fa = -inf; fb = inf; delta = (b-a)/100; xx = a:delta:b; %plot(xx,xx .^3-2...
close all clear all fclose all; HumanInit Timeoffset = now; %% ChanColLabel = [ 1 1 0; 0 0 1; 1 0 0; .8 .8 .8; .5 .5 .5; 1 1 1; 0 .7 0; .8 .8 .8 ]; Npts = 100; %% H=figure; Hstop = uicontrol('position',[0 0 40 20],'style','togglebutton','string','stop','Callback...
% real convolution function y=realconvolution(reroot,imroot,gammac,tau,t) y=(1/gamma(gammac)/gamma(gammac)).*(tau.^(gammac-1).*exp(reroot.*tau).*cos(imroot.*tau)).*((t-tau).^(gammac-1).*exp(reroot.*(t-tau)).*cos(imroot.*(t-tau)));
function [ hg ] = plotColoredBrain( cData, resort, transparency ) %PLOTCOLOREDBRAIN Function that colors 66 areas of brain according to cData % Input Parameters: % cData - vector of length 66 that is used to color 66 brain regions % resort - If true, rearange the order of cData % (reverses ...
n = 9; h = 1/(n+1); x=zeros(n+2,1); for i=2:n+2 x(i)=(i-1)*h; end q=@(t) pi^2; p=@(t) 1; fRR = @(t) 2*pi^2*sin(pi*t); Q=zeros(6,n+1); for i=1:n-1 q1i =@(t) (x(i+2)-t)*(t-x(i+1))*q(t); Q(1,i) = SimpsonRule(x(i+1),x(i+2),100,q1i)/h^2; end for i=1:n q2i =@(t) (t-x(i))^2*q(t); Q(2,i) = Simpson...
% color_01 [script] clear all; close all; clc grayAviao = imread('f3_p3_knife_plane_drop_dy_2-22.jpg'); th = graythresh(grayAviao); bw1 = im2bw(grayAviao, th); bw1 = ~bw1; %inverte grayd = mat2gray(grayAviao); %double [0...1] aviao2 = mat2gray(bw1); aviao2 = imsubtract(grayd, aviao2); #Inteiros para apl...
function point = pointOnLine(line, pos) %POINTONLINE Create a point on a line at a given position on the line. % % P = pointOnLine(LINE, POS); % Creates the point belonging to the line LINE, and located at the % distance D from the line origin. % LINE has the form [x0 y0 dx dy]. % LINE and D should hav...
% find_FOVs_and_crop_proton_image %% Created - on 2/23/2016 % % by MP, while running the process_c13_date, this code checks the FOVs for % the proton and carbon scans and chooses the appropriate image sizes. % % Update(1) by MP on 10/23/2018 % finds the interpolation factor to match the size of the proton and carbon % ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Fill the Parent Population According to the NSGA II Algorithm % % % % Author : Julie...
% >> First calls matrix_completion(Wtmp,H,4,2,4) % X = Wtmp (rescale W_k) % W = H % rfinal = 4 % mode = 2 % rinit = 4 % So does the loop the first time have just 1 iteration? function [Z,U,V]=ALM_nuclear(X,W,rfinal,mode,rinit) Z=[]; U=[]; V=[]; if nargin<5 %for rank continuation to avoid local minima rinit=rfin...
% This function returns the vector field that forms the basis % for normal space of {\cal A} function delG = Basis_Normal_A(q) [n,T] = size(q); e = eye(n); for i = 1:n Ev(:,:,i) = repmat(e(:,i),1,T); end for t = 1:T qnorm(t) = norm(q(:,t)); end for i = 1:n tmp1 = repmat(q(i,:)./qnorm,n,1); tmp2 = repm...
function [ W ] = CalcWerk( To, Tf, mixVec,mDot) %CalcWrk [Matt] % This function calculates intensive work over a device from % two temperature states as the difference of the % total enthalpies at each state (generated from the % function hMix) % W - total work (integral of cp dT) in J/mol-K PER MOL OF FUEL ...
% edit this if you want to only import part of the data. Include 1 in the % vector if you want to ignore the graphData, 2 for agentTrance and 3 for % the agentLog. ignore = []; % add paths addpath(genpath('helperFiles')) addpath(genpath('customFiles')) % import data [graphData, agentTrace, agentLog] = importAATOMDataF...
% Z and P contains the matrix after removing the first index; %Zack Pot; %You might need to remove the first column ; %For retweaking of the code and reproducability; %you have to implement LOOCV based on the derivations in the previous part. ; % Calculate LOOCV error for each λ and plot it alongside training and valid...
% Replicate the regression example as in FdRegress_eg.m for % 100 times to calculate the mean square error of predictions. %% set a random seed stream = RandStream('twister','Seed', 1234); reset(stream); % set up a seed for simulation %% add fdaM path and load Bayesian smoothing output addpath(genpath(cat(2, pwd, '...
% Homework 5 load p5.mat; % Problem5 % soundsc(X1,24000); % "Matlab, breakfast of champions BUT with a high pitch tone over top of it N=length(X1)/2; F=linspace(0,12000,N); FX1=abs(fft(X1)); % plot(F,FX1(1:N)) num = [1 -1.93185 1]; den = [1 -1.91253 .98]; XF = filter(num,den,X1); % soundsc(XF,24000); % Problem ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2012 Analog Devices, Inc. % % 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:/...
function [ I, areas ] = integrate_areas_by_area( img, n_areas, area ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here close all areas = zeros(n_areas, 4); I = zeros(n_areas, max(size(img))); plot_image_ui(img{1}) for i=1:n_areas for j=1:i-1 re...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This function is significantly faster than the other. Instead % % of reading the file many times, it only reads each audio file % % once, then splits the audio as a matrix. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Mathematical modeling of the triple pendulum %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Angle up zero clear; clc syms M m1 m2 m3; syms x xd xdd theta1 theta1d theta1dd theta2 theta2d theta2dd theta3 theta3...
function vert_projection = get_vertical_projection(X, Y) round_X = int32(X); round_Y = int32(Y); norm_X = round_X - min(round_X) + 1; norm_Y = round_Y - min(round_Y) + 1; unique_coords = unique([norm_X, norm_Y], 'rows'); unique_X = unique_coords(:, 1); unique_Y = unique_co...
function VPI=valueOfPerfectInformationBernoulli(alpha,beta) %mu: vector of expected values of the returns of all possible actions %sigma: corresponding standard deviations %c: index of the action about which perfect information is being obtained E_correct=[alpha,beta]/(alpha+beta); [max_val,max_pos]=max(E_correct); E...
function fields=separate_field_names(concatenated_fields) for i=1:length(concatenated_fields) fields{i,:}=strsplit(concatenated_fields{i},'.'); end end
function numdiff = ndiff(A) % % Accounts for the number of different elements that compose the matrix A B = A(1); for i=2:numel(A) if isempty(find(A(i) == B)) B = [B A(i)]; end end numdiff = length(B);
clear clc prefix = '/home/pzhang/chen/move-bed/'; prefix = '/media/pzhang/My Book/move-bed-tmp/move_bed_2/'; for iiii = 4:4 % if(iiii==1) % middle = 'test_mvbed_'; % else middle = strcat('test_mvbed_',num2str(iiii-1),'_'); % end R = 10; LP = 40; num = 1:999; for i = 1:numel(num) name = strcat(prefix,middle,...
function [mt1,mt2,upl_mt1,lor_mt1,upl_mt2,lor_mt2,match_weight,err]=temp_temp_matching(t1,t2,upl_1,lor_1,upl_2,lor_2,th,cal) %% TEMPLATE-TEMPLATE MATCHING PROCEDURE % Input %% t1, t2 : templates to be matched %% upl_1, upl_2 : image coordinates of the templates' upper left corner %% lor_1, lor_2 ...