text
stringlengths
8
6.12M
function I = clipEnds(Istart,n,sniprange) % I = clipEnds(Istart,n,sniprange) % Eliminate spike times too close to endpoints Ileft = find(Istart+sniprange(1) < 1); % Throw out spikes too close to endpoint Iright = find(Istart+sniprange(2) > n); %Ibad = union(Istart(Ileft),Istart(Iright)); %I = setdiff(Istart,Ibad); left...
% Author:Eduardo Alho %Date:10/03/2017 %Refines segmentation based on luminescence Layer of the image %the images that need to be refined have to be put on a new folder %(root_dir) eg : %'/Users/erichfonoff/Desktop/Eduardo_Alho/seg/segmentation_test/segmented/' %thresh = threshold for segmentation. from 0 to 1 : eg 0.2...
convert_file_encoding('VANDERPOL.m','myFileUTF8.m','ISO-8859-1','UTF-8')
function node2dot(fid, i, lbl, props) %NODE2DOT Print a node of a classification tree in dot format. lbl = ['label="' lbl, '"']; props = struct2str(props); parts = {lbl, props}; parts = parts(cellfun(@(a) ~isempty(a), parts)); fprintf(fid, '\t%d[%s]\n', i, strjoin(parts, ', ')); end
function [tout, pos, vel] = simulate_rocket_simple(init_pos, init_vel, moon_pos, t) % Author: Lyubomir Shoylev, lyubomir-shoylev@st-hildas.ox.ac.uk , Date: 15/12/2019 % % NB: The calculation method is the simplest Euler method. % % Simulate the rocket trajectory with the earth and moon influence. The coordinate % used ...
% function SaveFabberAverages(setnum) % Loads a set of FABBER datasets (beginning at number SEETNUM) and % caluclates volume averages (mean and median) of chosen parameters. % % Based on FabberAverages.m % % MT Cherukara % 21 March 2018 clear; % close all; % sets of variables varnames = {...
function lesionInsertion(reconImg,reconParams,SD) % FILENAME: lesionInsertion.m % % Generate TOF lesion sinogram data with Poisson noise % % Input: % reconImg: lesion image % reconParams: reconParams structure defining reconstruction setting % SD: Optional. Random number seed. % % Output: % TOF lesion sinogram ...
function varargout = fft_anal(varargin) %FFT_ANAL Fourier analysis of time series % % Retrieves physical amplitudes and phases from % a signal using FFT. % % [Struct] = fft_anal(x,t or Fs) % [amplitudes,frequencies] = fft_anal(x,t or Fs) % [amplitudes,frequencies,phases...
function [Estimation] = qDBM(Sequences, Dico, References) % Performed dictionary-based matching (DBM) estimation using % a dictionary, see: % [Boux, Bayesian inverse regression for vascular magnetic resonance % fingerprinting, 2020] % or original paper: % [Ma, Magnetic resonance fingerprinting, 2013] % % Fabien Boux -...
function [ET]=monthlyPET(radiation, tmax,tmin, wind,Lat,Z,albedo,vpd); % Calculates potential evapotranspiration using Pennman-Montieth equation % source: Allen et al. 1998 % Input: (radiation in MJ/m2/d), tmax,tmin in C, wind in m/s, month % lasttmean is temperature difference from last month % Lon, Lat, Z % Uses fun...
function Pruned_x_k=PruningAndMerging(x_k,T,U,J_max) % Function used to Prune and Merge the updated state estimates x_k % % Inputs: % x_k - Current updated state esimate at timestep k % T - Truncation threshold % U - Mergin...
clc; clear all; im1 = imread('im3.jpg'); im2 = imread('im4.jpg'); im1 = imresize(im1,0.5); im2 = imresize(im2,0.5); a = [size(im1,1), size(im1,2)]; im2 = imresize(im2,a); % [im1c, mu1] = k_mean_clustering(im1,5); % [im2c, mu2] = k_mean_clustering(im2,5,mu1); % r = im1c(:,:,1); % figure(5); % subplot(121); % imshow(uin...
function [signalPeaks, signalPeaksArray, signalSigmas, signalStruct] = computeSignalPeaks(signalMatrix, varargin) % [signalPeaks, signalPeaksArray, signalSigmas] = computeSignalPeaks(signalMatrix, varargin) % % Binarize [0,1] input analog signals based on peaks in the signal. % % Biafra Ahanonu % started: 2013....
function [N b] = computeNormals(X, Y, Z, superpixels, R) % function [N b] = computeNormals(X, Y, Z, superpixels, R) % Clip out a 2R+1 x 2R+1 window at each point and estimate the normal from points within this window. In case the window straddles more than a single superpixel, only take points in the same superpixel as...
function makeFigures(SimValuesArray,indices,network,path,networknames,legendnames) makeRaster(SimValuesArray,indices,[network '_Raster'],path,true); %% weightVals = WeightVals(SimValuesArray); [dynamicVals,kvals] = AnalyzeDynamics(SimValuesArray); currentVals = CurrentCorrelation(SimValuesArray); for ww = 1:lengt...
function [CompatibleBloc, p] = getCompatibleBloc(Grille, CompatibleLigne, i, n) CompatibleBloc = zeros(n,9); p = 1; if(mod(i,3) == 1) % Si on est sur la premièr ligne d'un bloc... CompatibleBloc = CompatibleLigne; % Pas besoin de test p = n; elseif(mod(i,3) == 2) % Si o...
function [F, M] = controller(t, state, des_state, params) %CONTROLLER Controller for the quadrotor % % state: The current state of the robot with the following fields: % state.pos = [x; y; z], state.vel = [x_dot; y_dot; z_dot], % state.rot = [phi; theta; psi], state.omega = [p; q; r] % % des_state: The desired...
classdef Area < handle properties resolution size xx yy end methods function obj = Area(size,resolution) obj.resolution = resolution; obj.size = size; [obj.xx,obj.yy] = meshgrid(0:obj.resolution:obj.size(1),0:obj.resolution:obj.size(2)); end end ...
clear; % close all; dataDir='~/Data/Audiovisual_motion'; xlist={'CSF' 'WM'}; xlist={'CSF' 'mid-GM' 'WM'}; cd(dataDir); effect_list = [dir('200109MIG_GIN.goodtina/*.sft/layerProfile/stats.sm*_rbold.aud_vis_audvis.pc.layers3D_postT3Columns.1D'); ... dir('200109MIG_GIN.goodtina/*.sft/layerProfil...
%%predictTarget.m %function predictTarget(user) %% epoch 250-500m? utildir = sprintf('%s/utilities',pwd); path(path,utildir) user = 'noon'; dataPlot = 3; filePath = sprintf('signal//%s.mat',user); load(filePath); %%data %samplingRate = 512; startEpoch = fix(0.65*512); endEpoch = 0.88*512; %subplot(2,1,1); %(xx,co...
% Implemented by Woosung 2020.Jan.14th % Complex Lenstra-Lenstra Lovasz Algorithm (CLLL) function [Q, R, T] = Complex_LLL(Hp, delta) %% Default Value if nargin < 1 disp('[Message] Complex_LLL : Default set Hp, delta'); % Default value : nR = nT = nS = 4 Hp = 1/sqrt(4)*sqrt(1/2)*(randn(4...
%Script to make scatter plots of mean baseline values compared between %different traces %Find files basedir = '/ParentDirectory/ForAll/processedTraces/AfterBlasting'; [~, list] = system(sprintf('find "%s" -type f -name "processedTraces_*.mat"', basedir)); %Currently written for Unix, but can be done on Windows/Linux ...
function [I] = light_intensity_Vector(p,I,A) % Calculates the light intensity at all grid points with Beer-Lamberts law, % using the trapezoidal method to compute the integrals. % Assumes A is a matrix with the dimensions [p.Yn, p.Xn] % returns a matrix I with dimensions [p.Yn, p.Xn] for x = 1:p.Xn % disp("x: "); ...
function caxis_squeeze(fac); if nargin==0 fac=-.1; end cax=caxis; dcax=cax(2)-cax(1); cax2=[cax(1)+fac*dcax cax(2)-fac*dcax]; caxis(cax2)
function head_y_pos = head_y_pos(in1) %HEAD_Y_POS % HEAD_Y_POS = HEAD_Y_POS(IN1) % This function was generated by the Symbolic Math Toolbox version 8.4. % 12-Jun-2020 14:22:27 q1 = in1(:,1); q2 = in1(:,2); q3 = in1(:,3); t2 = q1+q2; head_y_pos = sin(q3+t2).*7.6014e-1+sin(q1).*4.5252e-1+sin(t2).*4.38012e-1;
%Gauss Seidel Algorithm %x parameter = initial guesses %lambda = relaxation parameter function x = GaussSeidel(A, B, x, lambda, convergence) error = 100; iterations = 0; %Iterate through values until error (et) meets convergence requirements while(error > convergence) prev = x; ...
function [Users] = MaxDegree_Algorithm(Data,S_user) %userhayi ke S_user ra tahte tasir gharar midahand [user_list]=ShowRelatedUsers(S_user,Data); %tedade kole Influence Users top_k=size(user_list,2); list_New=0; %Entekhabe tasadofi users max=0; max_user=0; fo...
%define clusters load('ws_Tucuma_1990_1997.mat', 'diffMapa') h9097 = length(unique(diffMapa))%4 clusters load('ws_Tucuma_1997_2000.mat', 'diffMapa') h9700 = length(unique(diffMapa))%4 clusters load('ws_Tucuma_2000_2011.mat', 'diffMapa') h0011 = length(unique(diffMapa))%3 clusters clear diffMapa %% ExpectationMaximiz...
% ## Copyright (C) 2017 % ## % ## 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 3 of the License, or % ## (at your option) any later version. % ## % ## This program is di...
function class = moments(sig1) % t1 = 4.8; X = [real(sig1(1:64)), imag(sig1(1:64))]; %considering first 100 points only E = evalclusters(X,'linkage','silhouette','KList',[4,16]); % evaluating number of clusters using silhouette measure %plot(E) if E....
function status = metacentrum_testmodels(exp_id, exppath_short, func_str, dim_str, inst_str, ids_str, opts_str, dataset) % metacentrum_testmodels Metacentrum version of testModels testing fitting % power of models on DTS dataset. (Matlab part to be MCR-compiled) % Function is called by modelTesting_binary_metajob.s...
% This function performs systematic re-sampling % Inputs: % S_bar(t): 4XM % Outputs: % S(t): 4XM function S = systematic_resample(S_bar) global M % number of particles % YOUR IMPLEMENTATION CDF=cumsum(S_bar(4,:)); r0=rand()*(1/M); S=zeros(4,M); ...
%triplot.m plots vertices and triangles %figure(2) plot3(x(1:nv,1),x(1:nv,2),x(1:nv,3),'ko') hold on axis([-1.2 1.2 -1.2 1.2 -1.2 1.2]) axis equal manual plot3(x(1:nv,1),x(1:nv,2),x(1:nv,3),'ko') %ko means black circle %Vertices are all plotted. We are left to plot lines that connect points. xplot=zeros(4,3); fo...
function [fpic] = MakeFeaturePic(ftype, W, H) fpic = zeros(H, W); type = ftype(1); x = ftype(2); y = ftype(3); w = ftype(4); h = ftype(5); yh = y + h; y2h = y + h + h; xw = x + w; x2w = xw + w; x3w = x2w + w; switch type case 1 fpic(y:yh-1, x...
clear;clc;close all; trainingFolder = '.\training\'; trainingROIFolder = '.\trainingROI\'; mkdir(trainingROIFolder); nFiles = dir(trainingFolder); for k = 1:length(nFiles) if( ~strncmp(nFiles(k).name,'.',1) ) subNames = nFiles(k).name; mkdir( [trainingROIFolder,subNames] ) nFi...
function[] = RealAdaboost() load('face_samples.mat'); load('nonface_samples1.mat'); load('nonface_samples2.mat'); load('nonface_samples3.mat'); load('threshold.mat'); load('threshold_sign.mat'); bins = linspace(min(threshold),max(threshold),19); tr_data = [face_samples' ; nonface_samples1'; nonface_samples2'; nonfa...
HOL = [4,4,4,4,4,4,4,4,4]; pack_sen = zeros(1,10); U = unique(HOL); counts = histc(HOL,U); d = U(counts > 1); %Lets find counts of each repeating element in the HOL position for i=1:length(d) out{i} = []; %Creating a dynamic arrays for each element that repeated end %out = zeros(length(d),length(HOL)); ...
function [] = TumorTrainingandTesting(Normal,Tumor,Tumor1, HighResolutionImage, HighResolutionImage1,TESTHighResolutionImage,TESTMask) %function [] = TumorTrainingandTesting(Normal,Tumor, HighResolutionImage, Normal1,Tumor1, HighResolutionImage1,TESTHighResolutionImage,TESTMask) tic HighResolutionImage=rgb2gray(Hi...
gr = load('grid.txt'); traj = load('particle_trajectory.dna'); gridsize = 1; len = size(gr,1); figure() hold on %plot3(gr(:,1),gr(:,2),gr(:,3), '.r', 'linewidth', 5) for i=1:len if(gr(i,1) == 1) p = (gr(i,3:2:7) + gr(i,2:2:6))./2; w = (gr(i,3:2:7) - gr(i,2:2:6))./2; plot3(p(...
function movieslidergcf(src,eventdata,hSlider,hTxt,func_data,func_hdr,fmin,args,myfig,myRange,x,y,z,roi,func_xyz,spm_hdr) % movieslidergcf.m - part of ortho package, callback executed when slider is moved. % Author - Krisanne Litinas % $Id: movieslidergcf.m 740 2013-07-31 14:13:15Z klitinas $ % Get the position of th...
global TESTBED s=sprintf('id : '); for i=1:length(TESTBED.nodeIDs) s=[s sprintf(' %2d ',TESTBED.nodeIDs(i))]; end s=[s sprintf('\n')]; disp(s) s=sprintf('ident : '); for i=1:length(TESTBED.nodeIDs) s=[s sprintf(' %2d ',TESTBED.identReported(i))]; end s=[s sprintf('\n')]; disp(s) s=sprin...
function [state, location, values] = tracker_l1apg_update(state, image, varargin) values = struct(); [gray, ~] = image_convert(image_create(image), 'gray'); %-Draw transformation samples from a Gaussian distribution sc = sqrt(sum(state.map_aff(1:4).^2)/2); std_aff = state.parameters.rel_std_afnv.*[1, sc, sc, 1, s...
function joints_w_meta = combine_meta_with_joints(joint_matrices, meta_as_struct) subj_names = fieldnames(joint_matrices); no_of_subject = length(subj_names); joints_w_meta = joint_matrices; for subj = 1 : no_of_subject joints_w_meta.(subj_names{subj}).meta = meta_as_struct.(subj_name...
function [L,D,P] = LDLTpiv(A) % function [L,D,P] = LDLTpiv(A) % LDL-transpose factorization of a symmetric positive definite matrix % with diagonal pivoting. % A is nxn and symmetric and positive definite. % L is nxn unit lower triangular, D is nxn diagonal, P is nxn permutation, % and PAP' = LDL'. % GVL...
classdef NlpFunction < handle % This class provides a data structure for a optimization function. % This function could be either a constraint or a objective function of % the problem. % % To define a NlpFunction object, a user-defined function file must be % created first. It could be either MA...
%load images function image = loadImages(path, image) % Note that Middlebury depth is in disparity units, so we load disparity % and convert to depth. LiveColor+3D is in meters, so we load depth and % convert to disparity. Disparity maps are not used for enhancement, but % might be interesting for late...
%% Set the stage clear all clc N = 1200; m = 10 ; phi = zeros(m,m,N); % Automatically specifies some boundary conditions % Boundary Conditions % Solving on a unit square; phi(x,y) ; phi(x,1) = x^2 - 1 ; % phi(0,y) = -y^2 ; phi(1,y) = 1 - y^2 ; phi(x,0) = x^2 ; % % specification of the boundary conditions h = (1-0...
function retval = SEICR_Pro (data, pin, t, array, NP) lock_fun = @(t) g_lock(t,array); ibd = [pin(1) pin(2) pin(4)]; eps = pin(6); ag = [pin(3) pin(5)]; y = SEICR_Eval(NP,t,ibd,eps,ag,0,lock_fun); y_min = SEICR_Eval(NP,t,ibd,eps-0.3*eps,ag,0,lock_fun); y_max = SEICR_Eval(NP,t,ibd,eps+0.3*eps,ag,...
function Crow = coriolis_row_4(rob,in2,in3) %% CORIOLIS_ROW_4 - Computation of the robot specific Coriolis matrix row for joint 4 of 6. % ========================================================================= % % Crow = coriolis_row_4(rob,q,qd) % Crow = rob.coriolis_row_4(q,qd) % % Description:: ...
# interface to mdsPlus thin client mds_debug = 0; function _system(cmd) global mds_debug; if (mds_debug > 0) printf("system %s\n", cmd); endif system(cmd); endfunction function mdsConnect(server) cmd = sprintf("mdsConnect %s", server); _system(cmd); endfunction function mdsOpen(tree) cmd = sprintf("mdsOpe...
function [ output_args ] = matador_experiment_manager(directive, target_folder, target_host, ssh_key ) if(~exist('ssh_key','var')),ssh_key=default_ssh_key;end; manager_script = prepend_path(dirname(mfilename('fullpath')),'matador_experiment_manager.sh'); if(islocalhost(target_host)) cmd = concat_cell_string_arra...
function [t] = ethernet_write_mohammad(sig_i, sig_q) display('Sending Data via ethernet') t = tcpip('192.168.1.10', 7, 'NetworkRole', 'client'); fopen(t); for i = 1 : length(sig_i) fwrite(t, num2str(sig_i(i))); pause(0.001) fwrite(t, num2str(sig_q(i))); pause(0.001) e...
function varargout = f_GrafMalla(varargin) %Se asume que se está corriendo esta función con todos los directorios del programa agregado %al path. %Devuelve los argumentos de salida: in,m_Coord,m_SetElem,e_DatSet,e_VG. %Está pensado para exportar la malla como eps y después editarla en corel...
function V = verticalize(A) A = reshape(A,[],1); V=A(~isnan(A)); end
function [B,E] = makeGroupBarPlotError(Y,err,cmap) B = bar(Y); hold on x = []; for i = 1:numel(B) x(i,:) = B(i).XEndPoints; B(i).FaceColor = cmap(i,:); end E = errorbar(x,Y',err'); for i = 1:numel(E) E(i).LineStyle = 'none'; E(i).Color = 'k'; E(i).LineWidth = 1; E(i).CapSize = 0; end
function plot_contrast_dprimes() load( 'master_file_struct', 'master_file_struct' ); mfs = master_file_struct; contrast_dprime_struct = struct; % Get set of attend d's for each unit, for each contrast. Should have a % cell array? of X cell, each with 8 dir by 4 contrast. - One for % Contr...
%a y b son los individuos que se reciben como parametro function [a, b] = one_point(a, b) l = length(a); r = ceil( rand * l ); i = r; while ( i <= l ) aux = a(i); a(i) = b(i); b(i) = aux; i = i + 1; end end
function frame_scores = all_frame_scores(test_sequence, dataset) % function frame_scores = all_frame_scores(test_sequence, dataset) % % frame_scores{j}(i, m) is the normalized crosscorrelation score between % the motion image computed for the i-th frame of the m-th model and the % j-th frame of the test sequen...
%use newton rapson method to find new density of component 1 at interface del_den_err=1.d0; den1_inter_old=den_interface_1(j); pre_inter_old=1e5*system2.getPhase(0).getPressure(); % system_newton= SystemSrkEos(310.95,108.000); % system_newton.addComponent('methane', den_interface_1(j-1)/1e5); % system_newton.a...
clc; clear all; comport = serial('COM5','BaudRate',115200); fopen(comport); x=0; while(x<100) x=x+1; y1(x)=fscanf(comport, '%d'); y2(x)=fscanf(comport, '%d'); y3(x)=fscanf(comport, '%d'); plot(y1,'r','linewidth',1) hold on; plot(y2,'b','linewidth',1) plot(y3,'g','linewidth',1) hold off drawnow ...
classdef CLAN < instrument.CConnect %CLAN 此处显示有关此类的摘要 % 此处显示详细说明 properties % instObj; % address; end methods function obj = CLAN(address) % obj.address = address; % % Find a VISA-TCPIP object. % obj.instObj = instr...
classdef Diff < dagnn.ElementWise properties type end methods function outputs = forward(obj, inputs, params) outputs{1} = inputs{1} - inputs{2} ; end function [derInputs, derParams] = backward(obj, inputs, params, derOutputs) derInputs{1} = derOutputs{1} ; derInputs{2} = -...
function [D] = qPHOG(I,edges,nbBin,ROI,level) % I is gray scale image %tic; if edges EDGES = edge(I,'canny'); else EDGES = I; end hx = [-1,0,1]; hy = -hx'; grad_xr = imfilter(double(EDGES),hx); grad_yu = imfilter(double(EDGES),hy); angles=atan2(grad_yu,grad_xr); magnit=((grad_yu.^2)+(grad_xr.^2)).^.5; binEdg...
%% This script is to evaluate the impact of flexiblity of interactive workload on the grid. % The idea is, we can reduce the power consumption of data center by % degrading the quality of service (such as delay) of serving interactive % workload. % Discription: Given flexibility of delaying interactive workload, how t...
function PTPhaseN_prs2(obj, evt) hndl = get(gcf, 'Userdata'); set(hndl.uicontrol.control.waveN, 'Enable', 'off'); set(hndl.uicontrol.control.FFTN, 'Enable', 'off'); set(hndl.uicontrol.control.coherenceN, 'Enable', 'off'); set(hndl.uicontrol.control.phaseN, 'Enable', 'off'); fin = dir(fullfile(hndl.gen...
function [x_int,y_int] = Lagrange(x,y) e = 0.1; % dokladnosc interpolacji x_int = x(1) : e : x(length(x)); for i = 1 : 1 : length(x_int); % wyliczanie poszczegolnych y(x) = sum(Lk) y_int(i) = 0; for k = 1 : 1 : length(x); % wyliczanie poszczegolnych Lk Lk = 1; for j = 1 : 1...
function [cor,vid]=ckeckFix(scr,const,my_key,vid) % ---------------------------------------------------------------------- % [cor,vid]=ckeckFix(scr,const,my_key,vid) % ---------------------------------------------------------------------- % Goal of the function : % Draw a the fixation target (Green dot with bull-eye), ...
%mydelete take an input of the file to delete the data from, the old data, %and the name of the data you want to delete. It first makes sure that the %fuel is not being used by any of the rockets, then it takes the fuel name %and tries to find it in the old data array, if it finds it it deletes it, %and replaces th...
%-------------------------------------------------------------------------- %This functions determines the least cost path through our matrix of freqs % %Inputs: %fmatrix - Matrix of the frequencies obtained from fmatrixpgram size(N by r) % - The rth column of this matrix contain the N peaks in the Rth frame ...
function z = my_obj_fun_Sustainability_CAISO_no_corr(x) %x is an nx1 vector of weights %rho is the PJM correlation matrix derived from first stages of model %in this function it is the identity matrix (no correlation between %technologies) % x will be a row vector of size specified in main function call Rho...
matlab2json(jso,'K:\EEG\Sleep_human\data.js','data') html_create('K:\EEG\Sleep_human\index.html',{'data.js','home.js','info.js'}); % home.js: write for each file %% demo 2, list and create html files % 2019-06-12
n = 0:100; x = 0.7.^n; stem(n,x) N=50; k=0:N-1; xp=1./(1-0.7*exp(-j*2*pi*k/N)); xpn=ifft(xp); xpnp = [xpn xpn]; kk = 0 : 99; hold stem(kk,xpnp,'r')
function append2niidesc(strFileNii,str2append) % EXAMPLE % strFileNii = 'run_01.nii'; % str2append = '_rtrcr'; % want to append '_rtrcr' to existing description % append2niidesc(strFileNii,str2append) % $Id: append2niidesc.m 1610 2014-11-18 21:11:32Z klitinas $ % Read header and make up new description hdr = read_nii...
path = 'D:\cue_task_data\converted\abao\cue\trainning\';` years = ls( path ); years(1:2,:) = []; for i = 1 : size(years,1) months = ls( [ path, years(i,:) ] ); months(1:2,:) = []; for j = 1 : size(months,1) sc = Ana_SpatialCue( [ path, years(i,:), '\', months(j,:) ], [], [], true, true ); end end % fu...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 対象:case26 % 焦点水平位置固定:y=0 % 境界面を検出→参照点の妥当性評価 % ch 50直下のピクセルにフォーカスをかける. % 参照点:整相加算における参照点 % 比較する点:各chでのrf信号最大値(絶対値はとらない) %誤検出が見られるが,反射強度を考慮して誤検出と判別できるようにする. % フォーカス深度を1グリッドずつ変化させて,開口合成受信データを生成する. % F値を固定する.最近接距離をいくつに設定する? % x-axis: 20 mmのときに全素子を使うという前提を設ける. % 対象にする媒質データ:case26を用...
%{ # animal subject_name : char(128) # unique subject name --- genotype : enum('WT','KO','U') # genotype - KO, WT, or unclassifed animal_notes = null : char(128) # animal_ts=CURRENT_TIMESTAMP : timestamp # ...
function my_phase() IC = [1 1; 1 2;1 3;1 4]; hold on for ii = 1:length(IC(:,1)) [~,X] = ode45(@EOM,[0 50],IC(ii,:)); u = X(:,1); w = X(:,2); plot(u,w,'r') u = gradient(X(:,1)); v = gradient(X(:,2)); quiver(X(:,1),X(:,2),u,v); end xlabel('u') ylabel('w') grid end
%% Instruction % Workflow: % - Raw CSV->ThingSpeak CSV->Clear channel->Upload csv->Run app % ThingSpeak CSV format requirements: % - Datetime: 1/2/2017 % - field 1-7: store predictors and response. Test data are below Train data. % - field 8: number of train observations, number of var names, and var names %% Read dat...
function g = NBS(x,y,d,N,lambda,k_opt,l_opt) % x,y分别为方位、俯仰角,两者维度必须相同 % 保证输入的向量均为列向量 gx = diric(d*2*pi/lambda*(k_opt-x),N); gy = diric(d*2*pi/lambda*(l_opt-y),N); g = gx.*gy; end
function [gSWj, gBSj, SWparams, BSparams, DivRedPred] = composePredictedDiversity2( SWbase, SWgpos, BSbase, params, config, pos, EgMutDiv ) %, remote2closeDiv % function [DivRedPred, sumeps] = composePredictedDiversity2( preLH, params, config, gpos ) % calculating the predicted reduction in diversity due to linked se...
function [simValue] = similarity (x,l) simValue = zeros(size(x,1)); m = size(x,1) for i = 1:size(x,1) simValue[i] = exp() end end
% Two-Mode HOSVD with semi-nonnegative constraint % Input: % Tensor: an order-3 tensor % Ncomp: number of components to extract % Output: % output_vector_X: a matrix with Ncomp columns, where each column is an estimated singular vector in the X-mode. % output_vector_Y: a matrix with Ncomp columns, where each c...
function [mu, var, time] = gprExact(K, Ks, Kss, y, hyp) tic [n,~]=size(K); [ns, ~] = size(Kss); sn2 = exp(2*hyp.lik); L = chol(K/sn2+eye(n)); % Cholesky factor of covariance with noise clear K %KRZ alpha = solve_chol(L,y)/sn2; % nlZ = y'*alpha/2 + sum(log(diag(L))) + n*log(2*pi*sn2)/2; % -log marg li...
%Author: REDJAN F. SHABANI %Universita' degli studi di Roma "LA SAPIENZA" %Ingegneria Informatica - Intelligenza Artificiale %Version: Gen. 2010 %Returns three weights matrix for each layer of the network. %-->input m, input size of the network %-->input n, output size of the network %-->input h, number of network hi...
% Calculate confidence interval of GC. % only suitable for nGrangerT series functions(use same fitting order % in auto and joint regression). function [gc_lower, gc_upper] = gc_prob_intv(gc, od, len, a) if nargin<3 disp(' Calculate confidence interval of GC.'); usage('[gc_lower, gc_upper] = gc_prob_intv(gc, od, l...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This is code written by Leon Yin for an assignment in Olivier Pauluis' % % Atmosphere, Ocean, and Climate Dynamics course taught at Courant % % Institute of Mathematics. % % ...
function [xy,p] = r(x,y,outlier) % computes a zero order correlation % useage: r(x,y,outlier) % where trials with outlier=1 are filtered out if nargin==3 indices=find(~outlier); xy=corrcoef(x(indices),y(indices)); else xy=corrcoef(x,y); end xy=xy(1,2); if nargout>1 df=length(x)-2; t=xy./...
%=========Initial========= % Set up everything for simulation: abstraction system, controller % Ground Type 2: uneven ground, no holes % No change of robot model. Map the real input to the input used in % model % Make sure that the input constraints satifies by shrinking lmax % decouple the lmax and the maximum length ...
% Capture contact positions after co-registration and convert to RAS function [CentroidCoord,RASCoord,electrode_identity,test] = CC_VoxToRAS(subj,Torig,imageFile,varargin) subj_dir = '/space/mdeh7/1/halgdev/projects/bqrosen/CC/RECON'; % subj = 'CCEP0026'; cmd = sprintf('mri_info --vox2ras-tkr %s/%s/mri/orig.mgz',subj_d...
function segmentation_test() A = zeros(500,500); A(200:250,100:300) = 1; A(50:100,70:100) = 2; imagesc(logical(A)) pause(5); BW2 = bwselect(logical(A),150+101,200); imagesc(BW2) end
clear; clc; p = [0.01:0.01:0.099, 1:0.02:2, 2.1:0.1:10, 11:1:100]; fi = 0 : pi/100 : 2*pi; teta = -pi/2 : pi/100 : pi/2; x_0 = zeros(size(fi,2),size(teta,2)); y_0 = x_0; z_0 = x_0; po = ones(1,size(fi,2)); x = x_0; y = y_0; z = z_0; x_0 = cos(fi)'*cos(teta); y_0 = sin(fi)'*cos(teta); z_0 = po'*sin(teta); for i = ...
% de-mean mm = mean(single(mat_x),2); mat_x = bsxfun(@minus,single(mat_x),mm); save ../data/train/ucb_st_15_dc.mat mat_x mat_y % four direction psz = 15; ind0 = reshape(1:psz^2*3,[psz psz 3]); ind1=ind0;ind2=ind0;ind3=ind0; for i=1:3 ind1(:,:,i) = rot90(ind0(:,:,i)); ind2(:,:,i) = rot90(ind1(:,:,i)); ind...
% Problem8 dt = 1/100; et = 4; t = 0:dt:et; x = 2*sin(2*2*pi*t); subplot(2,1,1);plot(t,x);grid on axis([0 et -2 2]); xlabel('Time(s)'); ylabel('X'); [f,s] = ft(t,x); S = abs(s); subplot(2,1,2); plot(f,S);grid on axis([-10 10 0 10]); xlabel('Frequency(Hz)'); ylabel('Amplitude');
%% LINEARIZING STATE SPACE MODEL %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Setting the variables with the same values of the first Homework % conditions. s = 0.0154 ; % Section Area sp = 5*10^(-5); % Pipe Section Area mi = 0.5; % Flow Constant mi2 = 0.675; % Flow Constant qmax = 1.2*10^(-4);...
function printMagReportMsg_MagLightTrail(address, message, connectionName) % Because MagReportMsgs report very quickly, you may get a steady stream of % reports if your threshold is set too low. MAGLIGHT.ReportMsgFlag is a % flag to shut of message reports while you tune the report threshold global APPS; if (isfield...
function [bincenters,averages,errors]=bincumulativeopen(x,y,min,max,oversamplingratio,nbins) binwidth=(max-min)/nbins; binedges=linspace(min,max,nbins+1); bincenters=min+binwidth/2:binwidth:max-binwidth/2; averages=NaN(1,nbins); errors=NaN(1,nbins); if nargin==6 for i=1:nbins averages(i)=nanmean(y(x>bined...
clc; AREA_SIZE = 100; TOTAL_AGENTS = 1000; RATIO = [0.99; 0.01; 0]; INITIAL_SUSCEPTIBLE = TOTAL_AGENTS*RATIO(1); INITIAL_INFECTED = TOTAL_AGENTS*RATIO(2); INITIAL_RESISTANT = TOTAL_AGENTS*RATIO(3); INFECTION_RATE = 0.1:0.1:1; MOVEMENT_RATE = 0.3; % Refered to as d NUM_TRIALS = 10; RATIO_STEPS = 1:10:151; statisti...
startFrame = 230; endFrame = 500; numFrames = endFrame - startFrame + 1; imHeight = 180; imWidth = 320; binImgThreshold = 0.35; % places all the images into a nice array ims = cell(numFrames, 1); i=1; for f = startFrame:endFrame imName = strcat('imgs2/',int2str(f),'.png'); ims{i} = im2double(imread(imName))...
%{ This script allows me to choose the folder where my data is and then it will create a directory and extract the abf files, organizing everything into a matlab structure that is organized by filename and sweeps. Although I could, I didn't use this data in matlab to calculate the DSE. I had already done that in clamp...
%% ~~~~ intermediate step in calculating Geweke's ML ~~~~ %% %% ~~~~ calculate f_i(chi) ~~~~ %% function rt = GewekeMHML(chirow,chihat,logsighatmode,lambda,n) secorder = (chirow-chihat)'*inv(logsighatmode)*(chirow-chihat); rt = (2*pi)^(-n/2)*det(logsighatmode)^(-1/2)*exp(-1/2*secorder)* ... (secorder <=...