text
stringlengths
8
6.12M
function [px,py,ang] = find_radiais(grd,varargin) % [px,py]=find_radiais(grd,p_reta,x1,x2,y1,y2); % Raquel Toste - 2019/11/25 % Adaptado de: calcula_vazao (Anderson Soares) lon = ncread(grd,'lon_rho'); lat = ncread(grd,'lat_rho'); h = ncread(grd,'h'); m = ncread(grd,'mask_rho'); m(m==0)=nan; if nargin > 1 p...
function call=hestoncallquad(kappa,theta,sigma,rho,v0,r,T,s0,K) warning off call=s0*hestonp(kappa,theta,sigma,rho,v0,r,T,s0,K,1)-K*exp(-r*T)*hestonp(kappa,theta,sigma,rho,v0,r,T,s0,K,2); function ret=hestonp(kappa,theta,sigma,rho,v0,r,T,s0,K,type) ret=0.5+1/pi*quadl(@hestonpintegrand,0,100,[],[],kappa,theta,sigma,r...
load stretchReflexTrials numSubject = length(experiment.PF2.MVC{1}); frequencyBands = [1; 5; 6; 12]; normalize = true; for i = 1 : numSubject pulseTrials = experiment.DF.pulseTrials{i}; reflexAmplitude = []; for j = 1 : length(pulseTrials) positionMeasured = flbReadMeasuredPosition(experiment.fileN...
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR % Autores: Gonzalo Pajares y Jesús Manuel de la Cruz % Copyright RA-MA, 2007 % Ejercicio 11.2: Visión estereoscópica %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 11.5.1 Geometría del sistema %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function extreme_GHK_Fit_GO_test(saltName,polarity,varargin) ORG = Matlab2OriginPlot(); ORG.cd_TopLevel(); dirName = ['GHK_response_' saltName] ; ORG.mkdir(dirName); ORG.cd(dirName); % subDir = [saltName '_Anion']; % ORG.mkdir(subDir); ORG.Disconnect; paramsTotal = []; if(strcmp(saltName,'KCl_HfCl4'))...
function xp = spm_dirichlet_exceedance(alpha,Nsamp) % Compute exceedance probabilities for a Dirichlet distribution % FORMAT xp = spm_dirichlet_exceedance(alpha,Nsamp) % % Input: % alpha - Dirichlet parameters % Nsamp - number of samples used to compute xp [default = 1e6] % % Output: % xp - exceedance ...
addpath('/home/raleman/Documents/MATLAB/analysis-tools-master'); %Open Ephys data loader. addpath('/home/raleman/Documents/GitHub/CorticoHippocampal') addpath('/home/raleman/Documents/internship') nFF=[ % {'rat26_Base_II_2016-03-24' } % {'rat26_Base_II_2016-03-24_09-47-13' ...
function Open_2P(hfig_handle, p, r, s) global hfig global imgobj %% h_name = 'two_photon'; hfig.two_photon = figure('Position', [10, 20, 1100, 500], 'Name', 'Two-photon Traces',... 'NumberTitle', 'off', 'Menubar', 'none', 'Resize', 'off',... 'DeleteFcn', {@Close_subwindow, hfig_handle, h_name},... 'KeyPress...
%% plot_autocorrelation.m % Usage: plot_autocorrelation(ROOT_DIR) % Purpose: Plots the autocorrelations over time % % User Inputs: % ROOT_DIR - directory which contains the desired data/stats.mat % printFlag - print them (1) or dont (0) % % Function Requirements: % stats.mat function plot_auto...
function [X,info] = IRfista(A,b,varargin) %IRfista FISTA algorithm for constrained least squares problems % % options = IRfista('defaults') % [X,info] = IRfista(A,b) % [X,info] = IRfista(A,b,K) % [X,info] = IRfista(A,b,options) % [X,info] = IRfista(A,b,K,options) % % This function uses the first-order optimization met...
% calculate rate of H + HO2 --> H2 + O2 % Updated 7/13/06 AEP % Based on JPL Data Evaluation #15 % rate = kHHO2c(T,M) function j=kHHO2c(T,M) j=6.9e-12.*exp(0../T);
function [pn,PN] = Pink_Noise_Generation(N,dt) % [pn,PN] = Pink_Noise_Generation(N,dt) % Inputs: % N = number of saples % dt = time differential % Outputs: % wn = Time Domain white noise % WN = Frequency Domain white noise % Info: % By: Matthew Luu % Last Edit: 9/17/2020 % Pink Noise generation through freq...
function dataStruct = dataStructConvertBRIK(dataStruct) %DATASTRUCTCONVERTBRIK Converts BRIK images from AFNI into the SPM-compatible NIFTI format. % This function uses AFNI to convert images from BRIK format into ANALYZE format, which is % compatible with the SPM preprocessing used in later steps. Because this fun...
% Parameter selection function [bestnfactors,bestnloadings,bestperformance,pergrid] = findparameters(X,Y,nfac,nload) bestperformance =-inf; bestnfactors = []; bestnloadings =[]; pergrid =[]; for iload = 1:size(nload,2) [bestnfac, bestper, allper] = loo_hopls(X,Y,nfac,nload(:,iload)); pergrid(:,iload) = allp...
function [h,x] = compute_histogram(M, options) % compute_histogram - compute the (symmetric) histogram of a vector after threshold. % % [h,x] = compute_histogram(M,options); % % If M contains only entry in 1...p, where p=max(M), then h is of size p % h(k) = #{i \ M(i)=k} / length(M) % If M contains o...
V=[3,5,0]; static_potential=[]; for j=1:num_total_electrode if (j==1) static_potential=potential_basis(:,:,1)*V(1); else static_potential=static_potential+potential_basis(:,:,j)*V(j); end end %%%%%%%%%%%%% compare with analysis equation %%%%%%%%%%%%%%%%%%%%%% static_potential=st...
function driveData cd('/Volumes/LAB (FAT32)/Data');
function kept_pts=parseandmarkwsc(data,sc) if exist('sc')==1,sc=sc*std(data)+mean(data);end kept_pts=[]; key='n'; windowsize=5000; curr_start=1; fid2=figure; moveon=0; m_pos=[]; while moveon==0 %plot data and marked points clf,plot(curr_start:(curr_start+windowsize-1),data(curr_start:(curr_start+windowsize-1)))...
start=1; classes={{16};{22}}; APLO3.d1.default.diff_wave('classes',classes,'channels',38,'blocks_in',1:4,'trials',start:start-1+5); APLO3.d1.default.diff_wave('classes',classes,'channels',38,'blocks_in',1:4,'trials',start:start-1+10); APLO3.d1.default.diff_wave('classes',classes,'channels',38,'blocks_in',1:4,'trials',...
function [T A B] = predprey(a, b, c, d, A0, B0, n) % T vector of time % A prey population % B predator population % n number of time intervals % a natural growth rate of A % b death rate from predation % c natural mortality rate of B % d growth rate from eating prey T = 1:n; A = zeros(1,n); B = zeros(1,n); ...
function goToGoal(a,b,c) nargin arg = {0.02 100 -100}; arg(1:nargin) = varargin(1:nargin); end
function [ output_args ] = mzDeviation(all) %mzDeviation - given the cell output from annotation2text, produce a %diagnostics style plot to show how the mz values deviate when provided %with a annotations, i.e. plot the true and experimentally measured values %for inspection of e.g. systematic drift. % First we should...
function show(varargin) spl = strsplit(varargin{1}, '.'); x = irisopt.(spl{1}); x = x.(spl{2}); disp(x(1:3:end)'); end
% svm classifier %data_PF %popular_f A = data_PF; % get size of data o = observations, f = features [o f] = size(A); % to summarise data, calculate mean and sd PF_mean = mean(A); PF_std = std(A); % standardize the data B = zscore(A); % calculate pc [coeff score latent] = princomp(B); var_score = var(score); cum_v...
function out = convertBeamHardeningAtt( in,spectrum, mode ) % Compute Beam Hardening Correction in sinogram space using Joseph's method. % input: % in - sinogram or image in attenuation % spectrum - spectrum infomation % mode - 0. assuming ploychromatic image (default) % 1...
fig=figure(), er = method_ers; csterr = 1.96*method_sterrs/sqrt(3000); errorbar(costs(1:numel(costs)),er(1:numel(costs),1),csterr(1:numel(costs),1),'LineWidth',3),hold on errorbar(costs(1:numel(costs)),er(1:numel(costs),2),csterr(1:numel(costs),2),'LineWidth',3),hold on errorbar(costs(1:numel(costs)),er(1:numel(costs),...
% This is the main script to show images clc; clear; close all; load('GT-00001.mat'); imageName = Filename{40}; image = imread(imageName); imgSign = RedSign(image); blob = MaxBlob(imgSign); ratio = AspectRatio(blob); figure (1), hold on; imshow(imgSign), hold on; %Draw boundingBox rectangle('Po...
function Parameters = subfnVoxelWiseProcessBatch(InData) % This program takes the data or the pointer to the data file and prepares % the data for processing. It is here that multiple voxels are looped over. % Therfore, it is in this program that one voxel at a time is extracted to % create a temporary data array w...
function CreateCircos(Bands, Rho_Thresh) [AllData, AllNames] = MadeDataFile(); % top 1% of values plotted as fully opaque MAX_E = prctile(AllData(:,1),98); load AreaNames NEWPOWERNAME = AreaNames'; SFile=fopen('Connectivity.txt', 'wt'); SFile2=fopen('chr-highlights.txt', 'wt'); for Counter = 1:length...
function model = build_model_cell_population(env, model) % % Model information carried in V1 complex cells as a function of Hebbian % learning % % Emily Cooper, Stanford University, 2014 % % params structure: % params.popDensity -- 'uniform' or 'optimal' % params.popGain -- 'uniform' or 'optimal' % params.N, params.R ...
%{ -> reso.FluorescenceTrace -> olf.RespOpt --- resp_on : mediumblob # on response matrix [stimuli trials] resp_off : mediumblob # off response matrix [stimuli trials] stimuli : mediumblob # stimuli %} cl...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Charles Chen - SID: 810797715 % CSCI5722 - Computer Vision % Final Project - Ear Segmentation Demo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Based on work of Milad Lankarany and Alireza Ahmadyfard: % "Ear S...
function D1 = ddz(z,endvalues) %% Generate a first derivative matrix for independent variable z using % second order centered differences. z is assumed to be evenly spaced % for j=1,N. % % If endvalues = 0, the function is assumed to vanish at j=0 and j=N+1. % If endvalues ~=0, the function is not assum...
function [C, sigma] = dataset3Params(X, y, Xval, yval) %DATASET3PARAMS returns your choice of C and sigma for Part 3 of the exercise %where you select the optimal (C, sigma) learning parameters to use for SVM %with RBF kernel % [C, sigma] = DATASET3PARAMS(X, y, Xval, yval) returns your choice of C and % sigma. You...
load('A.mat'); B = A'; [row, col, val] = find(B); [n, m] = size(B); for i = 1:n num = sum(B(:,i)); if(num ~= 0 && num ~=1) B(:,i) = B(:,i)/num; end end B = B';
function initializeAudapter (genderSubject) %% Initialize Audapter addpath c:/speechres/commonmcode; cds('audapter_matlab'); audioInterfaceName = 'ASIO4ALL';%'MOTU MicroBook';% sRate = 48000; % Hardware sampling rate (before downsampling) downFact = 3; frameLen = 96; % Before downsampling noiseWavFN = 'mtbabble48k.w...
function f=Gaussian2(xp,xdata) [a b]=size(xdata); Xd=xdata(:,1:b/2); Yd=xdata(:,b/2+1:b); f=xp(1,5)*(exp(-0.5*(Xd-xp(1,1)).^2./(xp(1,3)^2)-0.5*(Yd-xp(1,2)).^2./(xp(1,4)^2)))+... xp(2,5)*(exp(-0.5*(Xd-xp(2,1)).^2./(xp(2,3)^2)-0.5*(Yd-xp(2,2)).^2./(xp(2,4)^2)))+xp(1,6);
function [root,ic] = N5(f,Jacobian,intialGuess,maxIterations,tol) ic = 0; root = intialGuess; error = 10000; while (ic <= maxIterations)&&(error > tol) ic = ic +1; display(Jacobian(root)); display(Jacobian(root)); root = root - Jacobian(root)\f(root)'; error = abs(norm(f(root))/norm(f(int...
function outHex = ByteXOR(n1Hex, n2Hex) % outHex = NibbleXOR(n1Hex, n2Hex) % inputs: two length 2 hex strings (bytes)/ upper or lower case format % output: an (upper case) length 2 hex string that is the XOR of the % inputted strings n1BinVec = int2baseb(hex2dec(n1Hex),2,8); n2BinVec = int2baseb(hex2dec(n2Hex),2,8); ...
% AnovaVoxelwise.m % % calculates variation between fabber data-sets, on a voxel-wise basis using % ANOVA. Derived from FabberAverages.m % % MT Cherukara % 2 July 2018 % % Changelog: % % 2019-02-14 (MTC). Added functionality for simulated grids. This now works, but % it doesn't actually do the thing we want it to...
function diagnostic7() g = 9.8; k = 100; l0 = 1; m = 1; x0 = -1; y0 = -1; vx0 = 0; vy0 = 0; [~,Y] = ode45(@derivatives, [0,5], [x0;y0;vx0;vy0]); comet(Y(:,1), Y(:,2)); function res = derivatives(~,S) x = S(1); y = S(2); vx = S(3); vy = S(4); ...
% Generated through Matlab % Author: Killian Keller % E-Mail: killian.keller@ief.ee.ethz.ch % Organization: ETHZ ITET IEF function [Ep, Es, Ei] = test_ExtractField(model, varargin) % Summary Here % Detailed Summary Here warning('off','all'); hbar = 1.0545718e-34; eps0 = 8...
k=1; p=1; [patch]=textread('/home/xiaogao/Downloads/screen_content/SCIQAD/distorted_after/mappings/scores_val_1.txt','%s%*[^\n]') [val]=textread('/home/xiaogao/Downloads/screen_content/SCIQAD/distorted_after/mappings/val.txt','%s'); output=textread('/home/xiaogao/下载/NR-IQA-CNN-master1/outputs/output_1.txt','%s'); ...
%The name of this file appears on (or around) line #170 in newSturgeonWalk function enviroSetUp steps = 43200; %time steps number of minutes in 30 days N = 30; % half tidal periods, gets doubled +/- start time t1 = -N*pi; t2 = N*pi; t = linspace(t1, t2, steps); tideArr = cos(t); %creates tides for 30 day interval m...
function U = uq_NatafTransform( Xin, marginals, copula ) % U = UQ_NATAFTRANSFORM(Xin, marginals, copula): % performs (Generalised) Nataf Transformation of samples (X) % from the physical to the standard normal space (U) % % References: % % Lebrun, R. and Dutfoy (2009), A., A generalization of the Nataf % ...
clc clear all close all x=[1 2 3 4]; % entry point to the function of FFT decimation in time p=nextpow2(length(x)); % checking the size of the input array x=[x zeros(1,(2^p)-length(x))]; ...
clc,clear,close all N_atoms=3200; defect_type_id = 4; critial_part_ratio = 0.4; switch defect_type_id case 1 defect_type = 'rand_as'; case 2 defect_type = 'neib_as'; case 3 defect_type = 'Bn'; case 4 defect_type = 'Nb'; otherwise error('wrong de...
% script_bicycleModel_Integrator.m % Plots the results of a outputs of a simulink model: the all-integrator % form and ODE45 implemented as MATLAB functions. % Note that both are same (which is the point). It also tests this across % 3 vehicles. % % This script was originally written on 2007_06_25 by S. Brennan...
function y=fitfun2(c,x) %曲线拟合例子模型函数 y=c(1)*exp(c(2)*x);
%% inorm_ternary.m % Usage: inorm_ternary() % Purpose: Plots the pdf of and traces the trajectory of the normalized tetrad % eigenvalues % % User Inputs: % % % Function Requirements: % tetrad_stats.mat function inorm_ternary(ts, te) load('data/tetrad_stats.mat', 'I', 'time'); % Sort out times i...
% Find the conjugate of a quaternion. function quat = quatConj(q) % Assumes the scalar component is q(4) quat = q; quat(1:3) = -quat(1:3); end
function PlotConsensusMatrix(Ordered, Labels, Indices, LineSpec) %Plots the consensus matrix 'Ordered' with cluster labels. %inputs: %Ordered - NxN consensus matrix, as obtained from ModelSelection functions. %Labels - N-length vector of sample labels, as obtained from ModelSelection functions. %Indices - N-length...
function K = U(K) [r,c] = size(K); for i=1:r for j=1:c K(i,j) = -((K(i,j)^2)*log(K(i,j)^2)); end end end
function [Ve_L_f] = CellComp_VeL_f(Xi, Yi, Zi, I_M, I_D, z_max, t_max, d_z, d_t) %%CELLCOMP_VEL_F % CELLCOMP_VEL_F returns the longitudinal component of the % extracellular voltage for a neurite in tissue comprised of parallel % fibers given a set of stimulating electrodes, modelled as point sources. % The extracellula...
function rect = findLargestSquare(img) % finds the largest inscribed square for a given binary image. % Algorithm Source: % http://www.imagingshop.com/articles/automatic-cropping-non-rectangular-images % img = input binary image % rect = [x, y, w, h] of largest square, (x,y) = top left coordinate, % w = h = width and...
function plotMotion global P; global E; global plotState; global T; if isempty(plotState) initPlotState; end figure(plotState.SNfignum); hold on; % plot pursuer & evader if ishandle(plotState.P) delete(plotState.P); end if ishandle(plotState.E) delete(plotState.E); end plotState.P = plot(P.pos(1,end),P.pos(2,end),'...
function [zt,p] = MarkovAR(size,nz,rho,sigma) % Purpose: Markov function discribes the productivity shock % % Input: size := size of the grid for the productivity shock % nz := number of grid points for the productivity shock % rho := autoregressive parameter % sig...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Numerische Mathematik fuer Physik und Ingenieurwissenschaften 2020 %%% %%% Programmierabgaben (Praktischer Teil des Uebungungsblattes) %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ...
close all; clear; clc; img = imread('fig1.tif'); %img = rgb2gray(img); img = double(img); [H, W] = size(img); %% hist = zeros(256,1); for i = 1:H for j = 1:W hist(img(i,j)+1) = hist(img(i,j)+1)+1; end end cdf = zeros(256 , 1); for i = 1:256 cdf(i) = sum(hist(1:i)); end cdf = cdf/cdf(end); %ro...
%% Spawn random models in gazebo gazebo = ExampleHelperGazeboCommunicator(); for i = 1:10 ball = ExampleHelperGazeboModel('Ball'); spherelink = addLink(ball,'sphere',1,'color',[0 0 1 1]); spawnModel(gazebo,ball,[randi([-100, 100]),randi([-50, 50]),1]); end for i = 1:10 ball = ExampleHelperGazeboModel...
function M = nmodeM_1(I1,L1,d1,g,m1,omega1,theta1) %NMODEM_1 % M = NMODEM_1(I1,L1,D1,G,M1,OMEGA1,THETA1) % This function was generated by the Symbolic Math Toolbox version 8.1. % 11-Dec-2018 19:16:11 M = [I1+d1.*m1.*conj(d1)];
function [i,j,new_lat,new_lon]= fixpt(w,pt,varargin) % compute the nearest point in the fire mesh to the given coordinates % w - w = read_wrfout_tign(f) , struct with fxlong,fxlat or red = % subset_domain(w) % pt - point to be fixed to fire mesh pt = [lat,lon] % ...
namelist=dir('*.bmp'); for i=1:length(namelist) [img map]=imread(namelist(i).name); img=ind2gray(img,map); graphs{i}.name=namelist(i).name; graphs{i}.img=img; title(namelist(i).name); subplot(2,2,1) imshow(img); subplot(2,2,2) img=histeq(img); imshow(img); subplot...
%% Stelling 9 % % Met een semi-colon (;) maak je een nieuwe rij aan % binnen een matrix. % Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
function [T,Flag_Loop,M,R,Loop_Stop]=Try_Links(na,nb,T,x,y,R,Loop_Stop,Counter) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Try_lins: Programm that tries to put a link in the process of union % between 2 networks A and B. % Input: % na, nb: Size of networks A and B % T: C...
%(vpa(inv(s*eye(2) - A),5)) %vpa((C*inv(s*eye(2) - A)*B + D),5) %tf(sys) %Laplace a transf Z so = 0.3356; ro = 0.0683 ; uo= 0.12; %Cambio punto en el cual esta linealizado y sistema utilizado [A,B,C,D] = linmod('resistenciaBacterias_entrada',[so,ro],uo); % Transformada Z Ts = 0.2; % t = k*Ts; %Sistema l...
function f = objectiveFunc(X, trajData, objType) nState = 12; nControl = 6; nOptim = nState + nControl; if strcmp(trajData.shape, 'loiter') if strcmp(trajData.type, 'not-same') N = (length(X)-3)/nOptim; VR = X(nOptim*N+2); trajData.VR = VR; else N = (length(X)...
function subjectParams = getSubjectParams(dataDir, subjectParams) % function subjectParams = getSubjectParams(dataDir) % get subject name & comments % set file name and path for saving expt data if ~exist('subjectParams','var') || ~isfield(subjectParams,'name') subjectParams.name = 'demo'; end subjectParams.c...
function bvhResultsDynamic(dataSet, number, dataType, bvhStruct, velocityIndices) % BVHRESULTSDYNAMIC Load a results file and visualise them. [model, bvhStruct, frameLength] = bvhLoadResult(dataSet, number); if size(model.X, 2) ~=2 error('Visualisation only works for 2-D latent spaces.') end mocapVisualise(model...
function [T,R,states]=GaussianSamplingMetaMDP(start_state,cost) sigma0=start_state.sigma; resolution=sigma0/50; delta_mu_values=-2*sigma0:resolution:2*sigma0; sigma_values=sigma0:-resolution:0.1; [MUs,SIGMAs]=meshgrid(delta_mu_values,sigma_values); nr_states=numel(MUs)+1; %each combination of mu and sigma is a state ...
function iout = IntersectIntervals(i1,i2) maxl = max(i1(1),i2(1)); minr = min(i1(2),i2(2)); if (maxl > minr) iout = []; else iout = [maxl minr]; end
clear; clc; close all % Figure 4 (left panel) in main text: This script plots the boundary lines % that defines the FC Nash equilibrium region in (p,log(kappa))-space % % % % % mydir = pwd; % get current directory idcs = strfind(mydir,'\'); parent_dir = mydir(1:idcs(end)-1); addpath(parent_dir) % add parent dire...
function MFO_result=MFO_Find(FunctionName,TH_num,RunTimes,MAX_Iterations) % function MFO_result=MFO_Find(FunctionName,TH_num,RunTimes,MAX_Iterations) % The Moth-Flame Optimization Algorithm (MFO),proposed S. Mirjalili, % Moth-Flame Optimization Algorithm: A Novel Nature-inspired Heuristic Paradigm, Knowledge-B...
function S=csfit(x,y,dx0,dxn) % x,y分别为n个节点的横坐标所组成的向量及纵坐标组成的向量 % dx0,dn分别为S的导数在x0,xn处的值 n=length(x)-1; h=diff(x); d=diff(y)./h; a=h(2:n-1); b=2*(h(1:n-1)+h(2:n)); c=h(2:n); u=6*diff(d); b(1)=b(1)-h(1)/2; u(1)=u(1)-3*(d(1)-dx0); b(n-1)=b(n-1)-h(n)/2; u(n-1)=u(n-1)-3*(dxn-d(n)); for k=2:n-1 temp=a(k-1)/b(k-1); b(k...
clear; close all; clc; Y = zeros(12, 1); t = 0:0.01:50; global T P Q r P1 u omega_r omega % global P; % global Q; % global r; % global P1; T=50; P=zeros(12,12,T); Q=eye(12); Jxx = 0.0075; Jyy = 0.0075; Jzz = 0.0013; Q(2,2) = Jxx; Q(4,4) = Jyy; Q(6,6) = Jzz; r=rand(4); Kj=zeros(4,12); P1=rand(12); P(:,:,1)=P1; % global ...
function [] = plot_neurometric(evoked, clevs) % neurometric function for each cell evokedZeroContrast = mean(evoked(:,clevs.Zero),2); evokedLowContrast = mean(evoked(:,clevs.Low),2); evokedMidContrast = mean(evoked(:,clevs.Mid),2); evokedHighContrast = mean(evoked(:,clevs.High),2); evokedHundredContrast = mean(evoked...
% function songreader(file) clear all file='chorus'; filename=[file '.txt']; song=load(filename); % songstrct=load('binopus01_32beats.mat'); % song=songstrct.textformat; NN=2; showsong=1; error=0; N=65; ptime=0.1; % speed of playback nmark=0; jjmark=0; equalcount=0; equalindex=0; score=zeros(size(song...
A = [2 1; 0 5; 7 4]; B = [5 3; -2 -4]; C = [2 3; -5 -2; 0 3]; D = [1 2]; % (a) getInverse(A*C', "(a)"); % (b) disp("(b)"); disp(abs(B)); disp(det(abs(B))); % (c) disp("(c)"); disp(abs(A*C')); disp(det(abs(A*C'))); % (d) getInverse(C'*A, "(d)"); function getInverse(T, c) disp(c); if round(det(T)) ~= 0 ...
function h = hVlassak(C,yVector,normalVector) yVecDir = yVector; % Outer loop needs to handle generation of vectors v1=(cross(yVecDir,[0 1 0])); if v1==0 v1=(cross(yVecDir,[1 0 0])); end v1=v1/norm(v1); v2=(cross(yVecDir,v1)); v2=v2/norm(v2); nint=60; theta=[0:nint-1]/nint*(2*pi); dtheta = (2*pi)/nint; B = zeros(...
currentpath = pwd; currentpath(end-6:end) if ~strcmpi(currentpath(end-6:end), 'scripts') error('Make sure to run the OAT from the scripts directory.') end % add path to Offline Analysis Toolbox addpath('../../../../../tools/offline_analysis_toolbox/') % add path to Visual Stimulus Toolbox addpath('../../../../../...
function sppongb() close all set(0,'DefaultFigureWindowStyle','docked') %% 200 X 200 % Volume fraction = 1.50% or 0.015 % TRIAL 1,2,3 figure(1),hold on totalZPT1_200sq = 606; nslspgb200sq_mcsT1 = [000 0 ;041 5E2;058 1E3;081 2E3;111 4E3;122 7.5E3;126 1E4;127 2E4;... 131 4E4;131 6E4;129 8...
function nii_mirror (V); % Generates 3 images: right mirror, left mirror, mean of left+right % The first step is to align the image along its axis of symmetry % this step uses nii_align % The second step generates the new images % Example % nii_mirror('C:\dir\img.nii'); % You can also pass multiple images ...
function [g4,g6,g4_pos,g6_pos,g4s,g6s] = girth_4_6(H_c,Z,g4,g6,g4_pos,g6_pos, rst) % clc; % clear all; % close all; [M, N] = size(H_c); H_c_0=zeros(M,N); for ii=1:1:M for jj=1:1:N if (H_c(ii,jj)>=0) H_c_0(ii,jj)=1; else H_c_0(ii,jj)=H_c(ii,jj); end % fprintf(...
function [ validationX, validationY ] = LoadValidationSet( X, Y, n_len ) % Load the indices of validation set and convert them into matrix format % X: Vectorized input matrix [d_nlen, ~] = size(X); validation_fname = 'Validation_Inds.txt'; fid = fopen(validation_fname,'r'); validation_index = fscanf(fid,'%d '...
% Used to add imported vectors to a cell % The offset is used for the native app collection which has NaNs % at the beginning. % prefix = 'i4s_'; % prefix = 'i4_'; % prefix = 'i6_'; % prefix = 'andro_'; prefix = 'table'; offset = 10; % offset = 1; for i = 2:10 name = strcat(prefix, num2str(i)) x = eval(...
function color = createColorMapForCtSlice(ctSlice, center, window) %CREATECOLORMAPFORCTSLICE creates a color map using window/center settings for a certain CtSlice % % color = createColorMapForCtSlice(ctSlice, center, window) % % See also: CtSlice, plotCtSlice huMin = min(ctSlice.scaledImageData(:)); huMax = max(ctSli...
function plotHandles = PlotXvsY(x,y,varargin) %set up default values. all default values can be changed by varargin %by putting them in the command line like so %plotXvsY(...,'color','[0,0,1]'); if(size(x,1) > 1) graphType = 'line'; else graphType = 'scatter'; end color ...
% Uses command-line CGAL implementation of SHAPE DIAMETER FUNCTION (SDF) function [diameterVals, segmentIDs] = analyze_getSDFvalues(fileNameForMesh, options) if nargin == 2 disp('"options" is a lazy placeholder if we need to pass some parameters eventually') elseif nargin == 1 options = []; ...
function varargout = srf(This,Time,varargin) % srf Shock (impulse) response function. % % Syntax % ======= % % [Resp,Cum] = srf(V,NPer) % [Resp,Cum] = srf(V,Range) % % Input arguments % ================ % % * `V` [ SVAR ] - SVAR object for which the impulse response function will % be computed. %...
function RF = uq_EOLE_method(current_input) %%------------------------------------------------------------%% % EOLE expansion of random fields %%------------------------------------------------------------%% Options = current_input.Internal ; % !!!!!!!!!!!!!!!!!!!!!!!!!! % !!!!!!!!!!!!!!!!!!!!!!!...
%%% This script will generate a 2-d biped model % the model has 5 segments, calf, thigh, and torso %%% %% This is a male model, height 180 cm, body weight 72 kg % percentage is from de Leva (1996), table 4 clear; addpath ../ numJ = 6; totH=1.8; %total height % still not add up to 100%, but these are ju...
len_name = length(cost_function_names); len_ran = length(param.cost_functions_ioc); len_svd = length([output_inverse{ind_windowCount}(1).svd_s]); len_rmse = length(currRMSE_set(1).arrayName); len_lambda = size(lambda_array, 1); len_Jbreakdown = length(direct_check_flags{1}.J_breakdown.report); len_residual = length(out...
function [spikeHistoryDesignMatrix] = buildSpikeHistoryDesignMatrix(numOfBaseVectors,... baseVectors,spikeTrain) lengthOfSpikesTrain = length(spikeTrain); % Define the design matrix spikeHistoryDesignMatrix = zeros(numOfBaseVectors, lengthOfSpikesTrain); % calculate the base vectors [len...
%%% Load Data %%% %%%%%%%%%%%%%%%% All Data %%%%%%%%%%%%%%%% LandingData = readtable('Landing.xlsx', 'sheet', 'Data'); %%%%%%% Using Data %%%%%%% % For All T/W Phase of Aircraft - Technology Level - Seat Num - alltitude % For all W/S For All W/S WS - Phase of Aircraft - Technology Level - Seat Num - alltitude %%%%%%%%...
function [New_Nodes,idx_OuterBound,idx_holeBound,dx] = PressureBasedNodePlacement_v03(x_red,y_red,x,y,preload_red,idx_reduced,bolt_idx,corners_idx,N_Segments,scaleFactor,Setting) % PressureBasedNodePlacement_v02: Node placement (on contour lines) for BRB % quarter model % INPUTS: % Elements_idx : cell containing...
function make_class_rpt(ID, Labels, FileName, varargin) % Generates a powerpoint presentation containing preliminary analysis %---------------------------------------------------------------------- ---- % make_class_rpt(ID,Labels, FileName, 'SavePath',somePath, 'ModelPath', locOfModel ) %--------------------------...
function run() testindex = '/home/chenyang/cydata/sed_subset/annodata/test.txt'; trainindex = '/home/chenyang/cydata/sed_subset/annodata/train.txt'; imagepath = '/home/chenyang/cydata/sed_subset/annodata/images/'; outputpath = '/home/chenyang/lib/CPM/'; annopath = '/home/chenyang/lib/CPM/results_model5/' control(train...
%---------------------------------------------------------------------------- % NA_random - generates a uniform random sample to be used % instead of NA algorithm. % Assumes random number generator ran3 has been initialized % Calls ran3. % M. Sambridge, Oct. 1996 %------------------------...
function [pose] = MCL_GetPoses(Xt, Wt) % Returns estimated pose using particles and their weights % Xt: poses of particles % Wt: weights % pose: weighted pose % Written & updated by Jungseok Hong 08/21/2018 pose = Xt.*Wt; pose = sum(pose,1); % below is the old version of this code. % idx = kme...
function source = destino (compressed_video_rgb, numfiles) source=1; %Para criar o video video = VideoWriter('compressed_video.avi','Uncompressed AVI'); video.FrameRate = 12; open(video) %Processa as Imagens e Cria o Video for i = 1:numfiles image(:,:,1) = compressed_video_rgb.R(:,:,i); image(:,:...