text
stringlengths
8
6.12M
function out = MAUC (TrueTestLabels,labels,predProbs) c = length(labels); % Number of classes t =1; for i=1:c for j=i+1:c positiveC = i; prob = predProbs(:,positiveC); ind1 = find(TrueTestLabels==i); % index of positive class ind2 = find(TrueTestLabels==j); % index of ne...
function [y] = ros(x) if length(x) ~= 2 error("Wrong dimension") else y = 100 * (x(2) - x(1)^2)^2 + (1 - x(1))^2; end end
function [imgGS] = convertRGBtoGrayscale_student(imgRGB) % Get the size of the input image [rows, cols, channels] = size(imgRGB) % Create an empty matrix for the new greyscale image imgGS = zeros(rows,cols); for i = 1:rows for j = 1:cols % Your logic goes in here % greyscale value = 0.2989 * R ...
function [Mbc] = bias_cr_seas(Od,Md) %BIAS_CR_SEAS Bias corrects the model input according to the given % observational data. Bias correction happens for the seasonal cycle % [Mbc] = bias_cr_seas(Od,Md) % Where % Od[space,time] = observational data % Md[space,time] = model data (to be corrected) % % ...
function [fre, amp] = fft_prec(t, x, f1, f2, df) % fft_prec(t, x, f1, f2, df) % % Do fourier transformation of x(t) in range f1..f2 with step df. j=1; for f = f1 : df : f2 amp(j) = sum(x .* (cos(2.0*pi*f*t) - sin(2.0*pi*f*t) * i)) * 2.0/(length(t)-1); fre(j) = f; j=j+1; end end
% A script for calculating the absorption and reflection coefficients of an ensemble of core-shell nanoparticles % These models only work for particles that are much smaller than the % incident wavelength (less than 50 nm diameter for visible light) % 25.3.2020 Mikko Kataja % Details of the particles r_core = ...
%% Example script for annotation of spectral data. % For instructions and a guide, please refer to the documentation available % here: % Initial annotation [lm,ass] = annotateMZ(op.cmz,... 'Polarity','negative',... 'Adduct',{'M-H','M+Cl'},... 'Tolerance',10,... 'Database','luisa'); %% Exporting the a...
% Air/Physical properties bar = 1e5; k = 1.4; cp = 1000; R = 8.3144/(28.9647e-3); % Given values m_cor = 54.4; pp_total = 23; n_ad = 0.86; n_pl = 0.906; T01 = 304.8; P01 = 0.60496*bar; % Real mass flow rate, stage number and stage pressure ratio m = m_cor*(P01/101325)/sqrt(T01/288.15); n_stages = ceil(9*log(pp_total)...
%{ spinVis.m Ashley Dale Visualizes a spin lattice %} function leg = spinVis(spinD) [m, n, p] = size(spinD); %Set colors spins = spinD; %threshold spin lattice %find where the spins=1, set these spins equal to 10 mask_HS = (spins == 1); spins(mask_HS) = 10; color10 = [1,0,1]; %find where 0.75<spins<1, set these sp...
function f=dspchi3(x1,y1,x2,y2,sig1,sig2) % function f=dspchi3(x1,y1,x2,y2,sig1,sig2) % f=[x0 x1 x2], x0=b1, x1=b2, x2=a for b+ax % calculates slopes for isosceles triangle for brewer dsp. % sig1 sig2 are uncertainities. % 5 3 98 julian gives same result as fmins(dspchi2) if nargin<6,sig2=[];end if nargin<5,...
%% Extraction of Impedance data from the Brain Vision .txt files % clc, clear all, close all % for calling helper functions addpath(genpath('\\bmi-nas-01\Contreras-UH\Infantdata\Infantdata\code\Zachs_Infant_decoding_files')) tic; %% Annotation for Infant Data files = dir('\\bmi-nas-01\Contreras-UH\Infantdata...
%% MMSP2 - Lab 2 % Exercise 3 - Scalar quantization clearvars close all clc %% 1) Suppose that you are sampling the output of a sensor at 10 kHz for 10 seconds. %% Quantize the output with a uniform quantizer at 10 bit per sample. %% Assume that the pdf of the signal is gaussian with mean 0 V and variance 4 V^...
function [diff_coeff,o_sig,o_amps,centers,base_level,o_weigth,o_t0,o_dimens,res] = diff_fit_routine(img,timestamps,parameters) % input: img - image stack, timestamps - time signatures of images, % parameters - parameters for fitting % output: diff_coeff - calculated diffusion coefficient, o_sig - calculated % sigma...
clc clear all close all %in degrees, sin(60)=0.86602540378 sin60deg=0.86602540378; centerbx=0; centerby=0; centerpx=0; centerpy=0; rotationp=0; %given dimensions LAb=290; LBb=290; LCb=290; LAp=130; LBp=130; LCp=130; Al1=170; Bl1=170; Cl1=170; Al2=130; Bl2=130; Cl2=130; bb=2*LAb*sin60deg; bp=2*LAp*sin60deg; lbb=sqr...
function Xlr = solve_Xlr(y,Xl,D,G,Wl_old,Wr_old,Xr_bar_total,Xlrold,lambda3,lambda4,lambda5) %minimize sum||yhat - Xlr*Wlr|| + lambda3 * 1/D* %sum_{i<j}||Xlr_total(i,:) -Xlr_total(j,:)||_{2} + lambda4*||Xlr_total - Xr_bar_total||_{F} r = length(y); n = length(y{1}); dr =...
function imPxv = stackToPxv(imStack) % STACK TO PIXEL VECTORS: Turn a stack of images X * Y * C * F into a set of % flattened image vectors, respecting category boundaries, (X*Y) * C * F. % % Inputs: % imStack - a stack of images X pixels * Y pixels * C categories* F frames % % Outputs: % imLinear - a matrix (X * Y...
classdef batteryTypeSelection < int32 % Battery type selection definition. % % Copyright 2020 The MathWorks, Inc. % enumeration Pouch (1) Can (2) CompactCylindrical (3) RegularCylindrical (4) end methods(Static) function map = display...
function [intervals, point_cloud] = BC_compute_intervals(image, max_dimension, num_divisions, num_landmark_points, nu, threshold, init_MFV, max_stream_size, show_messages) %BC_compute_intervals Computes Betti intervals given an image % Default values: % max_dimension = 3 % num_divisions = 10 % num_l...
%============================================================== % FileName: get_org_wei.m % Description: Get original gauss weight in 12 gauss integral points % Author: Changhao Li % Date created: 18 Jul 2017 % Version: 1.00 % Date last revised: 18 Jul 2017 % Revised by: Changhao Li %===========================...
function test_costfunction_forums () epsilon = 1e-4; % CTA Colin Beckingham % https://class.coursera.org/ml-005/forum/thread?thread_id=943#post-4641 [J grad] = costFunction([0 1 0]', magic(3), [1 2 3]'); assert( J, -7.5600, epsilon ); assert( grad, [-4.3907 -7.7678 -4.2202]', epsilon); % Me - non-squar...
speed_kps = 300000 year_sec = 365 * 24 * 60 * 60 lightyear_km = speed_kps * year_sec earth_to_sun_km = 150e6 earth_to_sun_sec = earth_to_sun_km/speed_kps earth_to_sun_minute = earth_to_sun_sec/60
function [ u ] = Step( x ) u= 0 * x; u(x >= 0) = 1; end
function [results] = fast_reg_old(wfs) num_clust = size(wfs,1); fs = 30000; for jj = 1:num_clust wf = []; wf = wfs(jj,:); [~,ix_abs_max] = max(abs(wf)); %Find ix of the maximum abs value if wf(ix_abs_max)<0 wf = -wf; %If the max is negative, invert the spike end [peak_val,ix_peak] = max(...
%% SpectrHomemade Function function SpectrHomemade(Signal_1,Signal_2,Fps_1,Fps_2,WindowSecond_1,WindowSecond_2) hold off; Length_1= size(Signal_1,2); %Number of frame in the signal WindowFrame_1=ceil(Fps_1*WindowSecond_1); %Size of window, in frames Overlap_1=0; %Size of overlap, in seconds (not yet implemented) nWind...
clear;clc; Data = csvread('Q1.csv'); X = Data(:,1:2); label = Data(:,3); classminus = X(label==-1,:); classplus = X(label==1,:); %% Data Test and Train X_test = X(1:0.1*size(X,1),:); label_test = label(1:0.1*size(X,1),:); X_train = X(0.1*size(X,1)+1:end,:); label_train = label(0.1*size(X,1)+1:end,:); % forest = Tree...
function [FNN] = fcnFNN(x,tao,mmax,rtol,atol) %x : time series %tao : time delay %mmax : maximum embedding dimension %reference:M. B. Kennel, R. Brown, and H. D. I. Abarbanel, Determining %embedding dimension for phase-space reconstruction using a geometrical %construction, Phys. Rev. A 45, 3403 (1992). %autho...
function demoQuadBowl(x)
%% Function Name: clockHands % % Test Cases: [out1, out2] = clockHands(6, 45, 10); [out1_soln, out2_soln] = clockHands_soln(6, 45, 10); match1a = isequal(out1, out1_soln); match1b = isequal(out2, out2_soln); match1 = match1a & match1b; [out3, out4] = clockHands(4, 45, -30); [out3_soln, out4_soln] = clockHands_soln(4, ...
clear all clc simming = 1; a=1; b=0; p=0; w_1=pi/5; w=pi/5; window=[-10 10 -1 1]; init_x_p=-9.9; init_x_p_dot=1; %{ %----alpha, beta, gamma motion generation------- simtime=0.55; sim 'abg_x_p1.slx' %plotting proposed path and alpha on that path x_p_path=window(1):0.001:window(2); y_p_path=a*cos(w*x_p_path ...
% spectral code 2x2 % WITH FADING % % r=Hs+n % function ber = ber_spec_F(SNR) %N_BLOCKS=10e1; %BLOCK_SIZE=10e3; %N_SAMPLES=N_BLOCKS*BLOCK_SIZE; load precision.mat pl=zeros(2,2); s=zeros(1,BLOCK_SIZE); r=zeros(1,BLOCK_SIZE); y=zeros(2,2); s_hat=zeros(1,BLOCK_S...
%% initialization clc clear all close all % Create a serial object. Change the string to the port name on your % computer. s = serial('/dev/tty.usbserial-A601EW9I'); s.BaudRate=19200; %% Read Data ROW = 480; % previous value is 1000 LINE = 65; %open the serial port. If this line throws an error, ...
clc; clear; close all; %% Problem formulation %% Thermal Power Plants X_limit=[200 450 150 350]; X_min = X_limit(:,1)'; X_max = X_limit(:,2)'; PD = 800; alpha = [500 400]; beta = [5.3 5.5]; gama = [0.004 0.006]; %% Wind Power Plants No_Turbine = 50; Pr = 4; % rated power each turbine Vin = 3;...
function M = resolve(Grille, lignes, colonnes) for a = 9:-1:1 for b = 9:-1:1 i = lignes(b); j = colonnes(a); % On parcourt toutes les cases dans le sens inverse à celui de la génération des trous if(Grille(i,j) == 0) % Pour chaque ...
function [f, df] =dissimilarity(f_f,f_m,x,Dissimilarity_Metric) % x 表示 控制点 or 像素点 标号 D = length(x); % spacing : pixel (voxel)'s physical dimensions δn ,n=1,2...N v=prod(spacing); switch Dissimilarity_Metric case 'SSD' [f, df] =SSD(f_f,f_m,v); case 'LCC' ...
function [r2ln,bddls,surrFeat,surrBurstWave] = bddlSurrogate(dataStore,n_surr,R,featEmp) frq = R.obs.trans.bursts.frq; fsamp = R.IntP.dt^-1; [surr,params] = surrogate(dataStore(:)', n_surr, 'IAAFT2', 0, fsamp); % % Plot example % % tvec = linspace(0,size(surr,2)/fsamp,size(surr,2)); % % plot(tvec,dataStore(:)) % ...
function comp_g_l = fourth_tempx() % Ryan George % VIGRE, Rice University % This code naively recovers time-integrated V from initial and Neumann % data, then seeks to replicate g_l(x) using this data % a = 1; %micro_m a = a/(1e4); %cm C_m = 1; %microF/cm^2 l = .1; %cm dx = 5e-4; %cm x_grid = (0:dx:l)'; Nx = numel(x_...
%% opening 3 times im=double(imread('D:\Users\Lenovo\Desktop\pic\binary_img\binary (21).gif')); subplot(1,3,1); image(im*255); colormap(gray(256)); %% erosion [m,n] = size(im); for i = 2:m-1 for j = 2:n-1 im1(i,j) = im(i,j) & im(i-1,j) & im(i+1,j) & im(i,j-1) & im(i,j+1); end end %% er...
function a=ijsparse(d,x,r,v) % convert matrix from ij to column sparse format % in: % d vector [number of rows; number of columns; number of nonzeros] % x index % r row indices % v entry values % out: % a matlab sparse matrix % % row indices for column j are r(x(j):x(j+1)-1) % ...
function [radar] = tsp_Nearest_PAR(radar) %function [a_mr_bigstar] = Nearest_PAR(z,rho,c) %Nearest_PAR returns the nearest a % %% Initialization Mr = radar.Tx; A = radar.codematrix; d = radar.codelength; for mr = 1:Mr rho_mr = radar.gamma_r(mr); z_mr = A(:,mr); z_nor_mr = normalize(z_mr,'norm',2); c = ...
% Surface 类为各类(x,y,Z)数据提供插值和绘制方法 % Surface 的Z为简单值,不允许用于对象(暂定如此,使用中据实际情况再推敲)。 % 针对M2TK提供特定转换方法 % 计算拟合曲线的参数。 % 提供曲线上个点取值的计算方法 classdef MatrixSurface < Matrix2DBase properties N_fit_exponent = 2; x_fit_args = []; y_fit_args = []; end methods % 构造函数:K的数量和T的数量 function su...
function [bdctimg]=hopfieldnet(spimg,targetimg,T) %Hopfieldnet: calculate the best BDCT with hopfield network %intput images are square and multiple of 8 %Initialization A=1500; B=600; C=10; u0=300; M=3;%maximum modification of coeff flags=-M:-1; flags=cat(2,flags,1:M); L=4;%Process L lines a time stack...
%% 另外定义tempPSNR2的意义,是因为之前FSR_ADMM产生的数据在tempPSNR里面,想用一下,放到tempPSNR2里面的第一列 clc clear close all % figure; % text(.5, .5,'hello, i''m qwe'); % axis off; % orient tall; % print(gcf,'-r300','-dpdf','a.pdf'); tempPSNR=zeros(800,5);%专门针对ADMM,只有第一列有用 % tempPSNR2=zeros(800,5);%专门针对SADMM,第一列无用,间隔0.1,从0.4-0.7 % tempPSNR...
function v=cell2vec(c) % v=cell2vec(c) % Flatten a cell array of matrices to a vector [m,n]=size(c); v=[]; t=sum(sum(cellfun(@numel,c))); v=zeros(t,1); k=0; for j=1:n for i=1:m s = size(c{i,j}); e = prod(s); v(k+1:k+e)=reshape(c{i,j},[e,1]); k=k+e; end end if t~=k, error('in...
function obj = viewMovieFiltering(obj) % Allows testing of spatial filtering. % Biafra Ahanonu % branched from controllerAnalysis: 2014.08.01 [16:09:16] % inputs % % outputs % % changelog % 2021.08.10 [09:57:36] - Updated to handle CIAtah v4.0 switch to all functions inside ciapkg package. % TODO % im...
function SOS=zp2sos12(z,p,k,posneg,tol) z=cplxpair(z(:)); p=cplxpair(p(:)); % cancel unnecessary roots: c=unique12(p,tol); for s=1:length(c) idxz=find(abs(z-c(s))<=tol); idxp=find(abs(p-c(s))<=tol); nnn=min(length(idxz),length(idxp)); p(idxp)=mean(p(idxp)); z(idxz)=mean(z(idxz)); p(idxp(1:nnn))...
% 计算给定的像素周围像素情况 function mexforeverypix=Calcul_around(i,j,I) mexforeverypix(9)=i; mexforeverypix(10)=j; [w,h]=size(I); if i>2&&i<w&&j>2&&j<h if I(i-1,j-1)>0 mexforeverypix(1)=1;%左上角 end if I(i-1,j)>0 mexforeverypix(2)=1;%上 end if I(i-...
function epochs = compute_average_for_different_timing(epochs,eventOfInterest) %COMPUTE_AVERAGE_FOR_DIFFERENT_TIMING Summary of this function goes here % Detailed explanation goes here end
function [C, sigma] = dataset3Params(X, y, Xval, yval) %EX6PARAMS returns your choice of C and sigma for Part 3 of the exercise %where you select the optimal (C, sigma) learning parameters to use for SVM %with RBF kernel % [C, sigma] = EX6PARAMS(X, y, Xval, yval) returns your choice of C and % sigma. You should co...
function [value, vector] = eigen(matrix) [value, vector] = eig(matrix) end
%CODIFICAÇÃO RS 64QAM - TEORIA N = 63; % Tamanho da palavra código K = 51; % Tamanho da mensagem M = 64; % Ordem da Modulação ebnoVec = (-10:40)'; berapprox = bercoding(ebnoVec,'RS','hard',N,K,'qam',64); semilogy(ebnoVec,berapprox,'k--') legend('Curva Teórica - RS(63,51) | 64QAM','Location','southwest'...
function varargout = CardGame(varargin) % CARDGAME MATLAB code for CardGame.fig % CARDGAME, by itself, creates a new CARDGAME or raises the existing % singleton*. % % H = CARDGAME returns the handle to a new CARDGAME or the handle to % the existing singleton*. % % CARDGAME('CALLBACK',hO...
function img = EdgeDetector(image, method) % % Calculates the a 3 x 3 Prewitt or Sobel Edge Detector given an input image % % img = output image (edge-detected) % image = input image name as string % method = string ’sobel’ or ’prewitt’ % % This function should call PrewittGradDetector.m or SobelGradDetector.m % % Care...
for a = 1:3 for b = a+1:4 for c = b+1:5 %choose mixture %BenzeneTolueneEthylbenzeneStyreneMethylstyrene; %letter = 'A'; %EthanolIso_1PropanolIso_1Butanol; %letter = 'B'; HexaneHeptaneOctaneNonaneDecane; letter = 'C'; ...
function [aii,n,cod,upred,zpred,delta] = fitPowerLawFull(u,z,fixn,h) % This function fits a power law of the form u = aii*z^n to the given data % and returns the constant coefficient aii, the exponent n, and the coef of determination cod. The user has the % option to fix the value of n to 1/6 by setting 'fixn' = ...
% % Mathematical model of the movement of the ship in the water % with influence of wind, current and waves % % (c) by Oliver Baur % see documentation in ship3 clear all; close all; clc; % changeable variables % --------------------------------- % simulation variables T_sim = 50; % [s] time of simula...
%hvweight - issue 1.2 (02/02/09) - HVLab HRV Toolbox %--------------------------------------------------- %[weightedTH] = hvweight (unwtdTH, wname, nublim) % Applies a specified frequency weighting to time history(s) in an HVLab % data structure % % weightedTH = HVLab data structure containing weighted time hi...
function [ h ] = rotx( a ) %ROTX Summary of this function goes here % Detailed explanation goes here h = [1 0 0; 0 cosd(a) -sind(a); 0 sind(a) cosd(a)]; end
%% Stelling 7 % % Als je van te voren weet hoe vaak een lus moet worden % herhaald, gebruik je een while-lus. % Antwoord = 0;
function obj = get_type_of_java_object(value) arr_list = java.util.ArrayList; if iscell(value) obj = 'ArrayList<'; in = ''; in = get_type_of_java_object(value{1,1}); obj = [obj in '>']; return; end if isempty(value) obj = ''; return; end if isnumeric(value) if(size(value,2) > 1) ...
clc; clear all; close all; data_temp=xlsread('cancer.xlsx'); global data_test global k data=fun_norm1(data_temp); num_data=size(data,1); rate_train=0.75; n=size(data,2); num_class=2; data_train=[]; data_test=[]; num_train_all=0; num_test_all=0; epoch_max=200; num_class_zero=find(data(:,n)==0); data...
% ADVISOR Data file: VEH_ORIONVI.M % % % Data source: Briefing Packet, Paul Norton (NREL) 10/29/98 % % Data confidence level: {provide details as to how well the data % represents the source data.} % % Notes: {include any other comments pertaining to the data or use % the data} % % Created on: 11/4/98 % By: To...
function [rl,brep] = demodulatePPMperso(sl,Fse) %UNTITLED5 Summary of this function goes here % Detailed explanation goes here p = []; for i=1:Fse c=-0.5; if i<=floor(Fse/2) c=0.5; end p = [p c]; end rl = conv(p,sl); brep = []; for k=1:(length(rl)+1)/Fse-1 c=0; if rl(k*Fse-1)...
mri = load('./Data/mri.mat'); params = load('./Data/params.mat'); dum = load('./Data/dummyData.mat'); % tryout = myKMeans(dum.D, 5, 10); % input('c'); % % klustri = assignDatapoints(tryout, dum.D); % figure(); % plot(dum.D(1,klustri==1),dum.D(2,klustri==1), 'go'); % hold on; % plot(dum.D(1,klustri==2),dum.D(2,klustri...
% Y = VEC2MAT(x,m,n) % Given a vector of length m*n, this produces the m x n matrix % Y such that x = mat2vec(Y). In other words, x contains the columns of the % matrix Y, stacked below each other. % % See also mat2vec. function X = vec2mat(y,m,n) X = reshape(y,m,n); end
function [X, flag, iter, res] = SSOR(A, B, omega, tol, maxIter, X0) % SSOR Solve linear system using symmetric successive over-relaxation. % X = SSOR(A, B, OMEGA) attempts to solve the linear system A*X=B for X, % where A is a N-by-N matrix and OMEGA is the relaxation factor. This % method is similar to SOR but...
function mywork() clear; %========================================================================== % Load Data Set In Matrix and Initilize The Matrix z=load ('iris.txt'); % eta=0.00005 eps=3.5 z3=z; z(:,5)=[]; %used with iris dataset to remove coulmns number ...
%parameters n=8; d=0.01; alpha=pi; %init vectors with coordinates of the polygon x=zeros(1,n); y=x; for i = 1:n fi=alpha+2*(i-1)*pi/n; %change angle for the next vertex x(i)= -sin(fi); %initial x coordinates y(i)= cos(fi); %initial y coordinates end %draw polygon shapex=x(1:n); shapex(n+1)=x(1); shapey=y...
function [x, A, A_star,ThroatLoc,y] = getNozzle6(leng,Ed,Post_Length,Throat_Radius, endlength, divpm, minpt) % Returns: x (position [m] along the nozzle) % A (Area [m^2] along the nozzle at each x) % A_Star (Area [m^2] of the throat) % ThroatLoc (Location of the throat [m]) % % Inpu...
% Foundation Class: SYData < SYObject. % Written by Satoshi Yamashita. % Fundamental Class of data which stores variable and provides synchronous % use of it among multiple objects. classdef SYData < SYObject properties (Constant) EventNameVarChanged = 'SYDataVarChanged'; end properties var = []; end methods ...
function [ output ] = fun_binary_img( I ) %FUN_BINARY_IMG Summary of this function goes here % Detailed explanation goes here BW = im2bw(I,level) BW = im2bw(X,cmap,level) BW = im2bw(RGB,level) end
function [yfit,roi] = NP_fit(x,y,w,xfit) % Do a linear regression of the two parameters weighted with the variance explained if isempty(w) w = ones(size(y)); end roi.p = linreg(x,y,w); roi.p = flipud(roi.p(:)); % switch to polyval format yfit = polyval(roi.p,xfit); % %xfit_tmp = linspace(xfit_range(1),xfit_range...
function util_loop_check_file( data_filename ) %UTIL_LOOP_GET_FRACTAL_PARAMETERS Get DFA/Hurst Exponent/Minkowski %Dimension of each file. %util_perform_op_in_directory( 'E:\pu\Data', '[cc_matrix xc_matrix %mi_matrix nmi_matrix sync_matrix bc_cc bc_xc bc_mi bc_nmi bc_sync] = %util_loop_calc_topo( %file, %dir, 28 )...
function best_direction = findBestDirection( best_movement ) if best_movement == 1 best_direction = 'up'; else if best_movement == 2 best_direction = 'right'; else if best_movement == 3 best_direction = 'down'; else best_direction =...
function [ ] = thecannon_xvalidate_labels( label1, label2, labelname1, labelname2 ) % Written by: Bo Zhang (NAOC, bozhang@nao.cas.cn) % Last modified: 23-Jun-2016 % % Aim: % - start a parpool/matlabpool % Example: % - % - % INPUT: % - % - % OUTPUT: % - % - % HISTORY: % - % - if nargin =...
close all clear all disp('Loading data ............') %% Data loading part array='AU'; f=['v_' array '.txt']; v=load(f); f=['t_' array '.txt']; t=load(f); f=['stnlat_' array ]; stnlat=load(f); f=['stnlong_' array ]; stnlong=load(f); f=['P_time_' array ]; P_time=load(f); f=['Cross_correlation_' array '.txt']; Cr...
clear; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Constants. xlsFile = 'preprocess.xls'; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Import data. [i2m i2m_labels] = xlsread(xlsFile, 'i2m'); [m2o m2o_labels] = xlsread(xlsFile, 'm2o'); [p2o p2o_labels] = xl...
close all clear clc nc = 255; d = 100; l = 80; obj_height = 20; std_noise = 4.5; filtered = 1; nave = 3; az = -49; % azimuth el = 28; % elevation showfig = 1; x = linspace(-nc/2, nc/2, nc); % generate parabola surface z = zeros(nc, nc); for i=1:nc for j=1:nc z(i,j) = -((x(i)^2) + (x(j)^2)); end en...
function [x, t] = sliceSiamData(x,idxs,ndims,datatype) if ndims == 2 x.x1 = x.x1(idxs,:); x.x2 = x.x2(idxs,:); else x.x1 = x.x1(:,:,:,idxs); x.x2 = x.x2(:,:,:,idxs); end x.x1 = feval(datatype, x.x1); x.x2 = feval(datatype, x.x2); x.t = feval(datatype, x.t(idxs,:)); t = x.t;
function [K,h] = lqrsp_fista(A,B,W,Q,R,Lambda,K0,params) [m,n] = size(K0); K = K0; Kp = K0; tnu = 1; tic; for t=1:params.max_iters if tnu == 1 [At,U,S,V,nu] = lqrsp_eig_deflate(A, B*K, params.max_eig_limit); else At = A; nu = 0; end % Calculate the Lyapunov equations and the gradient if params.a...
function [ new_cbr ] = retrieve( new_case, cbr ) %inserts case to cluster and updates similarities %set threshold t = 0.9; %store duplicates duplicates = {}; %initialise for c = 1:length(cbr.clusters) clusters(c).no = c; clusters(c).cluster = cbr.clusters; clust...
% %main program for reading and fusing c3d feature clear; %%setting path of c3d feature rgbvalidationC3dPath = '../python/feature/test/rgb'; depthvalidationC3dPath = '../python/feature/test/depth'; %%setting path depthvalidationFeaturePath = 'iso_validation_only_hand_depth_map_2stream.mat'; rgbvalidationFeaturePath =...
% Help calculate GC from spectrum % S is p*p*fftlen matrix function S3 = whiteS(S) if size(S,1)~=size(S,2) error('S shoule be p*p*fftlen matrix'); end [H11 de11] = S2H1D(squeeze(S(1,1,:))); [H22 de22] = S2H1D(squeeze(S(2,2,:))); S3 = zeros(size(S)); for k = 1:size(S,3) iH = [1/H11(k), 0; 0, 1/H22(k)]; S3(:...
%CLIQUETREECALIBRATE Performs sum-product or max-product algorithm for %clique tree calibration. % P = CLIQUETREECALIBRATE(P, isMax) calibrates a given clique tree, P % according to the value of isMax flag. If isMax is 1, it uses max-sum % message passing, otherwise uses sum-product. This function % returns...
function deleteObjects(session, ids, type) % DELETEOBJECTS Delete objects of a given type from the OMERO server % % objects = deleteObjects(session, ids, type) returns all the objects of % the specified type, identified by the input ids. All annotations (tags, % files...) linked to the objects will either be dele...
% ADVISOR data file: VEH_Highlander.m % % Data source: % % Data confirmation: % % Notes: Defines road load parameters for a Toyota Highlander. % % Created on: 04/07/03 % By: Tony Markel of NREL, tony_markel@nrel.gov % % Revision history at end of file. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function obj = firingrate(varargin) % constructor for firingrate class % OBJ = firingrate(varargin) % % example as = firingrate('save','redo') % % dependencies: adjspikes, stiminfo Args = struct('RedoLevels',0,'SaveLevels',0,'Auto',0,... 'Binsize','frame','Repetitions',0,'Fit',0,'BootStrap',0,... 'NumBoots'...
% Returns constructor function handle for a stimulus generator with the given id and version. This function assumes: % - The identifier ends with the generator's class name. % - Older versions of the generator exist on the MATLAB path with the suffix '_v[VERSION_NUMBER]', e.g. PulseGenerator_v1. function construct...
clear; clc; close all; !synclient HorizTwoFingerScroll=0 addpath('../sensor_models/'); addpath('../controllers'); addpath('../solvers'); addpath('../trajectory_generator'); addpath('../classes'); addpath('../utilities'); addpath('../'); addpath('../../matlab_utils/src/'); %% User commands : Final time, time step, so...
% One channel implementation of the LMS algorithm clear all;close all; [sig,fsd]=audioread('queen.wav'); % Reading music file with a noise sig2 = awgn(sig(:,1),40); ylen=length(sig2); d=150; % Large delay to make noise uncorrelated as possible sig_del=zeros(ylen,1); sig_del(d:ylen)=sig2(1:ylen-d+1); % Delayed signal, I...
function [img] = ivec3(vec, sz) %IVEC3 Utility, vectorized RGB image back to image (inverse of vec3) img = reshape(vec, sz(1), sz(2), [], IF(numel(sz)>=4, @()sz(4),1)); % works with multiple stacked RGB images (return image with dims H-W-C-N) end
function pop = qh_initialFcn(GenomeLength, FitnessFcn, options, A, vertexPosInTopology) % 自定义的初始化种群函数 % 额外输入参数: % A -- 邻接表 % disp('种群初始化开始') totalPopulationSize = sum(options.PopulationSize); % pop = cell(totalPopulationSize,1); pop = []; for i=1:totalPopulationSize pop = [pop; genChromosome(A)]; % 初始化种群(向种群中添加...
function roidb = roidb_from_nyu(imdb) % roidb = roidb_from_voc(imdb) % Builds an regions of interest database from imdb image % database. Uses precomputed selective search boxes available % in the R-CNN data package. % % Inspired by Andrea Vedaldi's MKL imdb and roidb code. % AUTORIGHTS % ---------------------...
function QuarTestPlot(Outbreak_tot,Quar_tot,Test_tot,casenames,case_ind) subs = gobjects(1,2); kk_cases = length(casenames); del = 0.15; f = figure('Position',[100,100,1100,900]); for ii = 1:2 if ii == 1 analysant = Test_tot; titlestr = 'Tests'; xlab = 'Tests per Day'; else ...
function [SNRdB,sigma] = caprate(channel,r) % function [SNRdB,sigma] = caprate(channel,r); % % determine the capacity of either an awgn channel or % a binary awgn channel. % % This is done by solving for the sigma for which capacity(sigma) = rate % where capacity(.) is the appropriate capacity function % % channel i...
% function [probs, labels_idx] = doRandomWalk(W, img, seeds, cross_num, alpha) % % do random walk segmentation for supervoxel % % cross_num : number of compute frames once a time % % % parameters % [X, Y, ~] = size(img); % N = X * Y; % Num = cross_num * N; % W = sparse([W(:,1); W(:,2)], [W(:,2); W(:,1)], [W(:,3); W(:,...
function [ r ] = datafill( bars, idx ) %DATAFILL 填充空白数据,使在时间上更完备 % inputs: % bars: 原数据,Bars体 % idx: 1为股指期货数据,2为股票指数数据 % outputs: % r % ver 1.0 , luhuaibao Date=unique(floor(bars.time)); % 提取交易日期 Date(end)=[]; % 所给数据最后一个交易日只有一个时间存在,直接删掉 ReferenceDate=repmat(Date,270,1); ReferenceDat...
% Digital Communication Lab 1 % VUB BRUFACE % Yu Liu, Bohan Zhang, Xianjun Mao % % Lab 1 % Channel charateristic estimation % -> coherence frequency and PDP %% Init clear all addpath('functions/'); addpath('misc/'); flags.N_line = 10; % how many points in a line flags.N_bins = 501; % the number of bins flags.N_pts...
%% PANEL DEMO 9 %% %% (a) Create an empty panel object %% (b) Packing a grid of panels into a parent panel %% (c) Plotting into multiple panels %% (d) Selecting a panel using an existing axis %% This extended usage of panel.select() was suggested by Arthur %% Ward. %% (a) % clear or create figure and create root ...
function cellsort = sbxPullSignalsCoreDFF(cellsort, fps) fr_number = length(cellsort(1).timecourse.raw); nROIs = size(cellsort,2); %% Now calculate dFF using axon method % Calculate f0 for each timecourse using a moving window of time window % prior to each frame f0_vector = zeros(nROIs, fr_n...
% % cris_test5 -- compare AIRS CrIS with true CrIS % % reference truth: start with kcarta radiances, convolve to the % CrIS user grid, and call the result "true CrIS". % % deconvolution: start with kcarta radiances, convolve to AIRS % channel radiances (“true AIRS”), deconvolve to an intermediate % grid, e.g. 0.05 ...