text
stringlengths
8
6.12M
% This function essentially calculates the sum of wi * f(xi), which is used % in all the Newton-Cotes methods in Question 3. Please ensure that the x % and w arrays passed in to represent {wi, xi} pairings are of the same % dimensions, with {wi(i), x(i)} forming a pair. function integral = weightPairSum(f,x,w) % ...
% This script demonstrates how to call the function % DREAM5_Challenge4_Evaluation(). % % Gustavo A. Stolovitzky, Ph.D. % Adj. Assoc Prof of Biomed Informatics, Columbia Univ % Mngr, Func Genomics & Sys Biology, IBM Research % P.O.Box 218 Office : (914) 945-1292 % Yorktown Heights, NY 10598 Fax : (914) 94...
function [iflags, bto1232, btc1232] = xfind_clear_wn(head, prof, icheck); % function [iflags, bto1232, btc1232] = xfind_clear_wn(head, prof, icheck); % % Do clear tests for the specified FOV/profile indices and % return test results as bit flags. Designed for use with % Hamming apodized radiances. % % Input: % hea...
clear clc x = imread('grayImage.jpg'); [m,n] = size(x); threshold = 200;%threshold value %create an array with the same size as the image y = zeros(m,n); for i=1:m for j=1:n if(x(i,j) < threshold)%if it is closer than treshold value y(i,j) = 0; else y(i,j) = 255; e...
clear;clc;clear;clc; %% get path to folder dot = '/Users/brandomiranda/home_simulation_research/overparametrized_experiments/'; path = fullfile(dot,'pytorch_experiments/test_runs_flatness2'); %NL path_all_expts_NL = fullfile(path,'flatness_May_label_corrupt_prob_0.0_exptlabel_RadiusFlatnessNL_samples20_RLarge50') path_...
function [ output_args ] = show4( n, X, Ori, Uc, Ur, T, E ) %SHOW4 n, X, Ori, Uc, Ur, T, E K = Ori(:,:,n); a = min(K(:)); b = max(K(:)); subplot(1,4,1), imshow(X(:,:,n), [a,b]) subplot(1,4,2), imshow(Ori(:,:,n), [a,b]) subplot(1,4,3), imshow(Uc*T(:,:,n)*Ur', [a,b]) subplot(1,4,4), imshow(E(:,:,n), [a,b]) end
%Metodo Mutipasos %Metodo implicito de Adams-Moulton de 2 pasos %wo=? w1=?1 %wi+1=wi+h/12*[5*f(ti+1,wi+1)+8*f(ti,wi)-5*f(ti-1,wi-1)]; i=0,1,...,N-1 clear all clc syms t y ED=input('Introduzca la E.D.= '); f=input('Introduzca la funcion de trabajo= '); cond=input('Introduzca la condicion inicial "y(a)=k"=: '); w0=inpu...
function car_predict() %CAR_PREDICT Get the prediction of cars on images % % Mar. 2015, Zexi Mao startup; load('VOC2010/car_final'); listing = dir('surveillance_images'); params = 0.5:-0.1:-1.3; for j = 1 : length(params) for i = 1 : length(listing) if (listing(i).name(1) ~= '.') imname = full...
function runMHyProBenchmarks(benchmarkNr, diff, strategy) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % With this file all benchmarks for mhypro can be run. % Input: % benchmarkNr: number of the benchmark % 1 - bouncing ball % 2 - cruise controll % 3 - filtered oscil...
function main(const) % ---------------------------------------------------------------------- % main(const) % ---------------------------------------------------------------------- % Goal of the function : % Launch all function of the experiment % ---------------------------------------------------------------------- %...
function [c] = outputDicom_write(c) % % NAME % % function [c] = name(c) % % ARGUMENTS % INPUT % c class img2dcm class % % OPTIONAL % % DESCRIPTION % % Saves the contents of c.mcell_img to a set of dicom files % in c.mstr_outputDicomDir % % PRECONDITIONS % % o c.mcell_img must be populated % o c.mDicomInfo must be def...
function phclcpc(varargin); % phclcpc( [...] ); % Cell P Control h = timeplot({'ICelPSt'}, ... 'Cell P Control', ... 'P Control', ... {'ICelPSt'}, ... varargin{:} );
function pQ = getModelPriorsNH_emp(m) for i = 1:m.m switch m.dipfit.model(i).source case 'MMC' pQ(i).G = [12 12 12 12 12 6 12 12 6 3 6 12 12 6]; % intrinsic connections (mV.s) pQ(i).T = [25 20 15 15]; % synaptic time constants [mp sp ii dp] (ms) ...
%---------------------------------------------------------------- % levi silvers dec 2016 %---------------------------------------------------------------- % compute a landmask to apply to the output fields landm='/Users/silvers/data/c96L32_landmask_atmos.static.nc' land=ncread(landm,'land_mask'); o...
function EEG = preproc(EEG) tr = EEG.APPEAR.TR; slpertr = EEG.APPEAR.slice_per_TR; mrkA = EEG.APPEAR.mrkA; dwnsmr = EEG.APPEAR.Fs; bpfrq = EEG.APPEAR.filterRange; slfrq = slpertr / tr; temp = [60, 26, slfrq*(1:1:100)]; temp = temp(temp<=max(2*bpfrq(2),temp(1)))...
%This function is to find maximum blob with admissable Aspect Ratio in binary image %The input must be binary image function blob = BestBlob(imgSign) %check whether the image is binary if class(imgSign) ~= 'logical' disp('Please input binary image'); end %find blob properties stats = regionprops(imgSi...
function [y,sig2,p]=gm_init(x,K,method) %function [y,sig2,p]=gm_init(x,K,method) % % Initialise a gaussian mixture model % % input: % % x: training data % K: number of clusters % method: 1,2,3 seed points, random from covariance, seed points narrow variance % % output: % % y : K*D matrix with initial clus...
function [contours] = trace_notes (imgf, fprefix, line_ys, outf, lw, tmpf) %thn=4; %imgrgb=imread(imgf); img=uint8(imread(imgf)); imgrgb=zeros(size(img,1),size(img,2),3); imgrgb(:,:,1) = img; imgrgb(:,:,2) = img; imgrgb(:,:,3) = img; %uint8(im2bw(rgb2gray(imgrgb))); %img=imread('bw-smoothed.bmp'); %li...
%% Initialization load('cmodel.mat') frameSize = 0.1; nSegmentSize = 10; predictions = cell(1,2); %% Compute song genre genre = 'kiki';datasubset = 'test'; folder = strcat('kikibouba_',datasubset,'\',genre,'\'); wavs = dir(strcat(folder,'*.m4a')); for i = 1:numel(wavs) predictions{1}{i} = kikiboubasongclassifier...
De while-lus in de onderstaande code wordt geen enkele keer herhaald. ======= Code ======= teller = 0 while -1 if teller < 100 teller = teller + 1; else break; end num2str(teller) end ======= Code =======
function residualsPACE(fileActual,filePACE,units,conv,save) %%Compute Cost Depending On 2 text files close all %%%%%%%%%%%%%%%%%FLAGS%%%%%%%%%%%%%%%%%%% RESTYPE = 4; %1 = everything,2 = forces/moments,states %3 = categories,4 = full split ERROR = 0; %0 for absolute %PACE = 1; Actual = dlmread(fileA...
function grOnCreate() global figlist if (figlist.currentFreeze>0) delete(gcbo); else set(0,'CurrentFigure',gcbo); grSetTitle(get(gcbo,'Name')); set(gcbo,'DeleteFcn','grOnDelete'); set(gcbo,'Doublebuffer','on'); end;
function dx = odefun_dyn(t, x, params) % Constant parameters Lk = params.Lk; La = params.La; m1 = params.m1; m2 = params.m2; g = params.g; I = params.I; controller = params.controller; th_l_h_ddot0 = params.th_l_h_ddot0; th_l_k_ddot0 = params.th_l_k_ddot0; th_l_a_ddot0 = params.th_l_a_ddot0; th_r_h_ddot0 = params.th_r...
%********************************************************************* % Theory of the Hilbert Spectrum: Code Examples for Reproducible Research %********************************************************************* % % Description: This Demo file shows illustrates Hilbert Spectral Analysis % on a cello si...
function varargout = adjustcamera(varargin) % ADJUSTCAMERA MATLAB code for adjustcamera.fig % ADJUSTCAMERA, by itself, creates a new ADJUSTCAMERA or raises the existing % singleton*. % % H = ADJUSTCAMERA returns the handle to a new ADJUSTCAMERA or the handle to % the existing singleton*. % % AD...
%% Specifying Alternative Cost Function with Off-Diagonal Weight Matrices % This example shows how to use non-diagonal weight matrices in a model % predictive controller. % Copyright 1990-2014 The MathWorks, Inc. %% Define Plant Model and MPC Controller % The linear plant model has two inputs and two outputs. plant...
function gamma_medio = calc_gamma_medio(gamma) gamma_nz = gamma.*(gamma>=0.4); gamma_medio = sum(gamma_nz)/sum(gamma>=0.4); % gamma_medio = sum(gamma.^1.2)/length(gamma); end
%m1 = csvread('../experiment_data/teacher_forcing/teacher_forcing_0.0.txt'); m2 = csvread('../experiment_data/teacher_forcing/teacher_forcing_0.1.txt'); m3 = csvread('../experiment_data/teacher_forcing/teacher_forcing_0.5.txt'); m4 = csvread('../experiment_data/teacher_forcing/teacher_forcing_0.9.txt'); %m5 = csvread('...
clear all load('SF1'); addpath('..\src\Libraries\LAPTracker'); addpath('..\src\Libraries\Utils'); addpath('..\src\Libraries\DensityEstimation'); addpath('..\src\Libraries\DensityEstimation'); addpath('..\src\Libraries\TrajectoryAnalysis'); addpath('..\src'); colormap=[0 0 1;1 0 0;0 0 0]; xi = (1:length(uwt)) / 2 / 60; ...
% ======================================================== % % -------------- PV-Battery Tool (PVBT) -------------- % % Version: 1.2 (2/2021) --------------------------------- % % ======================================================== % % This code was developed by Ahmed A.Raouf Mohamed: ------ % % ------ AARa...
function eot = equationOfTime(time) % EQUATION_OF_TIME Calculates the equation of time for the specified time vector % Calculate julian date corresponding to time vector jd = juliandate(time); d = jd-2451543.5; % Keplerian Elements of the Sun % Eccentricity eccentrici...
% One Step of Backtracking Line Search % xUpdated = step(x, a, b) % % Arguments: % 'x' should be 2 * 1 vector. % 'a' should be the parameter of the stopping condition of step backtracking, 0 < a < 0.5. % 'b' should be the parameter of the common radio of step backtracking, 0 < b < 1. % % Returns: % 'xU...
close all clear all clc %% Define system and set ES parameters % alpha = ampiezza oscillazioni % omega = pulsazione oscillazioni % gamma = guadagno integratore % h = polo HPF %%% Nota: testare lo schema anche con funzionali di costo diversi (IAE, ITAE, ITSE) sel = 4; s = tf('s'); switch sel case 1 G = 1...
function [final_est, final_weight, est_all] = SMC(obs, dimension, num_particle, ESS, ... lambda_map, rank_left_child, rank_right_child, dividible, par, y, length_filter) % global settings total_level = log2(numel(obs)); num_node = 2 * dimension - 1; N = prod(num_node); sigma_hat = par(total_level + 1, 3); dwtmode...
%% Opening the files in EEGLAB %Preprocessing- before operating this script, the annotation files must be %formatted so that there is a column for the event and a column for the %latency in the eeg file. The .edf files must be processed in polyman .edf %viewer so that you only have EEG1, EMG, and EEG2 (no bio or ...
clear all close all % Load function filename = 'input.s2p'; s_bisec = sparams_bisect(filename); s_orig = sparameters(filename); % Extract data s21_bisec = s_bisec.Parameters(2,1,:); s21_bisec = s21_bisec(:); freq = s_bisec.Frequencies; s21_orig = s_orig.Parameters(2,1,:); s21_orig = s21_orig(:); % Plot figure() % M...
% Assignment 6, Problem 2 x = [0.5;1;2;4;6;8;10]; z = log(x); tau = [2.53;3.11;3.65;4.2;4.79;5.07;5.33]; y = log(tau); X = [ones(7,1),z]; phi = inv(X'*X)*X'*y; n = phi(2); m = exp(phi(1)); m = 3.0491 ; n = 0.2450;
function t = Rand_Activation(a,l) %t thershold = 0.7 t = zeros(1,l); for i=1:l if a(i)>=.7 t(i)=1; end end end
% fileinfo % evaluates # hits and misses %subject='d:\bci2000data\ecog\ck\ck033\ckS033R09.mat'; %subject='d:\bci2000data\ecog\dw\dw002\dwS002R04.mat'; subject='d:\bci2000data\ecog\es\es003\esS003R08.mat'; fprintf(1, 'Loading data file ...\n'); loadcmd=sprintf('load %s', subject); eval(loadcmd); trials=unique(trialnr...
clear close all j = sqrt(-1); lamda = 100*1e-3; %0.3m 传输波长 freq = 1e9; w = 2*pi*freq; R_waveguide = 300e-3; r = 0:0.1:(R_waveguide*1e3); % 0 <= r <= 100mm 圆形波导的半径 r = r*1e-3; theta = 0:0.01:2*pi; % 柱坐标系下theta坐标范围 Z = 0; [THETA, R] = meshgrid(theta, r); % 生成网格 d = 0; [E_theta, E_r, Hz, H_theta, H_r] = TE_mn(2,1,T...
%%quxianyaoshu(lo,R,a) %%quxianyaoshu(60,500,dms2degrees([28 36 20])) %%%%%%%%%%%加入桥墩偏距,直接搞桥墩偏距 disp('请输入半径(R),曲线长(lo),起点坐标QD,终点坐标ED,交点坐标JD') disp('格式如下:hhqxgx(R,lo,QD,ED,JD,lc)') disp('比如:QD=[3273704.468,493811.52];ED=[3272419.04,495669.047];JD=[3273483.392,494887.186];R=607.2;lo=60;lc=80;') disp('则输入以下命令行') disp('h...
vec=randi(100,5,1) for i = 1:length(vec) min_out=i; for y = 1:length(vec)+1 if min_out >
% testing script for the SpatialSTAPLE algorithm % load the example data load example-data.mat obs truth % fusion settings epsilon = 1e-5; init_flag = 0; prior_flag = 0; interp_type_1 = 0; interp_type_2 = 1; cf1 = 0; cf2 = 1; num_up = [20 20 20]; win_dims = [5 5 5]; bias = prod(win_dims) / length(unique(truth)); % c...
%% Does the sampling, this code needs to be cleaned up Sigma=inv(thcts); % covariance matrix edgePotMarg=cell(q,q); % includes both node and edge potentials. maskMarg=sparse(q,q); for r=1:q for j=1:q potrj=zeros(L(r),L(j)); if maskDis(r,j)==1 potrj=potrj+thdis{r,j}; en...
function [imc,imp] = cell_protrusions3d(im,s,ds) %% vector_field_var2d - 2d vector field variance % % REFERENCE: % T.M.E. Scales, B. Obara, M.R. Holt, N.A. Hotchin, F. Berditchevski, % M. Parsons, alpha3beta1 integrins regulate CD151 complex assembly % and membrane dynamics of carcinoma ...
if (~exist('s', 'var')) s = serial('/dev/ttyUSB1'); s.BaudRate = 57600; fopen(s) end t = 0:0.01:10; traj_x = ceil(sin(t) * 2000); traj_y = ceil(sin(t + (2/3*pi)) * 2000); traj_z = ceil(sin(t + (4/3*pi)) * 2000); kroki_x = traj_x(2:end) - traj_x(1:end-1); kroki_y = traj_y(2:end) - traj_y(1:end-1); kroki_z...
%% Stelling 6 % % Je kunt in Matlab elke willekeurige vector optellen bij % een andere willekeurige vector. % Antwoord = 0;
clear all; close all; lena_int = imread('lena_gray.bmp'); lena = im2double(lena_int); %In command window type lena_int and lena and see what the difference is %Compute the two-dimensional DCT of 8-by-8 blocks in the image. %dctmtx Discrete cosine transform matrix. %D = dctmtx(N) returns the N-by-N DCT transform matrix...
%% Skript to plot the model of stvm and tkl-svm % Load orgs vs people dataset load ../data/Reuters/org_vs_people_1; % Draw a 2-fold sample Xs =full(Xs); Xt = full(Xt); Xs=bsxfun(@rdivide, bsxfun(@minus,Xs,mean(Xs)), std(Xs)); Xt=bsxfun(@rdivide, bsxfun(@minus,Xt,mean(Xt)), std(Xt)); Xs = Xs';Xt = Xt'; soureIndx = cros...
function Voc = calculateVoc( module ) %CALCULATEVOC Summary of this function goes here % Detailed explanation goes here %% 0) Constants =========================================================== % Reference temperature (25 deg C) REFERENCE_TEMPERATURE = 25; REFERENCE_IRRADIANCE = 1; % Elementary charge ...
clear , clc % Note: use nowhere else a clear command format shortG % This is an example of a file to be used during the test of Matlab. %{ COMPULSORY: Name: Student nr.: Remarks: - at the bottom of this file there are rules which you must comply, - if a part of an exercise is worked out, it m...
function [ data ] = get_data( directory ) PROCESSED_PREFIX = sprintf('%s/stats-rt-',directory); PROCESSED_SUFFIX = '.dat'; data = {}; % stores the data for each router % for each item in data, we have 3 rows: the number of import updates % received, the number of import withdraws received and the number of % import up...
function [ x ] = scalePad( x, scaleVec ) % This function pads a points array (2xN) with a third row that contains % the scales of the points. By default, the padded values are 1's % % Input elements % -->x: Input data points array % -->scaleVec: Contains the desired scales and if given, it is padded itself % to the dat...
figure(7) boxplot(Serves); xlabel('All Players') ylabel('Serve Points (points)') title('Serve points made by women volleyball player in FIVB 2020 (Preliminary Round)')
%============================================================== % FileName: garapheneMesh.m % Description: Generate finite element mesh for rigid rectangular garaphene % sheet % Author: Changhao Li % Date created: 17 Jul 2017 % Version: 1.00 % Date last revised: 17 Jul 2017 % Revised by: Changhao Li %========...
im1 = rgb2gray(imread('fark1.bmp')); im2 = rgb2gray(imread('fark2.bmp')); fark = imabsdiff(im1,im2); bw = bwareaopen(fark,55); bw = imfill(bw,'holes'); SE = strel('square',1); bw2 = imerode(bw,SE); fark = regionprops(bw2, 'all'); c = [fark.Centroid]; imshow('fark2.bmp'); title(['Toplam fark : ',num2str(length(fark))]);...
load('data_healthy.mat') % park id = sqrt(2/3) * ia - sqrt(1/6) * ib - sqrt(1/6) * ic; iq = sqrt(1/2) * ib - sqrt(1/2) * ic; ip = sqrt(id.^2 + iq.^2); [freq, val] = mfft(time, ip); plot(freq, val) function [f, Y] = mfft(t, y) N = length(y); Ts = (t(end) - t(1))/(N - 1); df = 1/(N*Ts); f = ((0:(N-1))*df).'; Y =abs...
% clear % close all %% Central Differentiation name = num2str(i); load(['Case',name,'.mat']) % Approximate arclens by accumulating point to point geometric distance P2arclens = zeros(Proximal_1-Proximal_2,1); inc = 0; for i = 1: Proximal_1-Proximal_2 step = sqrt(sum((OldCenterline(Proximal_2+i,:)-OldCenterline(Pro...
% % build pediatric airway atlas on cross sectional area curves % Author: Yi Hong % Email: yihong@cs.unc.edu % clear all close all % input parameters subject_info = readtext( '/playpen/Project/airwayAtlas/Pediatric_Airway_Atlas_Code/data/selected_subjects_CRL_SGS_Carina.csv' ); % data sheet for measu...
%% used to extract normalized letters from single line image %% image should be cutted up an down function [ letters ] = getNormalizedLettersFromLine( SL_Image ) global regionHeight; global regionWidth; begEndIsIndexes = getLettersBegEndIsIndexes(SL_Image); [y x] = size(begEndIsIndexes); am...
percentiles = [.05 .1 .15 .2 .25 .3 .35 .4 .45 0.5 0.55 0.6 0.65 0.7]; AVvarlist = {'htpureAV' 'htmultiA_AV' 'htmultiAV_AV' 'htmultiV_AV' 'htrepeatAV' 'htclassAV'}; % these are list of CDF variables calculated in the TimeAnalysisAveragePaper RM1varlist= {'htpureRM' 'htmultipsA_RM' 'htmultipsAV_RM' 'htmultipsV_RM' 'h...
% Checks whether points are within the specified gamut function [TF,P2] = isingamut(P,g,space) % Parse inputs switch lower(space) case 'lch' % Convert h so it is between [0,360) P(:,3) = mod(P(:,3),360); case 'lab' % Need to convert to Lch L = P(:,1); ...
% $Header: svn://.../trunk/AMIGO2R2016/Postprocessor/Post_Plot/AMIGO_plot_local_obs_mean_rank.m 770 2013-08-06 09:41:45Z attila $ % AMIGO_plot_local_obs_mean_rank: plots local mean rank per experiment % %****************************************************************************** % AMIGO2: dynamic modeling, optimiza...
function varargout = wtc_aswdr(option,varargin) %WTC_ASWDR Main program for WTC_ASWDR encoding. % % VARARGOUT = WTC_ASWDR(OPTION,VARARGIN) % % WTC_ASWDR('encode', ... ) % WTC_ASWDR('decode', ... ) % WTC_ASWDR('save', ... ) % WTC_ASWDR('load', ... ) % M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 27-Nov-20...
% Add parent folder to path addpath(fileparts(pwd)) A = linspace(0, 7,8); A = 2.^A; A = reshape(A,2,2,2) % A(:,:,1) = % % 1 4 % 2 8 % % % A(:,:,2) = % % 16 64 % 32 128 A = permute_sum(A, [3 2]) % A = % % 3 12 % 48 192
%%dyskretne clear; close all; Tp = 0.05; Tsym = 4; A = [0.537 -0.109; -0.0256 0.63]; B = [-0.00845 0.000439; -0.000248 0.000281]; C = [1 0; 0 1]; D = 0; %%ciagle, ale zle I = ones(2); omega = 2 / Tp; Ac = omega * (A - I) * ((I + A) ^ -1); Bc = sqrt(omega/2) * (I - A/ omega ) * B; Cc = sqrt(2 * omega) * C * ((I + A)...
% test for coding of position and values % algorithm % - compute the delaunay % - compute the position quantization that generates approx. the same error n = 512; M = load_image('lena', n); M = rescale(M); % quantization of values qval = 255; % quantization of position qpos = n; % sample random triangles plist = r...
function routineDataPlot_GroupSurrogateResults(R) close all [bigStore,subjects,typeLabels,featBank,surFeatBank,burstWaveFormStore,burstSurWaveFormStore] = loadABCGeneric(R,{'bigStore','subjects','typeLabels',... 'featBank','surFeatBank','burstWaveFormStore','burstSurWaveFormStore'}); typeLabels = {'ISI','Move prep....
%% membuat matriks kunci 5x5 clc clear kunci = 'STANDERCHBK' %menghilangkan duplikasi pada kunci kunci = unique(kunci,'stable') len_kunci = length(kunci) for x=1:26 alphabet(x) = x+64 end % menghilangkan j for x=1:26 if(alphabet(alphabet == 'J')) alphabet(alphabet == 'J') = [] end end char(alpha...
classdef NdgSWEVertConstantDiffSolver < NdgSWEVertDiffSolver %NDGVERTDIFFSOLVER 此处显示有关此类的摘要 % 此处显示详细说明 methods function obj = NdgSWEVertConstantDiffSolver( physClass ) obj = obj@NdgSWEVertDiffSolver( physClass ); if physClass.option.isKey('ConstantVerticalEddyVisco...
function [nodes, new_s, new_t, new_B] = get_st_neighborhood(Z, ... B, s, t, n, steps) %{ Return subgraph of B such that every node is at a finite distance to t new_B -- submatrix of B new_s -- new label of s as submatrix is relabelled new_t -- new label of t as submatrix is relabelled %} term_nodes = zeros(steps...
function y3 = jp_addsounds(y1, y2, fs, cfg) %JP_ADDSOUNDS Add two sounds (one target, one distractor) % % y1 target % y2 distractor % % cfg.offsetSecs: + values mean distractor after target, - values before % cfg.trimDistractorSecs = Inf; % If < Inf, run for this many seconds after target finishes % % From https://gi...
function t = findZeroPrev(fun,ti) t = ti-1; skip = 0; while (sign(fun(t)) == sign(fun(ti))) t = t - 1; if(t < 0 ) skip = 1; break; end end if (skip~=1) t = fzero(fun,[t,ti]); else t = 0; end end
% this script tests PL_GetWF (get waveforms) function % before using any of the PL_XXX functions % you need to call PL_InitClient ONCE % and use the value returned by PL_InitClient % in all PL_XXX calls s = PL_InitClient(0); if s == 0 return end % call PL_GetWF 10 times and plot the waveforms for i=1:1...
n = 3; r_u = linspace(0,1,100); [cp_x, cp_y] = ginput(n+1); p_x = zeros(1, length(r_u)); p_y = zeros(1, length(r_u)); for i = 1:length(r_u) [t_x, t_y] = de_casteljau(n, cp_x, cp_y, r_u(i)); p_x(i) = t_x; p_y(i) = t_y; end draw(cp_x, cp_y,p_x, p_y); %qui disegna la curva di bezier t_hat = ginput(1...
function y = distortion(x, gain) %% This is where the help file goes... % % Syntax % length(x) returns the size of the matrix x. % The first if statement replaces values equal or greater than 1 with % 2/3. % The second if statement replaces values equal or less than -1 with % -2/3. % The else clause slight...
close all clc clear methodtype.LB = 1; methodtype.IFM = 1; [imName, imPath] = uigetfile({'*.jpg;*.png;*bmp','Picture'},'Select Original Img'); if isequal(imName,0) || isequal(imPath,0) disp('User pressed cancel'); return; else disp(['User selected ', fullfile(imPath, imName)]) end [maskName...
function [ Struct ] = Label2ProfileStruct( subj_name,label_name,Profdir,fwhm) %add path to directory that contains labels of patient %Input: 1) Subject name as a string % 2) Label Name (repersenting a particular area in brain ex) Primary % Visual cortex) DO NOT include lh. amd rh. in name % 3) Pat...
function header = generateHeader(f) fid = fopen(f); s = fscanf(fid,'%s'); len = length(s); index = 1; while s(index) ~= 'n' || index > len index = index + 1; end index = index + 1; disp(index) outputCount = 1; outputs = cell(1); output = ''; ...
% Create a random face with texture/shape oglp.height = cameraParams.ImageSize(1); oglp.width = cameraParams.ImageSize(2); oglp.i_amb_light = [ 0.1; 0.1; 0.1]; oglp.i_dir_light = [ 0.1; 0.1; 0.1]; alpha = randn(sizePC , 1); beta = randn(sizePC , 1); shape = coef2object( alpha, model.shapeMU, model.shapePC, model....
function [resultsBySubj] = mrcPrepareL1(mrCurrProjDir,headmodelDir,options) %function [] = mrcPrepareL1(mrCurrProjDir,options) anatDir = getpref('mrCurrent','AnatomyFolder'); dirList = dir(mrCurrProjDir) % These lines pull out only the directories in the current directory dirList = dirList(3:end); %excludes . .. di...
function [coorsIni, coorsFin, gG] = graficas3D(datosEstructura,nvariables) %Funcion para graficar la estructura d = datosEstructura; % nvariables = datosOpt.nvariables; %global coorsIni coorsFin; %% obtener puntos coordenadas=d.coordenadas; conectividad=d.conectividad; nroElementos=size(conectividad,1); coorsI...
% genscript(basename, numbuses, numcontigs) % % Generate a directory of basic power flow data for all contingencies. % % Inputs: % basename: Base name (no extension) of PSAT spec file % numbuses: Number of buses in PSAT spec % numcontigs: Number of contingencies to consider % % Output files: % data/matr...
function [output, target] = SelectCostFrame(output, target, Cost_layer) switch Cost_layer.costFrameSelection case 'last' % only comput the cost for the last frame if strcmpi(Cost_layer.name, 'cross_entropy') || strcmpi(Cost_layer.name, 'multi_cross_entropy') if iscell(output) ...
% ILWT 1次元リフティングウェーブレット逆変換 % % ILWT は、ユーザが指定する特定のリフトされたウェーブレットに関して、 % リフティングを使って1次元ウェーブレットの再構成を行います。 % % X = ILWT(AD_In_Place,W) は、リフティングウェーブレットの分解により % 得られたapproximation係数とdetail係数 AD_In_Place を使用して、 % 再構成されたベクトル X を計算します。 % W は、リフティングされるウェーブレット名です (LIFTWAVE を参照)。 % % X = ILWT(CA,CD,W) は、リフティングウェーブレットの分解により得られた % ap...
clear all; load fish_training; % table has 36 rows (samples) and three columns (two inputs --> temprature and length) and one output (age) X1=table(:,1); % construct X1 which represents temprature for training 36 samples) X2=table(:,2); % construct X2 which represents fish length for training (36 samples) input_trainin...
%% Read data from positive science data file and filter out bad values clear all [frame, gazex, gazey] = import_PosSci('example_PosSci_file.txt'); %Set FOV resolution screenX = 640; screenY = 480; %Filter out bad values gazex(gazex < 0 | gazex > 640) = NaN; gazey(gazey < 0 | gazey > 480) = NaN; gazex(isnan(gazey)) =...
clear; clc; load('dvrk_mtm_psm.mat'); dt=0.001; mtm = MtmArmModel(); mtm_q_initial =deg2rad([0 0 0 -42.299 90 0 137.701])'; Trans_Mat=psm_x_dsr(:,:,1)*inv(mtm_x(:,:,1)); for i=1:60 T = FKine(mtm, mtm_q(:,i)); psm_x_dsr(:,:,i)=Trans_Mat*T(:,:,mtm.DOF+1); end for i=2:10 psm_xn(:,:,i-1)=(psm_...
% A Pythagorean triplet is a set of three natural numbers, a < b < c, for % which, a^(2) + b^(2) = c^(2) % % For example, 3^(2) + 4^(2) = 9 + 16 = 25 = 5^(2). % % There exists exactly one Pythagorean triplet for which a + b + c = 1000. % Find the product abc. % Ans: 31875000 % Pythag triple (a,b,c) can be written %...
% averages for laser: path_current = pwd; % displays current directory set(0,'DefaultFigureWindowStyle','docked'); dirn = uigetdir('/export/home1/lgm/bosanac/PROJEKTI/PTEFb/data/lascal/', 'Choose directory to process'); cd(dirn); % enters chosen directory ale = zeros(1,9); ble = zeros(1,9); load data1; yla = yl; ...
function [center] = TriangleCenter(p0, p1, p2) % Autor: Maciej Chlebny % Zwraca środek ciężkości trójkąta center = (p0+p1+p2)./3; end
% Save this_image in processed_data. If processed_data does not exist, % create it, then save this_image in the newly-created processed_data. % % Author: Elliot Tuck % Date: 20170810 function saveProcessedImage() if ~isappdata(0, 'processed_data') % processed_data does not exist, so create it proce...
function [observation,distribution] = getObservation(bias,sd,N) distribution = zeros(10,10,10); for s = 1:10 for d = 1:10 for a = 1:10 distribution(s,d,a)= getP(s+a-1+bias,d,sd); end end end observation = round(N*distribution);
%This program reads the Radar(Cloudnet) data. The path to the data is specified at the beginning of the %in the main program. clear Cloudnet NoCloudnetNum Cloudnet_long.number=i; try %only if Cloudnetfile exists %open file: file=strxcat(yyyy(i),Monthfile(i,:),Dayfile(i,:),'_ny-alesu...
function [ R_01_perMonth ] = r_split( control,R_01 ) %This function splits the rainrate values array in monthly arrays. % INPUT: 8760 x 1 R_01: rainrate values % % OUTPUT: {12x1} R_01_perMonth: struct with 1d-arrays containing % the rainrate per month %% R_01_perMonth = {}; start ...
function [accuracy,prediction,conf]=LogTestTeams(modelax,train, num_of_teams, k) % TESTING FOR MLR WITH DIFFERENT TEAMS THETAS %clear;clc; %run('dummyTrainTest'); %load EPL_2012_2013.csv.mat %load trained_parameters %num_of_teams = size(teams,1); num_features = 3; %k = 6; gen_data = gentestdata(train,num_of_teams); ...
function cityMap = InitGrid(p) N = p.N; nSteps = p.nSteps; cityMap=zeros(N); for i=1:N for j=1:N if mod(i,nSteps)==1 cityMap(i,j)=1; elseif mod(i,nSteps)==2 cityMap(i,j)=2; elseif mod(j,nSteps)==1 cityMap(i,j)=1; elseif mod(j,nSteps)==2 ...
function [ ver_str ] = BEHR_version( ) %VER_STR = BEHR_VERSION() Returns version string for BEHR % BEHR version numbering follows the format n-nX where n-n is the release % version (NOT the collection number) of the OMNO2 product used as the % basis and X is a letter indicating sequential releases of BEHR. If % ...
function [Y, XX, W] = plain(S, isDeviation, A0, Ea, Eu, nPer, V) % simulate.linear.plain [Not a public function] Plain linear simulation. % % Backend IRIS function. % No help provided. % -IRIS Macroeconomic Modeling Toolbox. % -Copyright (c) 2007-2017 IRIS Solutions Team. %#ok<*VUNUS> %#ok<*CTCH> % The ...
classdef Burst properties id % unique burst ID start % start burst bin# ended % end burst bin# width % duration (unit: 10ms) count % total spike count mean % mean spike rate peak % peak bin# height % n...