text
stringlengths
8
6.12M
clc;clear; xi = 1994:2003; xi = xi'; yi = [67.052, 68.008, 69.803, 72.024, 73.400, 72.063, 74.669, 74.487, 74.065, 76.777]; x = sym('x'); p = newtonpoly(x, xi, yi); % 绘制9次多项式图像 a = 1994:1:2003; p = subs(p, x, a); plot(a, p); % 计算2010年石油产量 res = newtonpoly(2010, xi, yi); sprintf('%.3f%', res)
function varargout = rect2patch(C,R) % [rect] = rect2patch(C,R) % C = centre % R = 'radius' if numel(C)<2 error end if numel(R)==1 R = [R R]; end if nargout==1 %% rectangle matrix rect = [C(1) C(2) R(1) R(2)]; varargout(1) = {rect}; else %% patch matrix X = [C(1) C(1)] + ...
function P = getProbabilitiesForPoints(X, directions, thresholds, leafProbabilities) % For each point in X, calculate the probability of belonging to the % implicitly given label described by leafProbabilities. % % Based on the learned splits the input data point traverses the tree until % reaching a leaf node. The lea...
function call_copy() % clicking on axes within a figure, opens a new figure with only the % clicked axes in it. % Usage: % ff = findobj('type','axes'); % set(ff,'ButtonDownFcn','call_copy'); % (c) Tonio copyobj(gca,figure); set(gca,'Position',[0.13 0.11 0.775 0.815]); set(gca,'ButtonDownFcn',''); h_child=get(gca,'Chi...
function [x, y, z] = shifting(xq, yq, zq, size_pic, fr) widht_pix = 2999/36; x = xq + ceil(size_pic(2)/2); y = yq + ceil(size_pic(1)/2); z = zq + widht_pix*fr;
function [X, Y, Z] = mregularize(xx, yy, idepths) x = idepths; x_bar = x; x_old = x; sigma = 25; tau = 0.01; theta = 0.5; yLeft = zeros(length(yy), length(xx)); yUp = yLeft; niters = 50; for it = 1:niters for r = 2:length(yy) for c = 2:length(xx) de_xi_xj = x_bar(r,c) - x_bar(r-1, c); ...
function [ fitness ] = karma(soul, input_data) sz = size(input_data,1); total_dist = 0; for(i = 1:sz-1) total_dist = total_dist + input_data(soul(i),soul(i+1)); end total_dist = total_dist + input_data(soul(sz),soul(1)); fitness = total_dist; end
clear all; close all; % Gaussian mean and covariance d = 10; % number of dimensions mu1 = rand(1,d); sigma = rand(d,d); sigma = sigma*sigma'; % generate 100 samples from above distribution num = 500 ; sampleData = mvnrnd(mu1, sigma, num); mu2 = [(mu1(:,1:5)+5),mu1(:,6:end)]; sampleData =...
function [ costMat, minCutNodes] = PRMAnalysisSparse( A,startNodes,goalNodes,total_config) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here % close all; % A = []; % As = []; % Ae = []; % convert into sparse matrix and then graph % As = spconvert(Ds); % A = full(As); % G = graph(As); G ...
function g_cb(x) % G_CB(x) % % Copy data from vector x to clipboard as a string % % Gunnar Voet, APL - UW - Seattle % voet@apl.washington.edu % % Created: 01/28/2014 % Create strings str = ['[', sprintf('%1.3f ',x),']']; % s = sprintf('%s\n%s'); % Copy output string to clibpoard clipboard('copy',str)
function b = log_mvtpdf(y,mu,Sigma,nu) %for multivariate t with arguments y,mu,Sigma,nu %evaluate the t density k=length(y); c = k*.5*log(pi)+gammaln(.5*nu)-.5*nu*log(nu)-gammaln(.5*(nu+k)); b = -c-.5*log(det(Sigma))-.5*(nu+k)*log(nu+(y-mu)'*inv(Sigma)*(y-mu));
function [mImage] = updateMultBoLongImageSoftMem(mAdj, mImage, mMembership, fDistanceFunc) % % Updates mImage according to KKT condition derived multiplicative update % rule. % % Bo Long formulation for Soft cluster membership % % % @author: Jeffrey Chan, 2014 % mMemSq = mMembership' * mMembership; % mDenom =...
clear('pman'); pman.name = 'Laplace'; pman.size = 100; pman.pars{1}=[0]; pman.pars{2}=[1.2]; % Comment out check at the end: irp = ept.potman_intrepres(pman); % Now run check s = eptools_potmanager_isvalid(irp.potids,irp.numpot,irp.parvec, ... irp.parshrd); clear('pman2'); pman2{1} = pman; pman2{2}.name = 'G...
function X = huberMean(Y, numberOfStds, iters) % Perform a Huber mean using the Huber loss function. % x = huber_mean(Y,rho,iters) % % Input: % Y : MxN matrix over which to average (columnwise) % numberOfStds : Number of robust standard deviation in which the function acts like regular mean (default: 1) % iters :...
% specnoise.m plot the spectrum of a noise signal % The randn function returns a sample of random numbers from a normal distribution with mean 0 and variance 1. % The general theory of random variables states that if x is a random variable whose mean is μx and variance is σ2x, % then the random variable, y, defined ...
%%%%%%%%%% OPEN FEATURES %%%%%%%%%%%% if 0 elseif strcmp(typeObj,'goose') load('goose_kernel.mat'); param.imFileList = param_dummy.imFileList; param.featFileList = param_dummy.featFileList ; param.lW_px = param_dummy.lW_px; clear param_dummy elseif strcmp(typeObj,'statue') load('stat...
options.face_vertex_color = []; vertex1 = perform_normal_displacement(vertex_u',faces_u', .03); clf; subplot(1,2,1); plot_mesh(vertex_u,faces_u,options); shading interp; axis tight; subplot(1,2,2); plot_mesh(vertex1,faces_u,options); shading interp; axis tight;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2010 - 2015 Moon Express, Inc. % All Rights Reserved. % % PROPRIETARY DATA NOTICE: % The data herein include Proprietary Data and are restricted under the % Data Rights provisions of Lunar CATALYST Space Act Agreement % No. SAAM ID#...
% This script produces figure 3 of the article clear all dt = .0002; T = 0.5; x = load('signals_figure3.mat'); signal = x.signal3; rand('state',1) % generate base pattern [spikes, cov] = genUncorrelated(1500, T, dt, 20, [1 0 0]); nt = 32; ne = 2; % find optimal weights under noise tic [weights, err, t, corrupt, e...
function output = solveFuncNew(X,x,g,amp,sigma,h) eta = X(1:end-1); c = X(end);N = (length(eta)-1)/2; [cc cV] = getC(eta,h,g); firstEqn = hat(c^2 - cV.^2); firstEqn(N+1)=0; finalEqn = abs(amp - .5*(max(eta) - min(eta))); output = [firstEqn; finalEqn];
clear all; close all; clc I = imread('E:\Semester VII\Final Year Project\iCub_jpg\00001323.jpg'); subplot(3,3,1) imshow(I); cform = makecform('srgb2lab'); J = applycform(I,cform); %subplot(3,3,2) %imshow(J); K=J(:,:,2); %subplot(3,3,3) %imshow(K); L=graythresh(J(:,:,2)); BW1=im2bw(J(:,:,2),L); subplot(3,...
function sampled_af = minor_allele_frq(af, smooth_interval) % convert to minor and major allele frequency [nmarkers, c] = size(af); if( c ~= 3 ) disp('error in allele frequency'); return; end major(1:nmarkers) = 0; minor(1:nmarkers) = 0; for i = 1:nmarkers major(i) = max(af(i,1:2)); minor(i) = min(a...
function [u_coord, sutm]=unanimity_games(clv) % UNANIMITY_GAMES computes the unanimity coordinates or Harsanyi dividends. % For n>14 this function needs some time to complete. % % Usage: [u_coord utmat]=unanimity_games(clv) % % Define variables: % output: % u_coord -- Unanimity coordinates or Harsanyi dividends. % ...
% MPLMPLTC.M % For plot of magnetization profile % Called by MPLPM mplmplt = get(mpluimplt,'Value') ; if mplmplt == 1 ; set(mpluimplt, 'BackGroundColor', 'white') ; if mplslplt == 1 ; set(mpluislplt, 'BackGroundColor', 'white') ; end ; elseif mplmplt == 0 ; set(mpluimplt,'BackGroundColor',[0.501961 0.501961 ...
function computeConeResponsesToDriftingGratings(runParams, ... stimColor, stimTemporalParams, stimSpatialParams, ... theConeMosaic, theOptics, ... recomputeNullResponses, ... instancesNum, ... opticsPostFix, PolansSubjectID, ... saveDir, varargin) % Parse input p = inputParser; p.a...
function fitSimpleHLN(handles, side) % Perform fit of the data on the 'side' (positive or negative) of the field set(handles.tlStatus, 'String', 'Fitting Truncated HLN...'); set(handles.tlStatus, 'String', 'Estimating Parameters...'); [alpha, bPhi] = estimateAlphaBphi(handles, side); set(handles.tlStatus, 'String', '...
%% 2016.12.02 % Numerical Analysis Programming % Chapter 10 & 11. LU Factorization & Matrix Inverse and Condition clc; clear; %% Problem 1. A1=[7 2 -3; 2 5 -3; 1 -1 -6]; b1=[-12;-20;-26]; [m,n]=size(A1); L1=eye(n); f21=A1(2,1)/A1(1,1); f31=A1(3,1)/A1(1,1); Ui1=[A1(1,:); A1(2,:)-A1(1,:)*f21; A1(3,:)-A1(1,:)*f31]; f32...
function rbm_lab() %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Exprimental code for Restricted Boltzmann Machines % % The code is developed for Neural Computing tutorial % % MSc on Data Science, CITY UNIVERSITY LONDON % % Authors: Son Tran, Artur Garcez % %%%%%%%%%%%...
%This MATLAB code is associated with the following manuscript: Barrick, %S.K., S.R. Clippinger, L. Greenberg, M.J. Greenberg. 2019. Computational %tool to study perturbations in muscle regulation and its application to %heart disease. %This script tests whether a sufficient number of bootstraps have been %perfo...
function plotHopDiffs(timesteps, ... totalAbsDiffs, absDiffsPerFeature, absDiffsPerObject, ... absDiffsPerImage, signChangesPerFeature) figure(); subplot(1, 4, 1); plotHopConvergence(timesteps, totalAbsDiffs, signChangesPerFeature); xlabel('Time'); ylabel('Total absolute difference'); subplot(1, 4, 2); images...
clear clear java clear classes; vid = hex2dec('3742'); pid = hex2dec('0007'); disp (vid); disp (pid); javaaddpath ../lib/SimplePacketComsJavaFat-0.6.4.jar; import edu.wpi.SimplePacketComs.*; import edu.wpi.SimplePacketComs.device.*; import edu.wpi.SimplePacketComs.phy.*; import java.util.*; import org.hid4java.*; ve...
%% a RL based model for counting function output = touch(epochs, seed, doPlotting, showSteps, showProgress) if nargin == 0 epochs = 100; seed = randi(99); doPlotting = true; showSteps = false; showProgress = false; end rng(seed); %% initialization % modeing parameters p = setupParameters(epochs); % preallocat...
function [distOut,timeOut,xOut,yOut] = feasibleTrajectory(start,goal) diffs = goal - start; N = size(diffs,2); slopes = [-1E-6,-2; -1,-2; -2,-2; -2,-1; -2,0; -2,1; -2,2; -1,2; 0,2; 1,2; 2,2; 2,1; 2,0; 2,-1; 2,-2; 1,-2; 0,-2]; speed = vecnorm(slopes,2,2); speed(1) = 2; thetas = ze...
function [y,Ak] = interpSinc(tk,yk,t,T0,B) Ak = B * yk; % Coefficients y=zeros(size(t)); % Reconstruction for i=1:length(Ak) y = y + Ak(i)*(sinc((t-tk(i))/T0)/T0); end
function [ y ] = rotNaVecF( agol1, n, org )%codegen agol=deg2rad(agol1); nNorm=norm(n); pom=n./nNorm; n=pom; M=[(n(1)^2)*(1-cos(agol))+cos(agol) n(1)*n(2)*(1-cos(agol))+n(3)*sin(agol) n(1)*n(3)*(1-cos(agol))-n(2)*sin(agol); n(1)*n(2)*(1-cos(agol))-n(3)*sin(agol) (n(2)^2)*(1-cos(agol))+cos...
% Blair, Gupta, and Zhang 2008's ring attractor oscillatory interference model % eric zilli - 20110908 - v1.0 % % Here we carry out the extension to the model that the authors suggest % so that it can handle 2D trajectories. % % See BlairEtAl2008.m for more. % % This code is released into the public domain. Not for us...
clc; clear; MTOW = 24266; MTOWcg = 24.75; plot(MTOWcg,MTOW,'x') hold on MTOWcgret = 24.71; plot(MTOWcgret,MTOW,'s') hold on NoPayload = 21266; NPcg = 24.6; plot(NPcg,NoPayload,'o') hold on NoPayNoFuel = 16103; NPNFcg = 24.02; plot(NPNFcg,NoPayNoFuel,'d') y = linspace(0,50000,100); x1(1:100) = 24; x2(1:1...
function ress = gpuNUFFT_forw(a,bb) % ress = gpuNUFFT_forw(a,bb) % Performs forward gpuNUFFT % from image to k-space % % supports multi-channel data % % a ... GpuNUFFT Operator % bb ... image data % W x H x D x (nChn) for 3d % W x H x (nChn) for 2d % %check if imgDims are 2d or 3d if (a.params....
% Javier Salazar 1001144647 % HW6 Neural Network (Multi-layer Perceptron) clc %--------input arguments--------------------------- trainName = 'USPS_train.txt'; % training and test files testName = 'USPS_test.txt'; hiddenLayers = 1; % excludingnput and output layers perceptronCount = 15; % hidden layers perceptrons per ...
% % Copyright (c) 2015, Yarpiz (www.yarpiz.com) % All rights reserved. Please read the "license.txt" for license terms. % % Project Code: YPAP111 % Project Title: Inventory Control using PSO and Firefly Algorithm % Publisher: Yarpiz (www.yarpiz.com) % % Developer: S. Mostapha Kalami Heris (Member of Yarpiz Tea...
% this is used to generate random targets among the intervals in adaptive % measurements demo = 0; % CHANGE AS NEEDED if demo == 1 nameTag = '_demo'; nrep = 1; % CHNAGE AS NEEDED else nameTag = ''; nrep = 8; % CHANGE AS NEEDED end NmaxTrials = 1000; NminTrials = 20; rightOrLeft = cell(1, nrep); dirTmp...
function [TS_f,f_vec,pings,r_tot]=TS_f_from_region(trans_obj,reg_obj,varargin) p = inputParser; addRequired(p,'trans_obj',@(x) isa(x,'transceiver_cl')); addRequired(p,'reg_obj',@(x) isa(x,'region_cl')||isstruct(x)); addParameter(p,'envdata',env_data_cl,@(x) isa(x,'env_data_cl')); addParameter(p,'cal',[],@(x) isempty(x...
% limpando a memória clear all; close all; clc % Input values for debug %% path = strcat(pwd, '\Dataset_Placas'); im = iread(path,'grey','double'); ths = 0.2; w = ones(2); str = placa2str(im,ths,w,'display'); %% path = strcat(pwd, '\Dataset_Placas'); im = iread(path,'grey','double'); ths = 0.2; w = ones(2,3); str...
function dat2= energyinfo1(data2,winsize,wininc,datawin,dispstatus) if nargin < 6 if nargin < 5 if nargin < 4 if nargin < 3 winsize = size(data2{1},1); end wininc = winsize; end datawin = ones(winsize,1); end dispstatus...
function [hypo_list, score_list, bbox_list, scale_list, mask_heights_list] = ... collect_hypo_across_scale(recog_result, ratio_list) nb_scale = length(recog_result); hypo_list = []; score_list = []; bbox_list = []; scale_list = []; mask_heights_list = []; for scale_no=1:nb_scale hypo_list...
A=zeros(5); for i=1:5 for j=1:5 A(i,j)=(i-1)*5+j; end end sum(sum(A)) sum(diag(A)) sum(diag(A(1:end,end:-1:1)))
%无自衡对象辨识 clc; clear all; close all; load wtankjy; TA=clock; Y1=Y; [lp,m]=size(Y1); if m>lp lp=m; end sum=0; for i=lp:-1:fix(lp*0.95) sum=sum+(Y1(i)-Y1(i-1))/dt; end k=sum/(lp-fix(lp*0.95)); oh=Y1(lp)-k*dt*lp; ota=-oh/k; T=ota; ta=fix(ota/dt); ob=Y1(ta+1); a=exp(-dt/T); b=1-a; ...
clear; clc; close all; % a = [1:3] % b = a' % c = rand(2,3) % d = eye(4) % e = zeros(3,2) % f = ones(2,3) A = [1,2,3;4,5,6] B = ['abcde','fffee'] C = {'123',123;'abc','edf'} %元胞数组 whos A B D = num2str(A) whos A D E = str2num(D) F = num2cell(A) whos E F G = {'123','','dfg'} H = cell2mat(G) %元胞转字符串,空的位置会被忽略 I = {'abc'...
function [timeStamps]=visual_stimulation(nFrames,stimul,repetitions) close all PsychDefaultSetup(2); %choosing the screen n2 where stim should be presented in fullscreen mode screenNumbers=Screen('Screens'); screenNumber=max(screenNumbers); white = WhiteIndex(screenNumber); waitframes=1;%by default we want to refresh e...
% Returns the number of 0, + - 1+i0 elements of matrix A and the number of other elements. % count_A(1) = the number of other elements of A. % count_A(2) = the number of -1+i0 of A. % count_A(3) = the number of 0+i0 of A. % count_A(4) = the number of 1+i0 of A. function [count_A] = COUNT(A) count_A = zeros(4,1); count...
function X = ranNor(X0, ran) % Normalize each dimension spearately with respect to the variance of distance. % % Input % X0 - original image, h x w % ran - range, 2 x 1 % % Output % X - new image, h x w % % History % create - Feng Zhou (zhfe99@gmail.com), 02-13-2009 % modify - Feng Zhou ...
%% Codes to create figure 3 in document clear all % Parameter values nsim = 200; p=2; nVal = [50 100 200]; noise = {'Low', 'High'}; % create the vector for MSE values eta_sim = zeros(200, length(nVal)*length(noise)); for nlev = 1:length(noise) for nInd = 1:length(nVal) cur = (nlev - 1)*(1+length(noise)...
function [delta, loss] = GFC_L2_loss(active, gt, mode) [r,c,cha,bz] = size(active); if size(gt,1)~= r gt = imresize(gt,[r,c]); end dt = active - gt; loss = 0.5 * sum(dt(:).^2)/bz; if strcmp(mode, 'train') delta = single(dt/bz); else delta = 0; end end
% TESTFIN % % Function to demonstrate use of fingerprint code % % Usage: [newim, binim, mask, reliability] = testfin(im); % % Argument: im - Fingerprint image to be enhanced. % % Returns: newim - Ridge enhanced image. % binim - Binary version of enhanced image. % mask - Ridge-like regio...
function expmu = nlpart(vx, rc_sigma) % Computes the mu or nonlinear part of utility [n,m,K] = size(vx); mu = zeros(n, m); for k = 1:K mu = mu + vx(:,:,k) * rc_sigma(k); end expmu = exp(mu); end
function varargout = SPAMS_Calibration_GUI(varargin) % UNTITLED MATLAB code for untitled.fig % UNTITLED, by itself, creates a new UNTITLED or raises the existing % singleton*. % % H = UNTITLED returns the handle to a new UNTITLED or the handle to % the existing singleton*. % % UNTITLED('CALLBAC...
% Plot time series of system near feasible coexistence state (if exists) with %(a) phage adsorption rate \phi=10^-9.5 (b) \phi=10^-10.5 and (c) \phi=10^-11.5 close all; clear all; %% Initialize parameters TT=100; % Length of time series (h) tstep=0.1; % Time step (h) ntime=int64(1+TT/tstep); % Total number ...
function job_sigmas_grid(varargin) ratname = varargin{1}; ntrials = str2double(varargin{2}); A_dim = str2double(varargin{3}); B_dim = str2double(varargin{4}); Amin = str2double(varargin{5}); Astep = str2double(varargin{6}); Amax = str2double(varargin{7}); Bmin = str2double(varargin{8}); Bstep = str2double(varargin{...
function results = ClassicalGradient(A,theta0,tspan,u0,varargin) %CLASSICALGRADIENT Summary of this function goes here % Detailed explanation goes here p = inputParser; addRequired(p,'A') addRequired(p,'tspan') addRequired(p,'u0') addOptional(p,'maxiter',100) addOptional(p,'beta',0.0...
% % % unit3_phase_learning_part2.m % S8 PROJECT % % Created by Mathias de Cacqueray on 14/02/14. % Copyright (c) 2014 Mathias de Cacqueray. All rights reserved. clear all; close all; clc; %UNIT 0 : CREATION OF TRAME %BLOC 0 : Creation de Trame. %[ trame,Fc,Fech ] = bloc0_sensor_gen( ); load('../../../data/data_...
function T = lnfft(xk,l) M = log2(l); xk( 1, l)=0; %序列补0 Wn = exp(-1i * 2 * pi / l); %旋转因子 T = bitrevorder(xk); %二进制码倒序 for K1 = 1 :1 :M %蝶形的个数 K2 = 2 ^ (K1 - 1); %每一级内节点间的距离 for K3 = 0 : K2-1 %m每一级内的旋转因子个数 Wni = Wn^( K3 * 2^( M - K1 )...
function SecondLevelFuncCAndBehaviour(nameF,conStart,conEnd,Hrat,outF,maxS,addN,addN2) % Second-level analysis of Distances Regressors Basis set % experiment goodP =1; based = '/home/smark/fMRI_ana'; spm_path = '/data/smark/spm'; data_path = '/data/smark/fmri_sub_preproc_dir/'; cleaned_data_path = '/data/smark/fmri_su...
function B = weights(C) R = response() B = R^(-1) * C' end
function [x, err] = qmr(A, b, max_iters) m_dot = @(x, y) dot(conj(x), y); n = length(b); x = zeros(n, 1); x_Q = x; % xhat = zeros(n, 1); r = b - A * x; rhat = r; p = r; phat = rhat; rho = zeros(max_iters, 1); rho(1) = m_dot(rhat, r); err = zeros(max_iters, 1); % Ex...
function z = calculate_vt(set_vt,set_dp) % % calculates the delivered tidal volume in milliliters to the rat in HUPC using the small % animal ventilator made by Harvard instruments. % % synatax: % desired_vt = calculated_vt(set_vt,driving_pressure) % written by MP on 9/1/2016 plot_linear_fits = 0; % driving pressure ...
function [weights] = map_correlation(map, idx) % compute correlation weight between map and idx range_map = map(idx); hits = sum(range_map >= 0.5) * 10; misses = sum(range_map < -0.2) * 10; weights = hits - misses; end
% Kronecker tensor product. % % See also: kron % Copyright 2008-2009 Levente Hunyadi function K = kronecker(X,Y) validateattributes(X, {'numeric'}, {'2d'}); validateattributes(Y, {'numeric'}, {'2d'}); if ~issparse(X) && ~issparse(Y) && (isreal(X) && isreal(Y) || ~isreal(X) && ~isreal(Y)) K = kron2(X,Y);...
close all; %% Current vs Time Plot --------------------------------------------------- f = figure; %subplot(3,1,1); plot(t_vec(9761:25820), i(9761:25820),'LineWidth', 2, 'Color', 'b'); grid on title('$Current\,vs\,\,Time$ ',... 'fontsize',18, 'fontweight','b', 'interpreter', 'latex') xlabel('$Time\,[s]$','font...
a25_Symplectic; global THERING refOptic; dk=0.01; elementlist; nmax=length(qlist) for j=1:nmax; refTwiss=gettwiss(); K=THERING{qlist(j)}.PolynomB(2); THERING{qlist(j)}.PolynomB(2)=K+dk; theTwiss=gettwiss(); rowx=(theTwiss.betax(qlist)-refTwiss.betax(qlist))/dk; rowy=(theTwiss.betay(qlist)-refTw...
function [flow_x, flow_y, matchScore] = computeSpecularPointMatches(xGrid, yGrid, f_depth, frot_depth, R, X_fl, Y_fl) xRes = xGrid(1,2)-xGrid(1,1); yRes = yGrid(2,1)-yGrid(1,1); [f_grad_x, f_grad_y] = gradient(f_depth, xRes, yRes); [fnew_grad_x, fnew_grad_y] = gradient(frot_depth, xRes, yRes); %X_fl =...
function [ evalU ] = spEval( space, mesh, geo, u_h, opt ) %SPEVAL computes the value or the derivatives, of a function given by its %degrees of freedom, at the quadrature nodes defined in the mesh. We recall %that in space_2d and space_3d the basis functions are defined as: % % 2d: % u(x) = p1(x1)*p2(x2) % % 3d: % ...
function [ t ] = bhaskara(a, b, c ) t1 = ( -b + sqrt(b*b - 4*a*c) )/(2*a) t2 = ( -b - sqrt(b*b - 4*a*c) )/(2*a) t = max(t1,t2); end
% Define a data structure to describe the state of the physical system % for a given position and energy. This is done by describing the % Riccati parametrized Green's function 'g', it's tilde conjugate 'gt', % and their first derivatives 'dg' and 'dgt' for that configuration. % % This class is mainly intended for use...
function f_export_PT(fname) % - export otolith profile data to a comma-separated-values (CSV) text file % % USAGE: f_export_PT('fname') % % fname = cell array of file(s) to process % % SEE ALSO: f_cps2ppm_PT, f_plot_PT, f_export_cps % -----Author:----- % by David L. Jones, Oct-2011 % % This file is part of the FATHOM ...
% Example 9.2. % Computes the weighted residual for the model described by p % from Parameter Estimation and Inverse Problems, 3rd edition, 2018 % by R. Aster, B. Borchers, C. Thurber % % f=fun(p) % function f=fun(p) % global variables, the x and y points and their sigmas global x; global y; global sigma; f=zeros(len...
function [E,F_gt_val] = flow_error_map (F_gt,F_est) F_gt_du = shiftdim(F_gt(:,:,1)); F_gt_dv = shiftdim(F_gt(:,:,2)); F_gt_val = shiftdim(F_gt(:,:,3)); F_est_du = shiftdim(F_est(:,:,1)); F_est_dv = shiftdim(F_est(:,:,2)); E_du = F_gt_du-F_est_du; E_dv = F_gt_dv-F_est_dv; E = sqrt(E_du.*E_du+E_dv.*E_dv); E(F_gt_...
% fevaled in aamod_pilab_importrsapredictors % % [rdms,ss] = facedist_rsapredictors(subname) function [rdms,ss] = facedist_rsapredictors(subname,varargin) oldpath = path; % function to add psychtoolbox functions to the path - you may not need this, % but on the CBU cluster Matlab figure rendering breaks when this is ...
p=10; M = 1; %number of simulations N1 = 10; %dimension of g_s N2 = 15; Sum_X_power_p = zeros(N1+N2,N1+N2); Mean_X_power_p = zeros(N1+N2,N1+N2); for i=1:M g1 = randn(N1,1); g2 = randn(N2,1); X = [zeros(N1,N1) g1*g2'; g2*g1' zeros(N2,N2)]; Sum_X_power_p = Sum_X_power_p + (X)^p; end Mean_X_power_p = Sum_X...
function OUT = cross(A, B) % DESCRIPTION: % Returns the cross product of A and B along the first dimension of % length three. % % PARAMETERS: % A - first input matrix % B - second input matrix % % AUTHOR: % Daniel Jennings % dsj@ll.mit.edu % % DATE CREATED: % June 1, 2005 global pMATLA...
function [coRefI, coHolBg, coRefBg] = AtomHologramOptimization(holI, refI, holBg, refBg, refZ, atomZ, params, FilePath) gpuDevice(1); wavelength = params.wavelength; pixelsize = params.pixelsize; NAs = params.NAs; resize = 6; k = 2 * pi / wavelength; %Wave Vector resPath = [FilePath 'Result\']; if(exist([resPath '...
function [Y,S,res] = f_rosner(X,ave,s,p,crit) % - Rosner's test for spike elimination (many outlier removal) % % USAGE: [Y,S,res] = f_rosner(X,ave,s,p,crit); % % X = input data matrix (rows = observations, cols = variables) % ave = replace spikes with smoothed data (= 1) or NaN (= 0) (default = 1) % s ...
function varargout = getsamples(filename, varargin) % Read samples from acq file % filename - acq file % varargin - channel names % Returns column vectors of all channel data samples of requested channels. % Example: % [SourceR, EMG_L, EMG_R] = getsamples('myfile.acq', 'SourceR', 'EMG_L', 'EMG_R'); % Note:...
function [est_all ] = estimatorVI(rhist,qhist,tau_body,dt) %{ An estimator function that uses the measurements and applied torques to estimate the parameters using the discrete dual quaternion rigid body equations. %} R = []; z = []; est_all = []; err_est_all = []; [phi_k,psi_k] = PhikPsiK_calc(rh...
function y = graph_sine_khan(theta_max,n) % function to plot sine function from 0 to max_angles % Syeduzzaman Khan % input: theta= angle in degrees % n=number of temrs % output: 1. y=sine value (dimensionless) from Taylor series %2. y=sin value from Matlab's sine function % sample: graph_sine_khan(1...
% ZCA operation function output = zca(features) output = zeros(size(features)); if size(features,3)>1 for i = 1:size(features,3) temp = features(:,:,i); if mean2(temp)~=0 matrix_co = (temp-mean2(temp))*(temp-mean2(temp))'; [U1,S1,V1] = svd(matrix_c...
%% Heatmaps and frames directories (test videos) heatmaps_root = '/home/mahdyar/Documents/MATLAB/gan_anomaly/data/UCSD/ped2/fused_heatmaps/'; videos_root = '/home/mahdyar/Documents/MATLAB/gan_anomaly/data/UCSD_original/ped2/test/'; save_root = '/home/mahdyar/Documents/MATLAB/gan_anomaly/data/UCSD/visualizations/ped2/f...
function [varargout] = ttcvode(events, odefun, tspan, y0, options, LMM, NLS, last) %TTCVODE Solve ODE with time-based events using CVODE. % Solve a system of differential equations with time-based events. % Time-based events (time-triggered) are events that happen at pre-defined % time instants, for example periodic ev...
function histMontage( HS, mm, nn ) % Used to display multiple 1D histograms. % % USAGE % histMontage( HS, mm, nn ) % % INPUTS % HS - HS(i,j) is the jth bin in the ith histogram % mm - [] #images/row (if [] then calculated based on nn) % nn - [] #images/col (if [] then calculated based on mm) % % OUTPUTS % % EXAM...
function [a,ZDVMX,ZDVAG,CTDZZ] = POLYFITTING(x,y,n,INTNB) %[a,ZDVMX,ZDVAG,CTDZZ] = POLYFITTING(x,y,n,INTNB) performs polynomial %interpolation % x = sample points % y = measurements % n = polynomial order for interpolation % INTNB = kind of interpolation (=1 monomial, =2 Newton, =3 Lagrange-> relevant for BEM) % OUTPUT...
% Zhorack [xhollyo] % 22.3.2020 classdef SegmentaionByColor < handle properties m_tresholds = HsvTresholds; end methods (Access = public) function obj = SegmentaionByColor(tresholds) obj.m_tresholds = tresholds; end function mask = binMask(~,...
%% Loop through connected neurons gammas = []; for i = 1:length(connections) if nonzero(i) == 24 spiketrains = spiketrain_generate([connections(i,1), connections(i,2)], binedges, Spike_timeline, dt); beta = betas(i,:); test = tests(i,:); gamma = gammafit(spiketrains, beta, test); ...
function [result, H] = gaussian_low_pass_filter(img, sigma) % function to implement gaussian low-pass filter [h, w] = size(img); % pad_img=cat(2,zeros([dim,dim/2]),img, zeros([dim,dim/2])); % pad_img=cat(1,zeros([dim/2,2*dim]),pad_img,zeros([dim/2,2*dim])); pad_img = img; imgfft = fft2(pad_img); ...
% ps1 %% 1-a img = imread(fullfile('input', 'ps1-input0.png')); % already grayscale %% TODO: Compute edge image img_edges imwrite(img_edges, fullfile('output', 'ps1-1-a-1.png')); % save as output/ps1-1-a-1.png %% 2-a [H, theta, rho] = hough_lines_acc(img_edges); % defined in hough_lines_acc.m %% TODO: Plot/show ac...
%******************************************************************************* %* Program: struc_pos.m %* Description: Calculates the postions of the structure (wave/shock). %* Author: Andrew Kercher %* References: %* [1] Toro, E. F., "Riemann Solvers and Numerical Methods for %* Fluid Dynamics...
% Remove NN diretory paths if they still exist CleanUp2D; close all clear all clc %Model model = 'Euler'; gas_const = 1.0; gas_gamma = 1.4; test_name = '1DSod'; InitialCond = @IC; BC_cond = {101,'D'; 102,'D'; 103,'P'; 104,'P'}; FinalTime = 1; CFL = 0.5; %fixed_dt ...
function [pass,maxerr] = test(opt) % Check that multi-pathway kernels with higher harmonics are properly generated r = linspace(2,6,50); % Example timings for five-pulse DEER (all in us) t1 = linspace(0,10,300); t2 = 0.3; tau1 = 4.24; tau2 = 4.92; t = (tau1 + tau2) - (t1 + t2); % Pathway amplitudes and...
function [sim1,regimes,retcode]=simul_occbin(y0,T,ss,state_vars_location,... options,shocks) % H1 line % % Syntax % ------- % :: % % Inputs % ------- % % Outputs % -------- % % More About % ------------ % % Examples % --------- % % See also: use_pinv=true; % find the first-order approximation of the system %----...
function [E_x,x] = get_P_x_micro(num,D0_act,t0,inds) load('TD_init_parameters.mat','S_dparameters'); x = S_dparameters(num).x; nCF = S_dparameters(num).nCF; dirname = ['micro/' num2str(num)]; filename = ['p_' num2str(D0_act) '.mat']; load([dirname '/' filename]); t = T; Y = Y_p; ...
clc, clear all fig('unit','inches','width',7,'height',1,'fontsize',8) hold on plot(0,0,'k-','linewidth',2) plot(0,0,'y-','linewidth',2) h=legend(gca,'Cell SD','Cell support radius', ... 'Orientation','horizontal'); set(allchild(gca),'visible','off'); set(gca,'visible','off') set(h,'OuterPosition',[0 0 1 1],'color...
clear all; close all; [x,fs]=audioread('doremi.wav'); x=x(:,1); [x1,fs]=audioread('do.wav'); x1=x1(:,1); [x2,fs]=audioread('re.wav'); x2=x2(:,1); [x3,fs]=audioread('mi.wav'); x3=x3(:,1); [x4,fs]=audioread('fa.wav'); x4=x4(:,1); [x5,fs]=audioread('so.wav'); x5=x5(:,1); [x6,fs]=audioread('lya.wav'); x6=x6(:,1); [x7,fs]...