text
stringlengths
8
6.12M
function desiPosNeg %desiPosNeg - this is the main function for doing dual ion mode DESI data %analysis from a single imzML file. defP = '/Volumes/JSM/DB/DESI Polarity Switched/IMZML/'; if ~exist(defP,'dir') defP = pwd; end if ~strcmp(defP(end),filesep) defP = [defP filesep]; end % Do some simple things relat...
%% settling_velocity.m % Usage: settling_velocity(DIR, ts, te) % Purpose: template for matlab tools % % User Inputs: % nan - Not applicable % % Function Requirements: % part_data.mat time Wp % flow_data.mat tflow avgWf function settling_velocity(DIR, ts, te) load data/part_data.mat time Up Vp Wp lo...
function iccp_batch_strf_rtf % iccp_batch_strf_rtf Estimate modulaton functions for STRFs in directory % % Processes all '*-pairs-strf-params.mat' files in the current directory % and then calculates ripple transfer function parameters. RTFs are the % Fourier transform of the STRF, and describe the tempo...
cd(dataPath); % load ancillary data addpath("ancillary_mat/."); % load the lats and lons load('modis_qkm_pixel_latlon.mat'); load('modis_qkm_water_mask.mat', 'water1_land0'); % add mxvi path addpath("mxvi_mat/."); cd("mxvi_mat"); m_year_count = 18; mxvi_vals = cell(18, 1); for year = 2002:2019 if ...
g_name='ig.bmp'; c_name='i2.bmp'; out_name='ir.bmp'; %set solver=1 to use a multi-grid solver %and solver=2 to use an exact matlab "\" solver solver=2; featurelen=9; % gI=double(imread(g_name))/255; % %gI=rgb2gray(gI); % cI=double(imread(c_name))/255; % ct=rgb2ntsc(cI); % %colorIm=(((ct(:,:,2)~=0)+...
input=dataset('File', 'OnlineNewsPopularity.csv'); [r c]=size(input); summary(input);
X_chars = book_data(1:seq_length); Y_chars = book_data(2:seq_length+1); %Convert to Matrixes X, Y. (one-hot encoding) % X,Y size: (K x seq_length) % h0 zeros X = zeros(K, seq_length); Y = zeros(K, seq_length); for i = 1:seq_length ch_x = X_chars(i); ch_y = Y_chars(i); X( char_to_ind(ch_x), i ) = 1; Y(...
function [perror] = checkTracking_Boris_old(truedata, mydata, Nframes) if nargin < 3 Nframes = truedata.nFrames; end trueobjectsnormalobjects = [0 0]; numberofallobjrect = 0; numberofsmissed = 0; for iFrame=1:min(Nframes, truedata.nFrames) trueframe = truedata.Frames(iFrame); myframe = mydata.Frames(iFra...
%this function should be run before running the watchFreq functions global ROOT addpath([ROOT '/tools/watchFreq']) addpath([ROOT '/shared/oscope']); addpath([ROOT '/contrib/kamin/util']); defineOscopeEnvironment global DEFAULT_WATCH_NODES_PARAMS DEFAULT_WATCH_NODES_PARAMS.fieldName='moteID';%'data'; %this is the...
clear load('A244_personal_G1m13_to_all_populations_21-Jul-2021.mat') fcr_id = 1; com_id = 33; pooled_trials = zeros(length(all_run_rand_combined{1})*length(patient_id),length(all_run_rand_combined)); for i = 1:length(all_run_rand_combined) trials_cell = all_run_rand_combined{i}; trial_vector = []; ...
close all; clear; clc; %% plot cdf and pdf a = 2; q = 0:.01:5; p = 0:.002:1; f_wb = a * q.^(a - 1).* exp(-q.^ a); F_wb = 1 - exp(-q.^a); F_wbInv = (-log(1 - p)).^(1/a); plot(q,f_wb); xlabel('X','FontSize',15); ylabel('fX','FontSize',15); figure; plot(q,F_wb); xlabel('X','FontSize',15); ylabel('FX','FontSize',15); %f...
function outputs = test_ran(ran, test_x) outputs = rbfnet(ran, test_x); end
clear all for ty=1:220 clear {fi u} load(['iter' num2str(ty)]) figure(1) clf hold on plot(u(25,:),'r') plot(fi(25,:)) axis square grid on hold off q=getframe; qq(ty)=q; end figure(42) clf mm=0; for i=1:22 %% Xn=frame2im(qq(i)); image(Xn) axis equal axis off% axis equal mk(i)=ge...
% Copyright (C) 2013 Quan Wang <wangq10@rpi.edu>, % Signal Analysis and Machine Perception Laboratory, % Department of Electrical, Computer, and Systems Engineering, % Rensselaer Polytechnic Institute, Troy, NY 12180, USA % this is a demo showing the use of our dynamic time warping package % we provide both Matlab ve...
for voi_idx = 1:length(list_idx) [handles.contour_volume handles.mask_volume first_slice last_slice] = return_volume_contour_mask(handles.VOI_obj(list_idx(voi_idx)).contour, handles); mask = handles.mask_volume; if sum(mask(:)) > 1 [range extended_range] = determine_mask_range(mask); ha...
% % C = setMinus(A, B) % % @param A % a set(1-dimensional vector) % @param B % another set(1-dimensinal vector) % @return C % a set A - B % function C = setMinus(A, B) j = 1; for i = A if ~any(i == B) C(j) = i; j = j + 1; end end end
function a = task5(groups) firstType = length(find(groups == 1)); secondType = length(find(groups == 2)); disp(firstType); disp(secondType); hight1 = sum(groups(find(groups == 1),2))/firstType; hight2 = sum(groups(find(groups == 2),2))/secondType; hight3 = sum(groups(groups(find(groups == 1),2) < 20...
function F=FgaussPoisson(h,f) GaussP=[-0.9061798 -0.5384693 0 0.5384693 0.9061798]; %高斯点 9次代数精度 GaussA=[0.2369269 0.4786287 0.5688889 0.4786287 0.236926]; XX = 0:h:1; %区间[0,1] F=zeros(length(XX)-1,1); n=length(XX)-1; %% Part I for i=1:...
% a pilot script running regional searlight RSA in the whole brain % key modifications from v1: % 1. utilizing the 'mask' for effective voxels (those with valid 3*3*3 % voxels surrounding them) % 2. using fastcorr.c instead of the built-in corr implementation for the % computation of Pearson correlation coefficien...
%function loc = DoG(im,tf) % uses the difference of gaussian approach for finding the local feature % points. % %INPUT %-im: image (grayscale) %-tf: flatness threshold (typically 0.01) % %OUTPUT %-loc: a matrix of nx3 with n found locations with [x,y,sigma] for columns function loc = DoG(im,tf) loc = []; %prior smooth...
%% TIMESTAMP prints the current YMDHMS date as a timestamp. function timestamp ( ) t = now; c = datevec ( t ); s = datestr ( c, 0 ); fprintf ( 1, '%s\n', s ); return end
%This is the flux partitioning program. You'll need to define some %variables before you run this program. There are two different methods to %partition the flux. The first uses nightime NEE and a Q10 function to %separate GEE and ER, and the second uses daytime NEE to fit a light %response curve and then separat...
clc clear all close all load Cropcor %FOR COUNTING EMPTY FRAMES empt = 1; %FOR STORING NON EMPTY CENTROID nt_empt = 1; file_names_clip = dir('C:\Users\Abhinav Sharma\Documents\Carnegie Mellon Research\CMU Lab Research\2016\Split Belt Analysis\Computer Vision\Paw Tracking\August 3rd 2016\Movie Frames from ClippedMOV005'...
function data_w=Detection(A,threshold) A=single(A); coefficient = 4; [W2 W3]=waveletTransform(A,1,threshold); if coefficient==2 PJ=W2+W3; elseif coefficient==1 PJ=sqrt(W2.*W3); elseif coefficient==3 PJ=W2; else PJ=W3; end h=[1/16 1/4 3/8 1/4 1/16]; t1=sum(h); t2=sum(h.^2); t3=sum(h.^3); c=(7*t2)/(8*t1...
function figdi % figure digitizer % % Use: 1. Input image to be digitized, e.g. test.jpg. You can type the % name of the image in the editable text field, or push "Browse" % button to browse the file. % 2. Digitize left x, by pushing "Digi x1," and enter corresponding % ...
function QTable = initializeQTable() % Fungsi ini bertujuan untuk menginisialisasi QTable dan mengeset nilai % arah yang tidak bisa dilalui dengan nilai -Inf (negatif tidak % terhingga) dan mengeset nilai 0 untuk setiap blok yang dapat dilalui QTable = zeros(4,225); % Membuat array dengan ukuran 4...
%{ Name: extract_sample_data.m Author: Vidhu Nath Purpose: This script opens 'Pogo-Experiment2-Session1-09-12-2013-SPKC01' and extracts the first 100,000 data points as sample data, since the original file is too large to manipulate. %} % clear up memory clear; cd('C:\code\MATLAB\CS_591_C1\'); d...
% Final Project - Imu Data Analysis % William Woodall & Michael Carroll % May 6th, 2011 % MECH 7710 Optimal Control and Estimation clear; clc; close all; format loose; format short; %% Import Static Data % importfile('imu_data.csv'); %% quat = zeros(length(data(:,1)), 4); quat(:,1) = data(:,1); quat(:,2) = data(...
function trade_opt_apart(obj, direc, volume, offset, px) % 基于trade_opt的拆单下单操作 % trade_opt_apart(obj, direc, volume, offset, px) % wyf 20161229 % 预先判断 if ~exist('direc', 'var'), direc = '1'; end if ~exist('volume','var'), volume = 1; end if ~exist('offset', 'var'), offset = '1'; end % 拆单操作 entr...
function [image] = nonmaxsupp(image,angle) % Perform non-max suppression on im orthogonal to theta. if numel(angle)==1, angle = angle .* ones(size(image)); end % Basic requirements mask = ones(size(image)); [height,width] = size(image); [x,y] = meshgrid(1:width,1:height); angle = mod(angle+pi/2,pi); % Determine ...
function results = rbac_eval() %load training data set load X_1.mat Nusers = size(X,2); %split data into training and test set randUsers = randperm(Nusers); X_train = X(:,randUsers(1:round(Nusers/2))); X_test = X(:,randUsers(round(Nusers/2)+1:end)); %train on training data tic [ Z, U ] = estimateRolesAndAssignments(...
% genPctrlrScript global dT; dT = 0.1; Pctrlr = PpolicyNonLinOptInit(10,30,diag([1,1,0.1,0.1]),1,100,2,0.2,3); save('examples/Pctrlr_CovGamma_1','Pctrlr'); %ch,ph,xWt,uWt,gWt,s_q,s_r,ctrlChoice Pctrlr = PpolicyNonLinOptInit(10,30,diag([1,1,0.1,0.1]),1,1,1,0.2,3); save('examples/Pctrlr_CovGamma_2','Pctrlr'); %ch,ph,x...
function flag = reconfVMAdd( vmId, mode ) %RECONFVMADD this function increment the CPU amount assigned to the VM % USAGE : flag = reconfVMAdd( vmId, mode ) % INPUT: % vmId - the id of the virtual machine % mode - the modality of execution, it can be 'check' if we want to test % the applicability of the action, ...
function[punta_px, punta_py, datos_x_1, datos_y_1, recta_1, datos_x_2, datos_y_2, recta_2] = testeo_cal_2_cam_funcion(directorio, camara, tag_x, tag_y, graficos, guardar) % graficos vale 'on', 'off' % guardar vale 1 o 0 dir_camara = ['camara_' camara '\']; set(0,'DefaultFigureVisible', grafico...
%% enkripsi dengan substitusi caesar clc; clear; % inputan plaintext & key txt='MUHAMADRIZKYFAJARFEBRIAN^-^Ditambahin_bEn_tAMBAh_PanjanG_daN_AngelFP-87-94-93-94-MB114.125.9.97' key=2000; % Proses Enkripsi %%transform abjad --> angka if ( (txt < '0') | (txt > 'z') ), error('Text character out of range a-z'); end; y=t...
function [N, D, M] = GetDimensions(x) % [N, D, M] = GetDimensions(x) % % Returns the size and dimension of a signal x. % % x: The signal. % % N: The dimensions of x. % D: The number of dimensions of x (length of N). % M: Corresponding number of wavelet subbands per % scale for a separable wa...
% localize the neuron cid_list=h5read('transient_6.hdf5','/cluster_id'); path_list=h5read('transient_6.hdf5','/path'); %reg_list=h5read('transient_6.hdf5','/reg'); % positive control pathFullList = h5read('path2tid.hdf5','/path'); midList = h5read('path2tid.hdf5','/mid'); tidList = h5read('path2tid.hdf5','/ti...
% Lec 6.1 : Regression and Interpolation : Introduction function yint = ndd(x,y,xint) N = length(x); %% Dividend Difference Coefficients D = zeros(N); colD = y; D(:,1) = colD; for i = 2:N colD = diff(colD)./(x(i:end)-x(1:N+1-i)); D(1:N+1-i,i) = colD; end coef = D(1,:); %% Interpolate xq = [1;cumprod(xint-...
function snr_im=compute_snr(In) % In=rand(128,128,10,6); In=reshape(In,size(In,1)*size(In,2),size(In,3),size(In,4)); for sl=2:size(In,2)-2 for dir=1:size(In,3) roi_input(:,sl,dir)=In(:,sl,dir)>0.2; % figure; imagesc(roi_input); colormap(gray); colorbar; roi_bg(:,sl,dir)=In(:,sl,dir)-roi_input(:,...
function [tmax,S,K]=moments(a,index) %-------------------------------------------------------------------------- %calculate tmax, skewness, and kurtosis of Moment release %Input: a [Array, earthquake catalog] %format YYYY MM DD HR MIN SEC.MSEC LAT LON DEPTH MAG %It doesn't matter if there are more columns %Here ...
function modify_map(cont,subc,P_l) % delete lost states in map container idx = find(subc.idx_lost==1); for i = 1:length(idx) cont.subcontrollers.remove(subc.set(idx(i))); end % modify "modified states" in map container idx = find((subc.idx_mod&~subc.idx_lost)); for i = 1:length(...
clearvars -except PacingFrequency AcquisitionFrequency main_folder cutoff scripts_folder atLeast1Beat non_regular_beat regular_cell_number irrregular_cell_number res_folder = cd; disp('Non Regular Beats Analysis:') if exist('Calcium_Traces.xlsx') [ca_traces] = xlsread('Calcium_Traces.xlsx'); % N_cell = size(...
function [q] = u2q(u, theta) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here q = [cos(theta/2); u(1)*sin(theta/2); u(2)*sin(theta/2);u(3)*sin(theta/2)]; end
function testt() [filename, pathname] = uigetfile('*.txt','请选择一个拓扑数据txt文件'); if isequal(filename,0) return; end E = load(fullfile(pathname, filename)); % 加载网络 disp(E); end
function factors = ComputeAllSimilarityFactors (images, K) % This function computes all of the similarity factors for the images in % one word. % % Input: % images: An array of structs containing the 'img' value for each % character in the word. % K: The alphabet size (accessible in imageModel.K for the provide...
% Name: Zheng Wen % USC ID: 7112807212 % USC Email: zwen1423@usc.edu % Submission Date 3/19/2020 function energy_row = featureAverage_abs_win(feature_map, rad) [m, n, c] = size(feature_map); energy_map = zeros(m,n,c); for chan=1:c cur_fm = feature_map(:, :, chan); padd_fm = reflectionPad(cur_fm,r...
%> \brief determine the time interval function [ dt ] = matUpdateTimeInterval( obj, fphys ) dt = nan; for m = 1:obj.Nmesh dx = sqrt( obj.meshUnion(m).LAV ); N = obj.meshUnion(m).cell.N; dtm = mxUpdateTimeInterval2d( obj.hmin, ... obj.gra, N, dx, obj.meshUnion(m).status, fphys{m} ); if ( dtm...
function SurPeriods = PSMLatency( data, DPeriod, BLPeriod, SearchPeriod, BinSize, pVal, DEBUG ) %% SurPeriods = PSMLatency( data, DPeriod, BLPeriod, SearchPeriod[, BinSize=2, pVal=0.05, DEBUG=false] ); % Using the Poisson Surprise Method (Legendy and Salcman, 1985) to detect elevated activities. Coded by Bin Yang, ...
% process_iridium_apf11 function % % This function does all decoding for one profile and returns the float % structure to the main which is embedded in strip_argos_msg. APF11s are % fundamentally different in how they deliver the data so this needs to be % handled in a separate script, even though these are iridium f...
if SaveData == 1 savefilename = ['_Scratch_f',num2str(f),... '_A_c',num2str(A_c),... '_d_c',num2str(d_c)]; save(['scratch/Parameters',savefilename,'.mat'],'-v7.3') fid_Data = fopen(['scratch/Data',savefilename,'.txt'],'w'); fid_PanelProp = fopen(['scratch/PanelProp',sav...
function f = cheb_interp(cheb_x, x_k, N) cheb_x poly_params = polyfit(cheb_x, x_k, N); x = linspace(cheb_x(1), cheb_x(N+1), (cheb_x(N+1) - cheb_x(1))*1000); f = zeros('like', x); for i = 1:length(x) temp = 0; for j = 1:length(poly_params) temp = temp + poly_params(j)*(x(i)^(N...
function [J] = computeError(hx, y) % Initialize some useful values m = length(y); % number of training examples J = 0; error = hx - y; J = (error' * error) / (2 * m); end
function [OutpFile,Info] = publish(This,OutpFile,varargin) % publish Help provided in +report/publish. % -IRIS Macroeconomic Modeling Toolbox. % -Copyright (c) 2007-2017 IRIS Solutions Team. % The following options passed down to latex.compilepdf: % * `'cd='` (obsolete) % * `'display='` % * `'rerun='` % an...
function [g, J] = gradient(x, fx, cx, h, problem) %Input: %x : point of size n*1 %fx, cx : values of f and c at x %h : steps, i.e. a vector giving a step for each component of x %problem : it must be the same thing as in the SQP function %Output : %g : gradient of f at x %J : the Jacobian matrix of c at x n = size(x, ...
%Gaussian Operator %Computes the diffusion by calculating the neighbors each element at at %time within the grid function cells = GaussianOperator(cells) sourceVal = 5000; %ScaleFactor is rate of change scaleFactor = 4; rows = size(cells,1); cols = size(cells,2); for r = 1:rows for c = 1:cols %IF NOT A SOURC...
function [accepted_RR_pct,accepted_RR_count] = mvqrs_RRquality(Annotation,ValidSignals,Fm) % % [accepted_RR_pct,accepted_RR_count] = mvqrs_RRquality(Annotation_full,ValidSignals,Fm) % % Applies the beat annotation correction using a reference ECG electrode. % Necessary for blood pressure like signals with expectant pul...
function cmap = loadPreferredCmap() formatSpec = '%s %.3f %.3f %.3f'; fid = fopen([fileparts(mfilename('fullpath')) filesep 'color_profiles.txt']); M = textscan(fid,formatSpec); for i = 1:length(M{1}) cmap.(M{1}{i}) = [M{2}(i) M{3}(i) M{4}(i)]; end fclose(fid);
addpath('../') region = fetchregion([47.037647, 47.577722], [-89.048325, -87.543198], ... 'display', true); elevData = region.readelevation([47.037647, 47.577722], ... [-89.048325, -87.543198], ... 'display', true, ... ...
function e = end(a, k, n) % End indexing for quaternion arrays. % Copyright © 2005, 2008, 2010 Stephen J. Sangwine and Nicolas Le Bihan. % See the file : Copyright.m for further details. % This function is implemented by calling the Matlab builtin function on % the x component of a. This means the complexities of imp...
function [obj] = regObjective(obj, funcs) % This method registers the information of a NLP function as a % cost function % % Parameters: % funcs: a list of objective functions @type NlpFunction % % Parameters: % funcs: new NLP variables @type NlpFunction % % @note We always ...
function [P] = unmixP_NCM(X,E,Sigma,Parameters) %% Input: % X - d-by-N HSI data, matrix % E - d-by-M endmember mean set, matrix % Sigma - d-by-d-by-M endmember covariance set, matrix % Output: % P - M-by-N proportion matrix % Author: Alina Zare et al. Rewriten by Sheng Zou % Department of E...
load('X.mat'); [row,col] = size(X); T0=zeros(2000,10); T0(:,1)=1; T1=zeros(1979,10); T1(:,2)=1; T2=zeros(1999,10); T2(:,3)=1; T3=zeros(2000,10); T3(:,4)=1; T4=zeros(2000,10); T4(:,5)=1; T5=zeros(2000,10); T5(:,6)=1; T6=zeros(2000,10); T6(:,7)=1; T7=zeros(2000,10); T7(:,8)=1; T8=zeros(2000,10); T8(:,9)=1; T9=zeros(2000,...
function data = read_itx(filename) % This function reads data from the IGOR text file (.itx). fid = fopen(filename); % headerrows = 9; % format = repmat('%f ', 1, Ncols); % data = cell2mat(textscan(fid, format, 'MultipleDelimsAsOne',true, 'Delimiter', ' ', 'headerLines', headerrows)); while ~strcmp(fgetl(fid),'BE...
function hmm = mlhmmmar (X,T,hmm0,Gamma,completelags) % Given the state time courses estimation, does a last estimation of each MAR using (local) ML % % INPUT % X observations % T length of series % hmm0 HMM-MAR structure % Gamma p(state given X) - has to be fully defined % comp...
% task_generator.m % generate synthetic task sets %% Parameters N = 5; % number of tasks U_bound = N * (power(2, 1/N) - 1); % utilization boundary U_bar = 0.6; % desired utilization Ti_lower = 100; % taskset period upper bound (unit:10us) Ti_upper...
%% 3D walker with torso % John Rebula % States: % pelvis position, (q1, q2, q3) % pelvis roll angle, (q4) % stance and swing leg angle, (q5, q6) % % [pelvisX, pelvisY, pelvisZ, % pelvisRoll, % stanceTheta, swingTheta]; % % addpath(genpath('C:\Users\hbclStudent\Desktop\control')); % addpath(genpath('C...
function [Selector,Style] = ExpandSelector(OldSelector,OldStyle,UserOptions) NotStyle = setdiff(1:size(UserOptions,2),OldStyle.Location); Selector = UserOptions(NotStyle); Selector(end+1) = cellstr(OldSelector); Style = rmfield(OldStyle,'Location'); end
function [fill] = filter_plot_spectrum( b,a,x,Fs,name,noise ) %filters data and plots the filtered spectrum, takes transfer function %coefficients, b & a, data x, and sampling frequency Fs %returns the filtered data to the user %This program plots the filtered spectrum %filter the data fill = filter(b,a,x); %create ...
% where data is stored (that you download from figshare) dataroot = '/media/carsen/DATA2/grive/10krecordings/imgResp/'; % where processed data and results are saved matroot = '/media/carsen/DATA2/grive/10krecordings/stimResults/'; %% makes fig1 fig1(dataroot, matroot); %% makes fig2 fig2(dataroot, matroot); ...
function raiz = diffNumerica3PontosExt (funcao, x1, distH) % x1 = Ponto 1 % distH = o H, a distancia entre os pontos % Funcao % pkg load symbolic % syms x % ff=(x)^3 - 9*(x) + 3 % fd=diff(ff) % ans fd - Exibe a Funcao derivada % fd=diff(ff,2) % ans fd - Exibe a Funcao derivada segunda %ex: ...
function [Del,z,hInitial] = OneDGridGen(delt,n,L,viz,type) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % OneDGridGen produces a one dimensional grid that can either be uniform or % take on geometric properties depending on the user input. The function is % al...
function reorderPlots(self, reorder) temphp = self.hp; for i = 1:self.N % delete(self.hp{i}); self.hp(i) = temphp(reorder(i)); end set(self.haxes, 'Children', flipud(self.hp)); self.updateData(); end
function batch_calculate_spike_ephys_properties cells = dir('*.mat'); for i=1:length(cells) load(cells(i).name); [name sweep num_spikes AP_max AP_amplitude AP_width] = calculate_spike_ephys_properties(Cell); end
function [t, y] = forward_euler(f, tspan, y_0, steps) t = linspace(tspan(1), tspan(2), steps); size_y_0 = size(y_0); size_t_0 = size(t); y = zeros(size_y_0(1), size_t_0(2)); y(:, 1) = y_0; for i = 2:length(t) y(:, i) = y(:, i - 1) + (t(i) - t(i - 1)) * f(t(i - 1), y(:, i - 1)); end ...
function [cmat,meanacc,stdacc]=crossvallclassifier(x,y,ncross,ntrials) % initialize the random number generator to a known value rand('twister',666); % initialize the combined confusion matrix (for all trials) to zeros combconf = zeros(max(y)); for i=1:ntrials [confmat,accuracy]=trainandtest(x,y,ncross); % ...
function collectFeaturesHTS(func,dim,ssize) % ------------------------------------------------------------------------- % Preliminaries localSetup; % Run script with local setup FILENAME = ['_D' num2str(dim) '_C' num2str(ssize) '.mat']; % Parameters of the experiment %...
clear all %% E3632A DCPowerSupplyObject = visa('agilent','ASRL3::INSTR'); fopen(DCPowerSupplyObject); fprintf(DCPowerSupplyObject,'SYSTem:LOCal'); pause(0.1); fprintf(DCPowerSupplyObject,'*RCL 1'); pause(0.1); fprintf(DCPowerSupplyObject,'SYSTem:REMote'); pause(0.1); %fprintf(DCPowerSupplyObject,'VOLT:PROT 30'); %fpr...
function d=midfilt(x, n) [M,N]=size(x); x1=x; x2=x1; for i=1:M-n+1 for j=1:N-n+1 c=x1(i:i+n-1,j:j+n-1); e=c(1,:); for k=2:n e=[e,c(k,:)]; end x2(i+(n-1)/2,j+(n-1)/2)=median(e); end end d=x2;
function y = Jacobi(A, x, b) N = length(x); y = zeros(N,1); for iter=1:100000 for k = 1:N suma =0; for l= 1:N if k ~= l suma = suma + A(k,l)*x(l); end; end; y(k) = (b(k) - suma)/A(k,k); end; if sqrt(norm(x-y)) < 1e-6 break;...
close all; clear all; gt_dir = '/home/zxi/refinenet/datasets/ADE20K_hand_images/SegmentationClass/test'; pred_dir = '/home/zxi/refinenet/cache_data/Multiscale_evaluation_refinenet/ade_on_ade/test/predict_result_mask'; im_dir = '/home/zxi/refinenet/datasets/ADE20K_hand_images/JPEGImages/test'; dir1 = dir(fullfile(pre...
function diff_fireflux_small(timestep) % test if parallel runs give the same results % runs={'12x1','6x1','1x12','3x4','3x4a','4x3'} % runs={'1x1','6x1','1x12.a','1x12','3x4','3x4a','4x3'} runs={'1x1a','1x12a','3x4a','12x1','4x3','1x12'} vars={'UAH','VAH','UF','VF'} root='fireflux_small-'; wrffile='wrfrst_d01_2006-02-2...
function xy(dim) x=0; while x>=-1 [x y] = ginput(1) end return
function SCHED_assert_test_archs() arch.type = 'scheduling'; tmp = SCHED_ref_arch; arch.seq = tmp.arch; assert_architecture(arch); n = length(arch.seq); arch.seq = 1:n;% in order assert_architecture(arch); end
function [Position, Lidar, Sonar] = ConvertData(PositionRAW, LidarRAW, SonarRAW) %ConvertData Function to convert the raw data from the microcontroller % It converts the raw data from the microcontroller and process it to get % the true values % Position conversion TotalSteps = 96; PositionScale = (2*pi()/T...
% Loading Data [datamonoduring, Fs] = converttomono('/home/alli/longswampyrecording_music.wav'); [background, ~] = converttomono('/home/alli/background_flute_swamp.wav'); % Filter out Data Below 100 Hz and above 15kHz datamonoduring = bandpass(datamonoduring,[4000 10000],Fs); background = bandpass(background,[4000 1000...
function [net_charge, Vp, Vn] = subinit_core(save_name, a, b) %UNTITLED5 此处显示有关此函数的摘要 % 此处显示详细说明 temp_a = a; temp_b = b; temp_save_name = save_name; load('./source/simulation_res/intermediate_file/init_data.mat'); a = temp_a; b = temp_b; save_name = temp_save_name; clear temp_a; clear temp_b; clear temp_save_name; V...
function label = labelFunction(mask,deltaHue,tc) numRow = size(mask,1); numColumn = size(mask,2); label = zeros(numRow,numColumn); for m = 1:numRow counter = 0; for n = 1:numColumn if (mask(m,n) == 1) && (deltaHue(m,n) < tc) && (deltaHue(m,n) >= 0) label(m,n) = label(m,n-1); else i...
% 2019-09-10 Dylan Royston % % 2018-04-10 Dylan Royston % Shell script for using PCA to sort single-unit spikes % % For SM data, an entire session (day) should be sorted at once, which will be slow/data-intensive % Possible alternate for future update: sort 1 session and just apply that sort to subsequent trials % % %...
function uq_Kriging_display(KRGModel, outArray, varargin) % UQ_KRIGING_DISPLAY(KRGMODEL,OUTARRAY,VARARGIN): plot the mean and % variance of the Kriging predictor specified by the Kriging model % KRGMODEL. Only works for 1- and 2-D inputs. % % See also: UQ_PCE_DISPLAY, UQ_DISPLAY_UQ_METAMODEL %% Parameters N1d = 500; ...
function idx = simplemkinterleave(Ncbps) %-------------------------------------------------------------------------- % MKINTERLEAVE Make interleaver indices. % % IDX = SIMPLEMKINTERLEAVE(NCBPS) generates a vector to map NCBPS % bits according to the block interleaver described in % IEEE-802.11a. NCBPS i...
function [T, coeff, s, len] = getpoint(h, hext, th, mval) [y x] = find(hext == mval); y = y(1); x = x(1); s = mval; len = 1; coeff = {[y x; 0.5 0.5]}; T = myTrajRender(size(h), cellfun(@(x)fliplr(x).', coeff, 'UniformOutput', false)); T = T / sum(T(:));
function [] = BrainView(pos,nodedata,edgedata,varargin) % This function produces a 3D plot of brain data, given the 3D positions of % brain nodes and data values associated with each node. % REQUIRED INPUTS: "pos" : an nx3 matrix containing (x,y,z) coordinates for % each of n nodes % ...
function [ asset ] = update_SingleAsset( asset, indicator, indName ) %UPDATE_SINGLEASSET Summary of this function goes here % Detailed explanation goes here %% asset.tstypes = horzcat(asset.tstypes,{indName}); asset.data = horzcat(asset.data, indicator); asset.N = asset.N +1; end
A=input('Provide a word :','s'); A B=input('State the number of letters in the word'); count=0; for i=1:B x=A(i); x1=num2str(x); if x1(i)=='U'||x1(i)=='S' count=count+1; y(count)=x; end end count
% % LAB3 Ex.5 - DESAFIO clear all; close all; load('ecos_ultrassom.mat'); % % a) for i=1:size(ecos,1) [c{i},lag] = xcorr(pulse,ecos(i,:)); peaks{i} = findpeaks(c{i},'Minpeakheight',200); numpeaks(i) = length(peaks{i}); end % % b) m = min(numpeaks); % Número mínimo de reflexões em cada eco, ...
function rssi_per_together() scrsz = [ 1 1 1600 1200 ]; figure('Visible', 'off','Position',[1 scrsz(4) scrsz(3) scrsz(4)]) set(gcf,'paperpositionmode','auto'); set(gca,'fontsize',16); mycolor=colormap(lines(16)); lg={}; index=1; for filenum=1:15 sname=strcat( num2str(filenum), '_sender.dat'); rname...
function statsUnivariateMenu(~,~,fig) %statsUnivariateMenu - menu for drawing / displaying univariate results % Get the guidata sts = guidata(fig.fig); if isempty(sts) return end % Draw the window to help control the colours / groups / etc [window] = manipulateWindow(fig,sts); % Set the callback for the finish b...
% This demo uses the yeast data. % The data is already split into training and test set, and each set is % in the form of an input data matrix and a output labels vector. % Parameter selection and initial RLS estimation is carried out on a % first subset of the training set. % Recursive RLS is run on the remainder ...
% % AUTHOR: KWM % Comment: writing my own for loop for k=2:10 or so proved difficult, where % I ultimately gave up because starting at k=3 there were often a cluster % centroid with no data points that were closer to it than any other % centroid. This gave run time errors for empty variables and I didn't % want to sink...
function obj = addRunningCost(obj, func, deps, auxdata, load_path) % Add a running cost to the problem % % Parameters: % func: a symbolic function to be integrated @type SymFunction % deps: a list of dependent variables @type cellstr % auxdata: auxilary constant data to be feed in the function ...