text
stringlengths
8
6.12M
% Repeat string n times into an array struct function res = repeatstr(val, n) res = {}; for i=1:n res{i} = val; end
function [bb_struct] = bb2struct(bb) %-------------------------------------------------------------------------- % % Copyright (c) 2014 Jeffrey Byrne % %-------------------------------------------------------------------------- xmin = bb(:,1); ymin = bb(:,2); xmax = bb(:,3); ymax = bb(:,4); bb_struct.xmin = xmin; bb_...
% Confidence Intervals clear all; close all; clc; ylim([45, 90]); line([1 2],[88.11 88.11],'Color','r','LineWidth',2) hold on line([1 2],[84.71 84.71],'Color','r','LineWidth',2) hold on plot(1.5, 86.41, 'o', 'MarkerSize', 6, 'MarkerEdgeColor', 'r', 'LineWidth',2) hold on line([3 4],[77.15 77.15],'Color','r...
rng(mean('hyperalignment')); %% Plot left vs. right fields for both actual and predicted data data = Q; [~, ~, predicted_Q_mat] = predict_with_L_R([], data); out_predicted_Q_mat = set_withsubj_nan([], predicted_Q_mat); w_len = size(data{1}.left, 2); figure; set(gcf, 'Position', [395 524 1023 366]); datas = {Q, out_pr...
function no_red = no_reduction_f( ) %% Loading all given vectors load grass_vector.mat; load straw_vector.mat; load unknown_vector.mat; load unknown_file_names.mat; [rows col]=size(grass_vector); %% Output Structure file1='File_Name'; file2='No_Reduction_Output'; no_red=struct(file1,[],file2,[]); %% Mean and varia...
function [photon_path,scattering_x] = adjust_one_photon_path(photon_path,one_photon_path,scattering_x,phot) % ADJUST PHOTON_PATH if length(one_photon_path) < size(photon_path,1) one_photon_path = [one_photon_path; nan*ones(size(photon_path,1) - length(one_photon_path),1)]; elseif le...
function [f,power]=cnm_power_spectra(cfg, data) % compute power spectrum for data % cfg = configuration structure containing parameter for power spectrum % data = data structure from preprocessing % cfg.channels 'channels', 'all', 'MZ' for MEG central % 'ML' for MEG left % 'MR' for MEG r...
clear; %% Variables para modficiar %name= "Ejemplo1.csv"; name= "Prueba_04.csv"; [ALL]=table2array(readtable(name)); of=1000; %offset de toma de datos fin=length(ALL);%length(ALL); %% Programa con=0; [AA]=ALL(of:fin,1);%muestras [A]=ALL(of:fin,2); %tiempo [B]=ALL(of:fin,3); %Temperatura [C]=ALL(of:fin,4); %Humedad [D...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % NCK 보간전 가감속 / Version 1.0.1 / Yonsei % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 이찬영, 김성현, 이동열 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clc clear all % close all profile off; profile on; %% NCK 파라미터 global X_axis Y_axis Z_axis A_axis B_a...
warning('all', 'off'); close all; fileName = 'group23.jpg'; % startPoint = [549,399]; % endPoint =[731,524]; meanValue= [0, 0, 0]; % imtool(fileName); img = imread(fileName); % % for j = startPoint(1):endPoint(1) % for i = startPoint(2):endPoint(2) % meanValue(1) = meanValue(1) + img(i, j, 1); % ...
function [theta] = normalEqn(X, y) % regression using the normal equations. %theta = zeros(size(X, 2), 1); theta = pinv(X'*X)*X'* y; end
%model assumptions: % notation: N1, S2, E3, W4 for node directions N is north for example rpm = 466.67; %rotation per second i=0; cp = 1.996; %kJ/(kg*K) vol = zeros(100,100,100); %# of control volumes timerange = [0,100]; %seconds Pi = 0; %Pa Po = 101325*2; %Pa, assuming it is 2 atm at outlet....(guessed) P = linspace(...
%--- coordinate plot with respect to time % you need to define model.C_posn in order to work properly file= 'exa3_1'; load([ '2filter_',file,'.mat']); [X_track,k_birth,k_death]= extract_tracks(X,track_list,total_tracks); figure(1); clf; subplot(211); figure(2); clf; subplot(211); figure(3); clf; %--- plot true tra...
function [kernel_c1,kernel_f1] = init_kernel(layer_c1_num,layer_f1_num) % initial the convolutional kernel for n = 1:layer_c1_num kernel_c1(:,:,n) = (2*rand(5,5)-ones(5,5))/12; end for n = 1:layer_f1_num kernel_f1(:,:,n) = (2*rand(12,12)-ones(12,12)); end end
function Fpol = rec2pol(Frec) Fpol = [abs(Frec) angle(Frec)*180/pi];
function out = createRescaledImageFromRtDoses(rtDoses, refImage) %CREATERESCALEDIMAGEFROMRTDOSES creates rescaled image from an array of rtDose objects. % % image = createImageFromRtDose(rtDoses, refImage) creates a new image object for each RTDOSE % in the RtDose array on the refence spacing refImage and sums the pi...
%% generates samples from the true GP function y = sampleGP(xstar, covfunc, loghyper, MIN_NOISE) n = size(xstar,1); Ktilde = feval(covfunc, loghyper, xstar) + MIN_NOISE*eye(n); %z = randn(n,1); %y = chol(Ktilde)'*z; mu = zeros(n,1); y = sampleGauss(mu, Ktilde, 1); return;
close all; clear all; relative = 1; FieldSize = [ 15 15 ]; % cm MU = 400; % Location of cross profiles x_offset = 0; y_offset = 0; FilterRad = 10; BG_Dose = 0; %% % Load Heterogeneous Electrons % Middle of Heterogeneity Film_MU = 400; filename = 'W:\Private\Physics\21eX91 Validation - DJJ\Film Data for Validati...
%% Script Helga_szakdolgozat_tproba % % File: Helga_szakdolgozat_tproba.m % Directory: % Author: Peter Polcz (ppolcz@gmail.com) % % Created on 2018. March 25. % %% % Automatically generated stuff global SCOPE_DEPTH VERBOSE LATEX_EQNR SCOPE_DEPTH = 0; VERBOSE = 1; LATEX_EQNR = 0; try c = evalin('caller','p...
prob_offset{j} = cell2mat(importdata([fileSave{1} filesep 'prob_offset.mat'])); prob_onset_on_offset{j} = cell2mat(importdata([fileSave{1} filesep 'prob_OnsetOnOffset_online.mat'])); output_onset_on_offset{j} = importdata([fileSave{1} filesep 'output_OnsetOnOffset_online.mat']); output_offset{j} = importdata([fileSave...
%% 3-D Brain Tumor Segmentation Using Deep Learning % This example shows how to train a 3-D U-Net neural network and perform semantic % segmentation of brain tumors from 3-D medical images. The example shows how % to train a 3-D U-Net network and also provides a pretrained network. Use of % a CUDA-capable NVIDIA™ GP...
%{ Filter 1 - Part 1 : apply 1-D median filter on noisy gray scale image using "medfilt1" bulit-in function ------------------------------------------------------------------------- Authors : Hadis Ahmadian - 9622613 Maede Shamirzaei - 9629743 Hamidreza Moalem - 9635593 %} clc...
function [m3,n3]=floatingpoint_add(m1,n1,m2,n2) %make sure inputs are integers m1=int32(m1); n1=int32(n1); m2=int32(m2); n2=int32(n2); while n1>n2 m2=idivide(m2,int32(10)); n2=n2+1; end while n2>n1 m1=idivide(m1,int32(10)); n1=n1+1; end m3=m1+m...
function calibrationCoeffs = generateNaiveCalibrationCoeffs(rangingData, varargin) %calibrationCoeffs = generateNaiveCalibrationCoeffs(rangingData, varargin) % %this function uses the data in rangingData to calculate calibration %coefficients for each sounder/microphone. It does this by choosing %parameters for ...
clear; clc; close all; % Aluno: Cesar Vinicius Zuge % Prova 2 de PDS %-------------------------------------------------------------------------- % A) Fs = 8000; F1 = 1000; F2 = 2000; F3 = 3000; n1 = 0:(Fs*2-1); n2 = 0:(Fs*3-1); n3 = 0:(Fs*5-1); n = 0:(Fs*10-1); x1 = cos(2*pi*(F1/Fs).*n1); x2 = cos(...
function [fitProbC,fitThresh,fitParams] = PALweibullFit(levels,probC,probThresh,numTrials,fitLevels) % PALWEIBULLFIT % % [fitProbC, fitThresh, fitParams] = PALweibullFit(levels,probC,probThresh,numTrials,fitLevels) % % Fits a cumulative Weibull to the (levels,probC) data. Returns the threshold at % the probThresh va...
function def = HData( ) % HData Default options for the HData class. % % Backend IRIS function. % No help provided. % -IRIS Macroeconomic Modeling Toolbox. % -Copyright (c) 2007-2017 IRIS Solutions Team. %-------------------------------------------------------------------------- def = struct( ); def.h...
%% Gradient Calculator % Initialize cost = 0; structure = variables; change = zeros(1,len); untrained_val = 0; trained_val = 0; % Calculate the chain rule derivative for the gradient calculation gradient_chain_calc; % Derive wrt alpha and beta change_alpha = - log(((alpha*sum_trained*prop_vec(l) + sum_untrained*(pro...
clc;clear; % measurements deflec=[0.020 0.0185 0.0181 0.0178 0.0175 0.0173]; dV_read= [0.56 0.53 0.51 0.50 0.49 0.48]; % constants I=2.083e-12; t = 1e-3; l = 0.255; Vs = 5; gain = 560; strain = 3.*deflec*t/(2*l^2); dV = dV_read./gain; r = 4.*dV./(Vs-2.*dV); K = r./strain; mean_K = mean(K)*ones(1,length(K)); plot(...
%% Creating the dataset in Q1 X=[2.5 2.4; 0.5 0.7;2.2 2.9; 1.9 2.2; 3.1 3.0; 2.3 2.7; 2.0 1.6; 1.0 1.1; 1.5 1.6; 1.1 0.9]; %% Calculating the new space meanX=mean(X); meanX=repmat(meanX,[length(X) 1]); D=(X-meanX)'; S=D*D'; [V,~]=eig(S); e1=V(:,1)'; %Row vector e2=V(:,2)'; %Row vector E=[e1;e2]; %Each row is an eig...
% ADVISOR data file: ESS_PB54_14V_saber.m % % Data source: % % % Data confirmation: % % Notes: % These parameters are used in the Saber lead acid battery % % Created on: 08-March-2002 % By: AB, NREL, aaron_brooker@nrel.gov % % Revision history at end of file. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
WP(1,1) = RES(1,1); WP(1,2) = RES(1,2); flag = 0; for iter = 1 : 1000 for n = 1 : length(RES) if ((RES(n,1) == WP(iter,1)) && (RES(n,2) == WP(iter,2)+range)) && (RES(n,3) == 0) WP(iter+1,1) = RES(n,1); WP(iter+1,2) = RES(n,2); flag = 1; RES(n,3) = 1...
function buildSFun(ecalPath) arguments ecalPath {mustBeFolder} = {}; end proj = currentProject; projFolder = proj.RootFolder; incPath = {}; libPath = {}; cmexsfcnList = {'s_ecal_subscriber.cpp','s_ecal_publisher.cpp'}; cmexcommonList = {'s_ecal_common.cpp'}; % Search eCAL path for Windows if is...
function [clarity, pfMat] = frame2clarity(frameMat, fs, pfType, pfMethod, plotOpt); % frame2clarity: Frame (or frame matrix) to clarity % % Usage: % [clarity, pf] = frame2clarity(frameMat, fs, pfType, pfMethod, plotOpt); % frameMat: a column vector of a frame, or a matrix where each column is a frame % fs: samplin...
function JBodyL = ContactJacobianL(s1,phi1,theta,s2,phi2,x1,y1,g,k1,k2,L_sp0,L_mB,mB,IB,m2) %CONTACTJACOBIANL % JBODYL = CONTACTJACOBIANL(S1,PHI1,THETA,S2,PHI2,X1,Y1,G,K1,K2,L_SP0,L_MB,MB,IB,M2) % This function was generated by the Symbolic Math Toolbox version 7.1. % 14-Jan-2017 01:29:06 t2 = phi1-theta; t3...
function [mu,sigma] = statsAB(n,Nab) % for use with Rand z-score calculation from Traud, Kelsic, Mucha, & Porter 2010. % gives mean and standard deviation of Wab under null model used in paper % (which preserves row&column sums, i.e. number and size of communities in % each partition. % INPUTS: n (number of nodes) % ...
function [chars] = SourceB(type) alphabet = ['a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z']; fileID = fopen('kwords.txt','r'); chars = fscanf(fileID,'%s'); if type == 2 new_alphabet = [] a =1; for i=1:26 for j=1:26 ...
clc clear all close all %% Filtering x % We have the audio signal x, and % we filter through H(z)=B(z)/A(z), obtaining y [x, Fs]=audioread('Toms_diner_16.wav'); b=[1, -1.5173, -0.0121, 0.7863, 0.1440]; a=[1. 0, 0.5 0 0.24, 0, 0.12]; y=filter(b,a,x); %% what kind of filter is H? % make some plots and ...
%plot each family colors=['r-';'go';'b*';'kx';'m.'] figure; names={'en_roc','roc_1','roc_2'}; titles={'ensemble centroid','biggest centroid','2nd biggest centroid'}; for i=1:3 name=names{i}; eval(['cd ',name]); subplot(2,2,i) axis([0.3 1 0.2 1]) for ii=2:2:10 hold on a=load([num2str(ii) '.roc']); plot([a(1:8,2);a(end,2...
clear;clc;close all; x_bar = [1.1, 1.35, 1.25, 1.05]; one = ones(1,4); sigma = [0.2, -0.2, -.12, .02; -.2, 1.4, 0.02, 0; -.12, 0.02, 1, -.4;0.02,0,-.4, 0.2]; R_min = 1.00:0.05:1.35; risk = zeros(length(R_min),1); Portfolios = []; for i=1:length(R_min) r_min = R_min(i); n =4; cvx_begin quiet variable p(n) ...
classdef range < irisinp.generic properties ReportName = 'Date Range'; Value = NaN; Omitted = @error; ValidFn = @(x) isdatrange(x); end methods function this = preprocess(this,~) if ischar(this.Value) this.Value = textinp2dat(this.Val...
function createVideoFromSimulationFile( ) %ds filepath strFilepath = '../bin/simulation.txt'; %ds open the file fileID = fopen( strFilepath ); %ds get the first line cCell = textscan( fileID, '%u %u', 1 ); %ds get number of particles N and timesteps T uNumberOfParticles = cCell{1}; uNumberOfTimesteps = cCell{2}; %...
function simulate_fall alpha = pi/4; r = 1; m = 1; x0 = [1 5 0 0]'; h = 0.01; N = 150; sys1 = ContactImplicitSystem(@()ball_trough(alpha, r, m), 'ball'); sys1 = sys1.addVisualizer(@(x) ball_trough_visual(x, alpha, r)); [t, x] = sys1.simulate(0.01, N, x0, true, 4); %qx = x(1,:); %qy = x(2,:); %figure(1); %plot(qx, qy...
function [u, v, hitMap] = opticalFlow(I1, I2, windowSize, tau) %I1= imread('data/corridor/bt.000.png'); %I1=(rgb2gray(I1)); img = im2double(I1); %I2 = imread('data/corridor/bt.001.png'); %I2=(rgb2gray(I2)); im2 = im2double(I2); %tau =1.38; % Compute a gaussian kernel sigma = 1; %windowSize = 100; gaussianWidth = 3*sigm...
function matEvaluateARK232( obj ) [EXa, IMa, EXb, IMb, c] = GetRKParamter(); time = obj.startTime; ftime = obj.finalTime; fphys2d = obj.fphys2d; fphys = obj.fphys; %> allocate space for the rhs to be stored ExplicitRHS2d = zeros(obj.mesh2d(1).cell.Np, obj.mesh2d(1).K,3); ExplicitRHS3d = zeros(obj.meshUnion(1).cell.Np,...
%[RMSE, maxPctDiff, maxError, RMSEsamples, trueMean, sampleMeans, waveNum] = sampleSpectra_decMult(swFile, lwFile, nSamples, nSimulations, useSW, useLW, lwHiRes, allSky, latRange, lonRange) %Uses MCMC integration to estimate the spectral mean for a given set of %MODTRAN data by randomly sampling spectra from latitude a...
fid = fopen('notmoving3corners2.2.txt'); nument = 0; tline = fgetl(fid); while ischar(tline) matches = strfind(tline, '<<<'); num = length(matches); if num > 0 nument = nument + num; %fprintf(1,'%d:%s\n',num,tline); end tline = fgetl(fid); end frewind(fid); Planedata = cell([1,nument]); f...
%{ common.OpticalMovie (manual) # intrinsic imaging movie$ -> common.OpticalSession opt_movie : smallint # optical movie id within the optical session --- purpose=null : enum('structure','stimulus','bar') # purpose of movie filename : varchar(255) #...
clear clc % global alpha beta global Mot_I; %%Configuration Parameters Vmax=1000; AcelT=0.4; DcelT=0.4; %%Variables de entrada alpha=[0 0 45 0 0 0 0 0]; %Direccion de maxima pendiente beta=[0 0 0 0 0 0 0 0]; %Angulo de giro delete(instrfindall); Arduino = serial("COM16",'BaudRate',115200); s...
function CC_select_var(varargin) H=varargin{1}; handles=guidata(H); var=varargin{3}; value=get(H,'value'); eval(['handles.var' num2str(var) '=value;']) %%% Rescale axis P=handles.spikeMatrix(:,3+value); maxval=max(abs(P));Range=[-maxval maxval]*1.5; if var==1 set(handles.figure_handles(1),'Xlim',Range...
% clear;clc; %load align wave [x_talk fs] = audioread('t1.wav'); [x_sing fs] = audioread('s1.wav'); % x_sing = x_sing(10000:14000); len = min(length(x_sing),length(x_talk)); x_sing = x_sing(1:len); x_talk = x_talk(1:len); param.hop = 1; param.sr = fs; [feat,t] = yin_best(x_sing,param); %get freq_tbl f0 = feat.f0; % ...
nT = 100; ISI = 1; DAQ = InitializeDAQ; tstim_max_noise_exp = 3; t_stim_noise_exp = 0:(1/DAQ.s3.Rate):tstim_max_noise_exp; for iT=1:nT if DAQ.s3.ScansQueued <=3 sigOut = zeros(length(t_stim_noise_exp),1); ix = 1:length(sigOut); switch ISI case 1 sigOut(ix...
aparam=2; % 设置参数 for i=1:fn Sp = abs(fft(y(:,i))); % FFT变换取幅值 Sp = Sp(1:wlen/2+1); % 只取正频率部分 Esum(i) = log10(1+sum(Sp.*Sp)/aparam); % 计算对数能量值 prob = Sp/(sum(Sp)); % 计算概率 H(i) = -sum(prob.*log(prob+eps)); % 求...
%See http://www.cse.msu.edu/prip/Files/DubuissonJain.pdf %to see notations and d1 distance %h is the hausdorff distance h function d = Hf2(A, B, h) d1 = h(A, B); d2 = h(B, A); d = max(d1, d2); end
% This script draws time-averaged profiles of zonal flow drives % versus time1 % Copy this script to the folder of the data and then run it clear; close all; global den Te pe vi jz ve phi vEx vEy dt inv_nustar load('parameters.mat'); addpath(code_path); last_file = get_last_file('./'); last_diag = str2num(last_fil...
function [ fphys ] = matEvaluateLimiter( obj, fphys ) [ fphys ] = obj.limiterSolver.apply( obj, fphys ); end
function [endPos, prevPathRows, prevPathCols] = BestPosition(startPos,grid) % This function determines the best path that can be travelled with the % minimum cost, from the starting position to anywhere on the eastern edge. % Instead of using Greedy Pick method, this function evaluates all possible % paths and dete...
function [f,J]=quad_equal_const(V,B,d,z) V=V(:); n=length(d); f=zeros(n,1); for i=1:1:n f(i)=V'*B{i}*V+V'*d{i}+z{i}; end % computing the jacobian J=zeros(n,length(V)); for i=1:1:n J(i,:)=(B{i}+B{i}')*V+d{i}; end
function [f,P1] = T2F(X,Fs) %输出f频率轴,P1DFT变换后序列 输入X为采集序列,Fs为采样频率 %[f,P1] = T2F(X,Fs) 输出的频谱为复数,如果画功率谱记得进一步运算 L = length(X); P2 = fft(X); P1 = fftshift(P2); f = (-L/2:L/2-1)*Fs/L; end
%% node2control.m % % Function that returns the coordinates of the control points of the curve % (spline parametrization), given the node points (Bezier). % % Matthieu Guerquin-Kern, Biomedical Imaging Group / EPF Lausanne, % 23-07-2009 (dd-mm-yyyy) function control = node2control(node,shift) if nargin<2 shift = ...
function [ difference ] = GaussianAs1D(w,s) % Genarates 2 1D gaussian and convolves with an image. % Convolves 2D gaussian kernel with the same image and compares it with the % above result. img = imread('hw1_images\lena.bmp'); X = 1:w; for i = 1:w X(i) = exp(-((i-(w+1)/2)^2)/(2*s^2)); end X = X/sum(X...
function x = stop_dist_calc(v0, a0, s) % calculate -s time t2 = sqrt(v0 / s + 0.5 * a0^2 / s^2); % calculate -s time t1 = t2 + a0 / s; if (t1 < 0 || t2 < 0) s = -s; t2 = sqrt(v0 / s + 0.5 * a0^2 / s^2); % calculate -s time t1 = t2 + a0 / s; % calculate -s time end % calculate t1 end point condition ...
function x = frobinnerproduct( A,B ) x = sum(sum(A.*B)); end
function varargout = configure_window(varargin) % CONFIGURE_WINDOW MATLAB code for configure_window.fig % CONFIGURE_WINDOW, by itself, creates a new CONFIGURE_WINDOW or raises the existing % singleton*. % % H = CONFIGURE_WINDOW returns the handle to a new CONFIGURE_WINDOW or the handle to % the exis...
% This function takes as its inputs coefficient matrix ('coeffs'), % a matrix of exponents ('exps'), and a 'facet_rule'. It returns a matrix of coefficients %where all columns corresponding to elements of 'exps' where the only nonzero elements correspond to %'facet_rule' are removed. % %Details: %Inputs: %Coef...
function dGrf_heel_c3_q2 = dGrf_heel_c3_q2(in1,in2,s) %DGRF_HEEL_C3_Q2 % DGRF_HEEL_C3_Q2 = DGRF_HEEL_C3_Q2(IN1,IN2,S) % This function was generated by the Symbolic Math Toolbox version 8.4. % 06-Jul-2020 22:18:20 q1 = in1(:,1); q2 = in1(:,2); q3 = in1(:,3); q4 = in1(:,4); q5 = in1(:,5); q6 = in1(:,6); t2 = c...
function [ret]=Fun2(vector) len = length(vector); if len==1 ret = vector; else Part1 = vector(1:floor(len/2)); Part2 = vector(floor(len/2)+1:end); %ret = Gun(Part1) + Hun(Part2); %ret = Hun(Part1) + Hun(Part2); %ret = Gun(Part1) + Gun(Part2); ret = [Fun2(Part1) Fun2(Part2)]; ret = ...
function [elbo grad] = regvarbayes_elbo(y, ptr_kl, ptr_elike, ptr_reg, ... ptr_fwd, prior_param, like_param, ... post_param, fwd_param, reg_param ) % Regularized Variational Bayes evidence lower bound % ptr_kl: pointer to KL(q||p) % ptr_lik...
function merge_t = all_feature(mp3_dir, midi_dir) mp3_list = py.os.listdir(mp3_dir); midi_list = py.os.listdir(midi_dir); N = length(mp3_list); for i = 1:N mp3_fname = mp3_list(i); mp3_fname = mp3_fname{1}; mp3_fpath = py.os.path.join(mp3_dir, mp3_fname); mp3 = char(mp3_f...
% ECE 273 - Convex Optimization and Applications % Final Project - On Convex Optimization and Support Vector Machines % By: Arkin Gupta, Andrew Gates % % This program is designed to run SVM on a pseudo random generated set of % data using CVX. It will use CVX to calculate the separating hyperplane as % well as the ...
clear load('data\xi_LH.mat') load('data\xi_SH.mat') load('data\eta_LH.mat') load('data\eta_SH.mat') load('data\sgm0_LH.mat') load('data\sgm0_SH.mat') load('data\adhd.mat') load('data\adhd_new.mat') load('data\age.mat') Mode = 'Spearman'; X = [xi_LH]; % xi_SH eta_LH eta_SH sgm0_LH sgm0_SH]; Y = a...
function [imu, state, pose, frame] = readRFBag(bagpath) %READBAG Extracts messages into matrices without using custom msg defn % Data is in FRD frame = 'FRD'; bag = rosbag(bagpath); % Get IMU messages bagsel = select(bag, 'Topic', '/imu/data'); %'interpolate_imu/imu' msgs = readMessages(bagsel,'DataFormat','struct')...
function splot(searchString,xvect,yvect,varargin) % Plots struct.(xvect) vs struct.(yvect) for all structures containing % searchString in their name. if xvect and yvect have length one, all % values will be plotted as one. % % Varargin can specify a color map % e.g. % RGB fade: % splot('PKDynamic', 'Field', 'Kerr', ...
function d_new_350 = boxplot_normalize_A9_350(d_new) d_new(1:350) = boxplot_normalize(d_new(1:350)); d_new(351:650) = boxplot_normalize(d_new(351:650)); d_new(651:950) = boxplot_normalize(d_new(651:950)); d_new(951:end) = boxplot_normalize(d_new(951:end)); d_new_350 = d_new(3:end);
function Covariance(N) % Discrete time Kalman filter for position estimation of a Newtonian system. % This example illustrates the effectiveness of the Kalman filter for state % estimation. It also shows how the variance of the estimation error % propagates between time steps and decreases as each measurement is...
c=Circuit(); c.AddResistor(241,1,3); c.AddResistor(412,2,1); c.AddResistor(912,3,2); c.SetGround(3); c.MakeEquations();
function [J, theta1_grad, theta2_grad] = costFunction(theta1, theta2, x, y, lambda) % コストファンクションの実装 % コストと次のthetaの計算に使うgradをかえす % X 9 * 500 => biasとして1を追加するので 10 * 500 またきちんと並べ替えて 10 * 500でやる % y 9 * 500 % theta1 15 * 9 => biasの分 15 * 10 % theta2 9 * 15 => biasの分 9 * 16 J = 0; theta1_grad = zeros(size(theta1)); theta2_...
function RefreshGUI(obj) % % Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences % mail4ywu@gmail.com/mail4ywu@icloud.com handles = obj.uihandles; if isempty(handles) return; end set(handles.xsliceax,'Visible','off'); set(handles.ysliceax,'Visible','off'); set(...
% bal.m % Uses the results developed by gui_post_process.m to compare energy input to % losses. Displays imbalance in kJ. % collect inputs input_kj=0; if ~isnan(fuel_in_kj) input_kj=input_kj+fuel_in_kj; end if exist('ess_stored_kj') & ~isnan('ess_stored_kj') input_kj=input_kj-ess_stored_kj; end % collect losse...
classdef COPdataSet < matlab.System % Raw data path for FileInput object %This object holds the two x and y data sets and creates the transverse %data set "Hypot" %AP and ML are the X and Y coordinate sets respectively,Hypot is the %data set calculated as the length of the hypotenuse formed fro...
function [A,x] = hw4p5(k) % generalized function for creating k length long trusses % calculate dimensions of the matrix: dimension = 8 * (k-1) + 13 d = 8 * (k-1) + 13; % a = sin(pi/4) alpha = sqrt(2)/2; % initialize Ax=b A = sparse(d,d); x = zeros(d,1); b = zeros(d,1); % create the first 4 force equations for the ...
function [theta freq phase] = Synchronize_V2( Signal, training, Q) %SYNCHRONIZE Use cyclic prefix to find timing and frequency offset % %Input %SIGNAL - the entire modulated signal %N - the nr of data symbols per frame %L - the length of the cyclic prefix, in symbols %Q - the length of the pulse %Output %THETA - eleme...
function [images] = loadPedestrian() foldername = './pedestrian/'; addpath(foldername); Files=dir(foldername); images = []; for k=3:length(Files) filename = Files(k).name; % filename = foldername + fieldnames; image = imread(filename); if size(image,3)>1 image = rgb2gray(image); end vect...
function [EEG] = VpixxEarlyTriggerFix(EEG) %adds 6 ms to every trigger time in order to account for the delay between %the trigger and the pixel onset in the top left corner (could always add %more time to account for the delay until the stimulus pixel is %illuminated) for i_event = 1:lengt...
function [W_significant network_load components] = prune_insignificant_links(W_observed,W_ALL,X_hist,alpha) Wsize = size(W_observed); days = Wsize(3); N = Wsize(1); simulations = length(W_ALL); W_significant = zeros(Wsize); network_load = zeros(days,1); components = zeros(days,1); for day=1:days %% LINK-SPE...
display('----------Ejercicio 3-----------'); %si se quiere correr solo, correr loadData y utils corr_temp = []; gcc_sin_ventaneo = []; for k = 1:4 % recorremos los audios %correlacion cruzada tau = utils.tau_correlacion_cruzada(mics(:,k),mics(:,k+1),fs); corr_temp = [corr_temp tau]; %gccphat tau...
function [ converted ] = util_escape_string( inputs ) %UTIL_ESCAPE_STRING Convert escape sequence into string % We just replace '\' into '\\' % % Created on Aug/17/2010 By Pu Jiangbo % Britton Chance Center for Biomedical Photonics converted = strrep(inputs, '\', '\\'); end
% 距离+角度测量,使用间接测量量进行相对导航 disp(strcat('Simulation Start:',datestr(clock))); clear close all load leo20 %% filter rou_error = 10/1000/3; % 距离测量误差 angle_error = 0.05*rad/3; % 角度测量误差 atti_error = 0.05*rad/3; % 姿态控制误差 atti_measure_error = 0.005*rad/3; % 姿态测量误差 realtime = 0; rou = zeros(length(t),1); alpha = zeros(leng...
%% shstat_taxa % plots statistics and/or parameters for a taxon as function of taxonomic distance function [Hfig Hleg val entries missing] = shstat_taxa(vars, legend, label_title, Hfig) % created 2017/04/22 by Bas Kooijman %% Syntax % [Hfig val entries] = <../shstat_taxa.m *shstat_taxa*>(vars, legend, label_title, H...
function c = mfcc(s, fs) % MFCC Calculate the mel frequencey cepstrum coefficients (MFCC) of a signal % Inputs: % s : speech signal % fs : sample rate in Hz % Outputs: % c : MFCC output, each column contains the MFCC's for one speech frame N = 256; M=100; win_frames = zeros...
% Jiaxin Cindy Tu 20190423 % Strait et al. 2015 Fig 3B sliding window function [significance,selectivity]=calc_tuning_slidwind(data) if ~exist('spikeBinMs','var') spikeBinMs = 10; end sigma = 20*spikeBinMs; % ms gaussian smoothing kernel wind = -15:15; % 310 ms window plot_t = 16:5:385; x = [-100:299]; event_ts =...
function iid = prueba_portmanteau(data) aut=xcorr(data); alfa=.05; % stem(1:length(aut),aut); % hold on % plot(1:length(aut),1.96/sqrt(length(data))*ones(length(aut),1),'r-'); [maxaut idx]=max(aut); Q=length(data)*sum((aut(idx+1:end)./maxaut).^2); if Q>chi2inv(1-alfa,length(data)) iid=0; else i...
function Pn = sympoly2polyn(sp) % sympoly2polyn: converts a sympoly to something that polyvaln can evaluate efficiently % usage: Pn = sympoly2polyn(sp) % % arguments: (input) % sp - any sympoly object, as created by the sympoly toolbox % % arguments: (output) % Pn - a struct that polyvaln can use % % Example: % sym...
classdef MatrixFunctions % Also see the class MatrixTransformers. methods(Static=true) function [sumAlongRows, sumAlongColumns] = getRowColSums(A) sumAlongRows = sum(A, 1); sumAlongColumns = sum(A, 2); end function [sumGraphs] = plotRowColSums(A) sumGraphs = figure; [sumAlongRows, sumAlongColumns] = Ma...
%-------------------------------------------------------------------------- % open appropriate files, do basic analysis and create arrays that % are ready to be plotted. % % source strings for the data are defined in cf_tdtlw_4pan.m % % figures are made in cf_tdtlw_4pan.m % % levi silvers ...
filename='C:\Users\15 ek00004nl\Desktop\Trapano ML\Acquisizioni con accelerometri\15_01\FORZA\5\V1.txt' F15 = import_forces(filename); save F15 filename='C:\Users\15 ek00004nl\Desktop\Trapano ML\Acquisizioni con accelerometri\15_01\FORZA\5\V2.txt' F25 = import_forces(filename); save F25 filename='C:\Users\15 ek00004nl\...
% omitoption =1 % omit any set of data that has all zero function [result] = stat_combine_mat(MatData,dimention,omitoption,savematdata) totalnum=size(MatData); if dimention==1 checkdimention=2; elseif dimention==2 checkdimention=1; else error ('choose dimention between 1 or 2)') end % omit,...
function glmb_out= prune(glmb_in,filter) %prune components with weights lower than specified threshold idxkeep= find(glmb_in.w > filter.hyp_threshold); glmb_out.tt= glmb_in.tt; glmb_out.w= glmb_in.w(idxkeep); glmb_out.I= glmb_in.I(idxkeep); glmb_out.n= glmb_in.n(idxkeep); glmb_out.w= glmb_out.w/sum(glmb_out.w); for ca...
function [lee_h, lee_v] = lvp_lee(img, block_size) if size(img,3) == 3 % % Check if the input image is grayscale img = rgb2gray(img); end [m, n] = size(img); l= floor(m/block_size); l2= floor(n/block_size); l = l * l; l2 = l2 * l2; sizeX = m/sqrt(l); sizeY = n/sqrt(l2); while( (sizeX - floor(size...
function [varargout] = CanLoad(filepath,varargin) % CanLoad -- Loads a CANalyzer Data file into a Matlab Structure % % CONFIDENTIAL FORD MOTOR COMPANY (see notice in .m source file) % % USAGE: % [cancel_button,test_name,can] = CanLoad(full_name) % % DESCRIPTION: % Uses the Common Open Dialog Box to load a CANAly...