text
stringlengths
8
6.12M
function [ f ] = fn_mu_sigma( x, n, A, G, u, v_eff, z ) %fn_mu_sigma Partial function of mu, sigma to be minimized. mu = reshape(x(1 : (A * G)), A, G); L_vec = x((A * G + 1) : end); L = tril(ones(A)); L(L == 1) = L_vec; sigma = L * L'; f2 = zeros(n, G); parfor i = 1 : n mu_eff ...
function [img_out] = pre_interCC(img, N) img = double(img); img_out = interpCC(img); img_out = permute(img_out,[2,1,3]); img_out = interpCC(img_out); img_out = permute(img_out,[2,1,3]); function [img_output] = interpCC(img_input) [H, W] = size(img_input); img_output = zeros(H, W*N); img_output(:,1:N...
%% ------- Constants ------- A_c = 1; A_m = 1; f_c = 200; f_div = 100; phi_c = 0; samples = 10000; symbols = 5; samples_per_symbol = samples / symbols; end_time = 0.1; %% ------- Main ------- % Message signal msg = binary_stream(A_m, symbols, samples_per_symbol); % Carrier signal carrier = to_signal(A_c, f_c, phi...
n = 7; theta = ones(1,n)/n; ntime = n; rholen = n^2; theta = padarray(theta,[0,(rholen-n)/2],0,'both'); n = rholen; center = ceil(rholen/2); rho = zeros(ntime,rholen); drho = zeros(ntime,rholen,n); hessian_t = zeros(n,n,ntime); rho(1,center) = 1; for i = 2:ntime rho(i,:) = conv(rho(i-1,:),theta,'same'); for j = 1:...
function []=metamodel_normal_kt_Gb_scan_kt_cov_with_kt_mean_as_evidence() % Sample the meta-modeling DBN containing following five input models: % 1. The postprandial model % 2. The exocytosis model % 3. The signaling model % 4. The GLP1R model % 5. The metabolism model SCRIPTS_PATH=pwd(); % Change this line if not ru...
classdef GradedSpace < AbstractSpace % Tensor index structure with internal structure, which is not self dual. %% Constructors methods function spaces = GradedSpace(dimensions, dual) % Construct an array of vector spaces. % % Repeating Arguments %...
%% true probability distribution true_func = @(x) betapdf(x,1+1,1+10); %% Do importance sampling N = 10^6; % uniform proposal distribution x_samples = rand(N,1); proposal = 1/N; % evaluate for each sample target = true_func(x_samples); % calculate importance weight w = target ./ proposal; w = w ./ sum(w); % resample, ...
% BRIEF: % Controller function template. Input and output dimension MUST NOT be % modified. % INPUT: % Q: State weighting matrix, dimension (3,3) % R: Input weighting matrix, dimension (3,3) % T: Measured system temperatures, dimension (3,1) % N: MPC horizon length, dimension (1,1) % d: Disturbance matrix...
function image = CdReadSeq(filename, frames) % image = CdReadSeq(filename, frames) % % read in the .seq file produced by the video functionality of the FPD % % image: output image of .seq file % filename: the name of the file % frames: number of image frames (pages) image = MgReadRawFile(filename, 1536, 2048, frames, ...
%% Initialization clear ; close all; clc load('datatrain.mat'); %% =========== Part 1: Regularized Logistic Regression with static value of lambda ============ %X = mapFeature(Xtrain(1:209,:), Xtrain(210:418,:)); initial_theta = zeros(size(Xtrain, 2), 1); lambda = 1; % Compute and display initial cost and gradient fo...
numDB = 4; %numTests = 5; for j = 1:numDB databaseBuffer{j} = 0; end totalExecutions = 100; for i = 1:totalExecutions addpath(num2str(i)); currentExecution = runBatch; for j = 1:numDB databaseBuffer{j} = databaseBuffer{j} + currentExecution{j}; end f{i} = strcat('f', num2str(i)); mkdir(f{i}); for j = 1...
% BSWFUN 双直交スケーリングとウェーブレット関数 % % [PHIS,PSIS,PHIA,PSIA,XVAL] = BSWFUN(LoD,HiD,LoR,HiR) は、(LoD,HiD), % (LoR,HiR) の2組のフィルタに関連する2組のスケーリング関数とウェーブレット % (PHIA,PSIA) のグリッド XVAL での近似を出力します。 % % BSWFUN(...,ITER) は、ITER の繰り返しを使用して、スケーリングと % ウェーブレット関数の2つの組を計算します。 % % BSWFUN(...,'plot') または BSWFUN(...,ITER,'plot') または % BSWFUN(....
function [] = delete_triangles (TriangleToBeDeleted,nTriangleToBeDeleted); % % [] = delete_triangles (TriangleToBeDeleted,nTriangleToBeDeleted); % % This function deletes triangles insert in the parameter array. If it is % necessary the function also eliminates borders and verteces and updates % BorderInfo array....
function [rx_frame_return timedOut] = PHY_receiveFrame(radio, expectedFrameLength, detect, timeOut) % expectedFrameLength in terms of sample flushUSRPRxBuffer(radio,0); timedOut = 0; tic; % Receive one frame len = 0; while len == 0 [rx_data, len] = step(radio); end; % Keep searching for frame whil...
clc clear % close all % im = (imread('/Users/INNOCENTBOY/Documents/MATLAB/pic/4.2.04.tiff')); % % im = imresize(im,[1024,1024]); % im1 = double((im)); % imo = double(imread('256_p.jpg')); imo = double(imread('/Users/INNOCENTBOY/Documents/MATLAB/pic/4.1.01.tiff')); im1(:,:,:) = imo(:,:,:); im = im1(:,:,3); im2(:,:,:...
clc,clear all,close all rain1 = [-1.9,-6.9,5.2,5,7.3,6.8,0.9,-12.5,1.5,3.8]'; rain2 = [3.2,10.4,2,2.5,0,12.7,-15.4,-2.5,1.3,6.8]'; unrain1 = [0.2,-0.1,0.4,2.7,2.1,-4.6,-1.7,-2.6,2.6,-2.8]'; unrain2 = [6.2,7.5,14.6,8.3,0.8,4.3,10.9,13.1,12.8,10]'; %% % G1 = [rain1,rain2]; % G2 = [unrain1,unrain2]; % meanG1 = mea...
function [ tanstruct_out_flagged ] = apply_ace_flags(tanstruct_in) %A function to apply the flags that are supplied for the ACE data. The %profiles that are flagged as 'not to be used' are removed. Data points %that are not be used are or replaced with NaNs. % The ACE flags are descibed in Sheese et al., 2015: Detecti...
function [y alpha beta gamma W] = TVME_Sens(Y, x,lambda,hnuclei,nbandas,varargin ) % TVME_Sens Reconstructs a HR MS image from observed LR MS and % pansharpening images using TV prior % % input arguments: % % Y Multi-spectral observed image % x Panchromatic observed image % ...
function varargout = coord_binner(coords,center,Nphi,Nrad,Ecoeff) % This code sorts the values of a 2D rectangular array into radial and % angular bins. % input parameters: % imgin: 2D rectangular array to be sorted % center: coordinates [x y] a.k.a. [row column] % Nphi: number of angular sectors % Nrad: num...
% detecting whether a triangle is isosceles % empty vector for trianlge lengths triLengths = []; % assking for the lengths of the triangle sides for i = 1:3 triLengths(i) = input("length of a triangle side: "); end % checking if any triangle lengths are 0 or less if triLengths(1) > 0 && triLengths(2) > 0 && triL...
function [string, onset, rt] = EchoCueResp(windowPtr, cue, msg, cueRect, respRect, varargin) KbName('UnifyKeyNames') HideCursor(); % string = EchoCue Resp(window, cue, msg, left, right, [KbHandler], dev, [duration],[answers],[textColor], [bgColor] ) % REQUIRED ARGUMENTS % % Get a string typed at the keyboard. Entry is...
fs = 10000; t = 0 : 1 / fs : 3; y = (rand(length(t), 1) - 0.5) * 1; %%plot_fft(y, fs); samplesT = length(y); NFFT = 2^nextpow2(samplesT); % Next power of 2 from length of y Y = fft(y, NFFT)/samplesT; f = fs/2*linspace(0,1,NFFT/2+1); a = 25; b = 500; h = exp(- a * t) .* cos(b * t); plot(conv(y, h)); %plot(t, h); %pl...
function [ ProjectedImages Eigenfaces m Eigenfaces_Size] = SignUp(TrainPath) % SignUp step.... % % Description: This function adds new person in the system % % Argument: TrainPath - The path for trainning % person images % % Returns: m ...
%% Main file clear all clc %% 定义基本参数 % 飞行高度(海平面) global h h = 1000; % 大气数据 global rho [~,~,~,rho] = atmosisa(h); %温度,音速,压强,密度 global g % 重力加速度 g = 9.81; global N_b m_b z_diff R A Omega sigma_M theta_t omega_n I_beta a c_d c K_beta gamma_M epsilon e M_beta i_theta i_phi x_H1 y_H1 z_H1 x_H2 y_H2 z_H2 ...
% Copyright 2014 % % Licensed under the Apache License, Version 2.0 (the "License"); % you may not use this file except in compliance with the License. % You may obtain a copy of the License at % % http://www.apache.org/licenses/LICENSE-2.0 % % Unless required by applicable law or agreed to in writin...
function [ L ] = lossfn( theta,X,Y) %UNTITLED5 Summary of this function goes here % Detailed explanation goes here L=0; for i = 1: length(Y) L=L+ (Y(i)-1)*log(1-classfn(X(:,i),theta))-Y(i)*log(classfn(X(:,i),theta)); end L=(1/2*length(Y))*L; end
% Frecuencia de muestreo Fs = 512; % Periodo de muestreo Ts = 1/Fs; % Muestras L = 1024; % Vector tiempo t = (0:L-1).*Ts; % Para la señal s1 = (t>=0); s2 = exp(-10*t); s = s1.*s2; % Para el espectro de fase de la señal figure 1 Y = fft(s); subplot(211) plot(imag(Y), 'linewidth', 2) title('Espectro de la fase') xl...
function ColorImagePriorsLocalHook % ColorImagePriors % % Configure things for working on the LightnessPopCode project. % % For use with the ToolboxToolbox. If you copy this into your % ToolboxToolbox localToolboxHooks directory (by defalut, % ~/localToolboxHooks) and delete "LocalHooksTemplate" from the filename, % t...
function coivox = nii_centerinten(V) % This script attempts to return the 'Center of Intensity' for an image % Similar to 'center of mass' - for each dimension the intensity is summed % COI is the midpoint for the intensity % Example % nii_centerinten('C:\dir\img.nii'); coivox = zeros(1,3); %translate 0mm i...
function [esperanzaport, desvestport]=fun_portafolio_prof(Precios,part) [nprecios,activos]=size(Precios); npart=size(part,1); for k=1:activos rend(:,k)=(Precios(2:nprecios,k)-Precios(1:nprecios-1,k))./Precios(1:nprecios-1,k); end esperanza=mean(rend); varianza=var(rend); desv...
% My simple implementation of sift descriptor ignoring scale and rotation % invariances % % Input: % keyPoints - detected keypoints in a 2 x n matrix holding the key % point coordinates % img - the gray scale image % % Output: % descr - w x n matrix, stores for each keyp...
%segmentation for 1 image img=imread('004.tif'); I = imresize(img,0.15); Ig= imgaussfilt (I,1); cform = makecform('srgb2lab'); %transform to L*ab space lab_he = applycform(Ig,cform); ab = double(lab_he(:,:,2:3)); nrows = size(ab,1); ncols = size(ab,2); ab = reshape(ab,nrows*ncols,2); nColors = 3; % kmeans clu...
function[freq1]=norm_spec_maxfreq(freq1) cao=freq1.powspctrm; % KAO=cao; for j=1:size(cao,1) for y=1:size(cao,2) kao=squeeze(cao(j,y,:,:)); % mkao=max(kao.'); % nkao=kao./mkao.'; % KAO(j,y,:,:)=nkao; mkao=max(kao); nkao=k...
function mplotmatrix(haxes,info) % by Guoxu ZHOU definfo=struct('signal',rand(2,100),'xlabel','Index','ylabel','\itt','zlabel','\it{s}({\itt})','viewpoint',[25 45],'title','plotmatrix','linewidth',2,... 'linestyle','','plotfunc','plot3','colormap','hsv','tag','plotmatrix','opos',[0.01 0.01 0.98 0.98],'units','norma...
% sieve of Erasthotenes built in version max = 10000; % limit for the max prime number if (nargin > 0) max = int64(str2num(argv(){1})); end tic(); % start timer prime = primes(max); toc() % write elapsed time printf('%d\n', columns(prime));
% Matt McDade % System Simulation % HW 10 Part C & D Nr = 12; Ntheta = 50; theta = linspace(0, (Ntheta-1) / Ntheta, Ntheta) * 2 * pi; rho = linspace(1, Nr, Nr) / Nr; rho_cw = linspace(1, Nr, Nr) / Nr; rho_ccw = linspace(1, Nr, Nr) / Nr; p = linspace(0, 2*pi, 1001); for m=1:Nr r = rho(Nr - m + 1); z ...
function tseries_filt = Filter_daily_new(tseries,Tmin,Tmax) % filter the data series, for a period of Tmin,Tmax (in days) % tseries dimentions: [lon,lat,time] %~~~~~~~Filter Parameters~~~~~~~~~~~~ f_sampling = 1; %(days^-1) sampling frequency N=6; % order of filter F3dB1=1/Tmax; % first 3dB cutoff point F3dB2=1/Tmin...
function [plot_handle] = quiver_plot_coil(x_points,y_points,z_points) %QUIVER_PLOT_COIL Summary of this function goes here % Detailed explanation goes here quiver_vec_x=diff(x_points); quiver_vec_y=diff(y_points); quiver_vec_z=diff(z_points); quiver_pos_x=(x_points(1:end-1))+.5*quiver_vec_x; quiver_pos_y=(y_points...
filefolder = 'C:\Users\praveen\Desktop\imgp\1\Input Images\'; imagefiles = dir(fullfile(filefolder,'*.*')); nfiles = length(imagefiles); count = 0; for i=17:21 filename = imagefiles(i).name; fullfilename = fullfile(filefolder,filename); im = imread(fullfilename); gamma = 5; [rows column depth] = siz...
% Represents a trajectory of disturbances (in joint space) % % Author : Chen SONG % Created : 2017 % Description : % This is a trajectory of joint space disturbances, will probably mainly % be used in simulators with disturbance observer % Not sure if this should even exist classdef ObserverTrajec...
function pred = image_pyramid(image,paths) % % analyze the predictiveness of coarse to fine luminance/depth correlation for % perceptual responses %pyramids = {'Laplacian', 'Wavelet', 'Steerable'}; % different methods for coarse-to-fine scale pyramids = {'Laplacian'}; max_levels = 5; ...
% Task = 'EXHC'; % SpecIdio = true; % SpecType = true; % SpecBC = true; format shortG; if ~isequal(exist('Task','var'),1) Task = 'US'; end Params = SETUP; Params = MOMENTS(Params); switch (Task) case 'EQ' Params = OVERWRITE(Params, 'Benchmark'); Params = COMMON(Params); EQ(Params); ...
% Collect data mytable = readtable('00_codelines.csv'); values = mytable{:, :}; % Plot hFig = figure; hB = bar(values,'grouped','FaceColor','flat'); set(gca,'XTickLabel', {'XDP wired' 'XDP wireless' 'P4 wired' 'P4 wireless' }); title('Number of code lines'); grid on ylim([0, 320]); % IF we want to add V...
% PROJECT: Flooding Physiology % % Compile all longitude files into a single record for analysis. % % Meg D. Fowler, 2017-09-19 % Be sure to mount /gdata/pritchard2/mdfowler/ via sshfs %% OPTIONS %%% baseDir = '/Users/meganfowler/gp_fuse/Flooding-physiology/MatlabData/30yr/outflw_lonSeparated/'; caseName = 'co...
clear all; clc; close all; t=-5000:5000; x=cos(31.4*t)+2*cos(188.5*t)+0.5*cos(43.98*t); plot(t,x); xlabel('time in sec'); ylabel('x(t)'); title('continuous time signal');
function CT = getCT(vawt, CTb) %GETCT Non dimensional torque of all VAWT. % % CT = vawt.getCT(CTb) returns the non dimensional torque (CT) of the % overall turbine from the torque of one blade (CTb). CT=zeros(size(CTb)); CTb=vawt.solidity*CTb/vawt.nblades; indCT=1:2*vawt.Nth; stepCT=2*vawt.Nth/v...
function noisedPoint = noise( point, p, K, l ) %Общая формула x = sqrt(p) * h * d + ksi N0=4; A=1; fd = 100; dt = 66.7E-6; %k=-1 модель Кларка %k=Inf гауссов шумовой канал %k=0 релеевский канал global teta; if(teta == -1) teta = 2*pi * rand(1, N0); end if( K == Inf ) ...
function [tau_ext,dTau_ext,Fn,Fs,dFn,dFs] = toe_grf(x,p) x = x(1,:); %we leave for future delay function J = six_J(x(1),x(2),x(3),x(4),x(5),x(6)); dJdx1 = dJ_q1(x); dJdx2 = dJ_q2(x); dJdx3 = dJ_q3(x); dJdx4 = dJ_q4(x); dJdx5 = dJ_q5(x); dJdx6 = dJ_q6(x); Fn = Fn_toe(x,p.toe_th,p.k,p.cmax,p.dmax,p.us,...
% 一次性更新一个时间段的TableData_main_v2时,有时候会遇到ATR价格取得不对导致ATR计算有误的问题,不定期check一下这个问题 load('E:\futureDataBasic\priceData\Dly\TableData_main_v2.mat') % 核对14列trABS计算有没有错误 TableData.Variety = regexp(TableData.mainCont, '\D+', 'match'); TableData.Variety = cellfun(@char, TableData.Variety, 'UniformOutput', false); TableData ...
%% ex3 Addythive synthesis % Open the wav file flute.wav as ? and try to synthetically (and empirically) replicate it as a sum of K=3 sinusoids clear all close all clc [x, Fs]=audioread('flute.wav'); %% 1. Compute and plot the spectrogram of x Nfft=2048; R=Nfft/2; f=linspace(0,Fs/2,Nfft/2+1); X=spectrog...
% Generated through Matlab % Author/last edit: Killian Keller/Christian % E-Mail: killian.keller@ief.ee.ethz.ch % Organization: ETHZ ITET IEF function [simulation_results, mode_results] = comsolEvaluation(model, simulation_parameters, materials, varargin) %EVALUATION Evaluates the Simulati...
% Consumption for fish and plants agent types function tank = agents_behaviour(tank) % Initialize fish and plants [~, fishPopulation] = size(tank.fish); [~, plantPopulation] = size(tank.plants); % Behaviour of fish for j = 1:fishPopulation if (tank.fish(j).status == STATUS.A...
revisedColorMap = [ 0 0 0; 0 0 255; 127 0 255; 65 127 127; 127 65 0; 255 180 180; 201 201 65; 158 196 113; 127 127 127; 180 255 255...
%Add Retina-LGN-V1-ongoing package into matlab path %Load any image load images_80.mat r_xy=AdjancyCorrPixel(im1); r_x2y=Adjancy2CorrPixel(im1); r_x4y=Adjancy4CorrPixel(im1); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % De-corrlation with RBIG2018 % Addpath RBIG2008 into matlab %%%%%%%%%%%%%%%%%%%%%%%%%%%%...
classdef LUT1DHalfDomain < LUT1D %LUT1DHalfDomain Summary of this class goes here % Detailed explanation goes here properties numChannels = 1 end methods function value = getLUTValueForFloat(obj, floatVal, channel) value = floatVal; end ...
smooth_factor = 50; e1.srms = rectify(e1.fdata800(:,1:20), smooth_factor); e2.srms = rectify(e2.fdata800(:,1:20), smooth_factor); subtracted.srms = rectify(subtracted.fdata800(:,1:20), smooth_factor); figure('Name', 'Smoothed rms of signal'); sh(1) = subplot(7, 1, 1); [s,f,t] = zftftb_pretty_sonogram(double(audio.d...
function [ M ] = x_operator( v ) M = [ 0 -v(3) v(2); v(3) 0 -v(1); -v(2) v(1) 0 ]; end
function [S] = loadphyparam(fn) %LOADPHYPARAM Summary of this function goes here % Detailed explanation goes here % Loads a phy-style "params.py" into a matlab struct. The params.py is % python code but just a series of assignments, so most of it will run % directly in matlab % % now based on text2struct from James ...
function x = doolitle(A, b) [n, n] = size(A); L = zeros(n); U = zeros(n); x = zeros(n, 1); y = zeros(n, 1); for r = 1:n for i = r:n U(r, i) = A(r, i) - sum(L(r, 1:r-1).*U(1:r-1, i)'); L(i, r) = (A(i, r) - sum(L(i, 1:r-1).*U(1:r-1, r)'))/U(r, r); end en...
function [z] = Aitken_Neville2(x,y) %Extrapolation von Pi mit Aitken Neville %Mit Darstellung von U/2 durch n*sin(pi/n) n = length(x); T = zeros(n,n); T(:,1) = y'; h = 1./x; for i=1:n for j = 1:i-1 T(i,j+1) = ((h(i).^2)*T(i-1,j)-(h(i-j).^2)*T(i,j))/((h(i).^2)-(h(i-j).^2)); end end z = T(n,n);
%2 dimensions figure subplot(2,1,1)%概率转移矩阵不同 for k=1:3 f=[0.4;0.6]; [P1,PI1]=Mchain2(0.1*k,0.2*k); for i=1:20 err1(i)=norm((P1')^i*f-PI1(1,:)'); end plot(err1); title('(同一初始分布)2阶Markov链的收敛迭代误差'); xlabel('迭代次数'); hold on end subplot(2,1,2);%初始分布不同???????????? [P...
% common fields % traintype, numhid, epsilon, eps_decay, sp_type, sp_reg, sp_target, l2reg, % maxiter, batchsize, stdinit, upfactor_x, upfactor_z, downfactor, % momentum_change, % % training algorithms % 'pcd' : ML with CD % : usepcd, kcd, negchain % 'cdpl' : percloss with CD % : kcd % 'mrnn'...
function WriteLineOfFile(varargin) %WRITELINEOFILE A function a line of a text based file % % ------------------------------------------------------------------------ % Copyright (C) 2017 M. Schrauwen (markschrauwen@gmail.com) % % This program is free software: you can redistribute it and/or modify % i...
function [activeSet, Kstore] = gplvmivm(X, theta, d) % GPLVMIVM THis code implements active set selection (via the IVM) for the GPLVM numData = size(X, 1); % Create storage for the kernel Kstore = zeros(numData, d); % Initialise Indices J = 1:numData; activeSet = []; % Note the last parameter theta(end) is the preci...
clearvars %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %do 2D+1 analysis of some real AIRS-observed waves % %Corwin Wright, c.wright@bath.ac.uk, 2021/02/02 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function F_x = dyn_fn(X_in, u) x= X_in(1,1); theta=X_in(2,1); x_dot = X_in(3,1); theta_dot = X_in(4,1); F_x = [ x_dot ; theta_dot ; ... ( (theta_dot^2 + cos(theta))*sin(theta) + u )/(1+(sin(theta))^2 ); ( -u*cos(theta) - theta_dot^2*cos(theta)*sin(theta) - 2*sin(theta) )/(1+sin(theta)^2) ]; end
classdef SWEDepthLimiter1d %SWEDEPTHLIMITER1D Summary of this class goes here % Detailed explanation goes here methods function fphys = apply( obj, phys, fphys ) fphys = phys.limiter.matLimit( fphys, 1 ); fphys = phys.limiter.matLimit( fphys, 2 ); end end ...
function [options, imdb] = run_experiments_bcnn_train(opts) if(~exist('data', 'dir')) mkdir('data'); end for ii = 1 : numel(opts.datasetList) dataset = opts.datasetList{ii} ; if iscell(dataset) numSplits = dataset{2} ; dataset = dataset{1} ; else numSplits = 1 ; end for jj ...
function [J grad] = nnCostFunction(nn_params, ... input_layer_size, ... hidden_layer_size, ... num_labels, ... X, y, lambda) %NNCOSTFUNCTION Implements the neural network cost func...
% Returns a m x 3K(3K+1)/2 system of orthogonality and basis constraints % with m = F(K-1) - K(K-1)/2 = (2F-K)(K-1)/2 the number of constraints. function [A, c] = rotation_and_basis_constraints(M_hat, k) % M_hat is 2F x 3K. F = size(M_hat, 1) / 2; K = size(M_hat, 2) / 3; % Number of variables. n = 3 * K * (...
function [ hidden,accuracy ] = viterbi_nolog( observations1, states, pye, A, B ) %clear all; %[pye,A,B] = training_crossValidated(); %observations1 = load(observationsPath); %observations2 = load('~/NCSU-git/ActivityRecognition/data/NewData/ADL5.csv'); %observations2 = load('~/NCSU-git/ActivityRecog...
clc, clear all, close all matA=diag([ones(1,9)*17]); matB=diag([ones(1,9)*17]); %[P1,Ant1]=sort(rand(1,8)); Ant1=[8 6 3 1 4 5 7 2]; %[P2,Ant2]=sort(rand(1,8)); Ant2=[7 5 3 2 8 6 1 4]; %[P3,Ant3]=sort(rand(1,8)); Ant3=[1 8 3 5 6 7 2 4]; %[P4,Ant4]=sort(rand(1,8)); Ant4=[4 1 8 7 5 3 6 2]; ANTS=[Ant1; Ant2; Ant...
function [nTApprox,nVApprox,nBApprox] = first_size_variables_extimate (nInputVertex); % % [nTApprox,nVApprox,nBApprox] = first_size_variables_extimate (nInputVertex); % % This function gives a first extimate of the size of the % elements of the grid % % Inputs & Outputs of this function are: % % nInputVertex...
%SCRIPT TO MAKE ANIMATED .GIF OF 3D PLOT %FROM %http://www.mathworks.com/matlabcentral/answers/86940-animate-3d-plot-view az = 45; el = 45; view([az,el]) degStep = 5; detlaT = 1; fCount = 71; f = getframe(gcf); [im,map] = rgb2ind(f.cdata,256,'nodither'); im(1,1,1,fCount) = 0; k = 1; % % spin 45° % for i = 0:-degStep:...
function [ALPHA, GAMMA, BETA] = make_euler_angle_grid_3D(BAND_WIDTH) % This function creates matrices of spherical coordinates % that are consistent with the SOFT library in C. % % INPUTS % BAND_WIDTH: Band width of the function, e.g., half the sampling rate on % the equiangular grid (integer). % % OUTPUTS % ALPH...
function peaksIdx = myFindPeaks(signalECG) diffSig = diff(signalECG); thy = 80; thx = 300; peaks1 = find(diffSig > thy); diffpeaks = diff(peaks1); peaks1(find(diffpeaks < thx)+1) = []; peaks2 = find(diffSig < -thy); diffpeaks1 = -diff(peaks2(end:-1:1)); peaks2(length(peaks2) - find(diffpeaks1 < thx)) = []; peaksIdx ...
function gnd_detections = loadDetections(dataset, cameras, subset) % load the detections file gnd_detections = cell(length(cameras),1); for id = 1:length(cameras) filename_g = ['/home/pedro/mct-bqp/data/' dataset '/groundtruth/' num2str(cameras{id}) '.txt']; temp_g = csvread(filename_g); ...
function hi=lsqinv(h,N,L,wlp) % LSQINV Least square inverse filter design % hi=LSQINV(h,N,L,wlp) % input parameters: % h --> measured impulse response % N --> number of recognized samples (default: length of h -1) % L --> time shift for desired output (defau...
function [data,labelNames,numActive,MAD]=extractField_multiFile(field) % Takes field as an input (eg. 'rBias') and prompts the user to select % multiple files. Files are automatically sorted and grouped by line, % treatment, and day. %% Get paths to data files [fName,fDir,fFilter] = uigetfile('*.txt;*','Open data fil...
base_path = '/home/owhughes/matlab'; addpath(fullfile(base_path, 'chebfun-master')); addpath(fullfile(base_path, 'Padua2DM')); addpath(fullfile(base_path, 'partitions')); addpath(fullfile(base_path, 'spotless')); addpath(fullfile(base_path, 'alfonso-master')); addpath ./okay_poly_utils addpath ./spotless_utils addpath...
function models = trainShape(files,collector,params,options) % trainShape - collects ground truth and estimates a Gaussian distribution regularized by PPCA; alternatively loads a shape stored on disk % % Syntax: % models = trainShape(files,collector,params,options) % % Inputs: % files - [struct] output of the ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Illustrate how we get hyperacuity resolution: vernierSample. % cd /wusr5/brian/book/06space/fig/subLocalization % Make 5 minutes worth of linespread % x = -5:.05:5; ls = lineSpread(x); %plot(x,ls) % Make sample points every 30 sec (1/2 minute) for cones % sampleValues = 5:1...
function [C] = CorR(X,Y,m) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here %{ Cright = zeros(1,length(m)); N1 = (floor(length(m) / 2)) + 1; for i = ((floor(length(m) / 2)) + 1):length(m) for n = 1:(N1 - m(i)) Cright(i) = Cright(i) + (X(n)*Y(n + m(i))); Cright(i) = (...
function [] = Predict(imageurl) load D:\CODE\aboutSVM\try\only_HOG\classifier2.mat; figure; img = imread(imageurl); imshow(img); %提取图像的特征向量 %转化为灰度图像 img=rgb2gray(img); glcm_feature = getGLCMFeatures(img); %转化为2值图像 lvl = graythresh(img); img = im2bw(img, lvl); % imshow(img); % figure img=imresize(img,[256 256]); [hog...
function phaldacst(varargin); % phaldacst( [...] ); % uDACS16 T h = timeplot({'MS5607_T','TRU1T','TRU2T','TRU3T','TRUIB1T','TRUIB2T'}, ... 'uDACS16 T', ... 'T', ... {'MS5607\_T','TRU1T','TRU2T','TRU3T','TRUIB1T','TRUIB2T'}, ... varargin{:} );
classdef ImagingSystem < handle %IMAGINGSYSTEM Class implementing an ultrasound post-processing system. % IMAGINGSYSTEM is responsible the brain of the operation. % The class keeps control over all settings and parameters, % and also calls the different algorithms when necessary. proper...
[reflect11,reflect21,r_frequency] = s2pToComplexSParam_v4('C:\Users\jl3y9\Documents\MATLAB\Data\Calibration\Airline_50mm_30dBm_1-20-17.dat'); [air11,air21,a_frequency] = s2pToComplexSParam_v4('C:\Users\jl3y9\Documents\MATLAB\Data\Calibration\Airline_reflect_30dBm_1-20-17.dat'); [mut11,mut21,m_frequency] = s2pToComplexS...
fs = 16000; load 'rir.mat' load 'source.mat' [I,J,Lr] = size(rir); [~,Ls] = size(source); Lx = Ls+Lr-1; x = zeros(I,Lx); for i = 1:I for j = 1:J x(i,:) = x(i,:)+conv(source(j,:),squeeze(rir(i,j,:))); end end y = ctf_mint(x,rir,1e-5,6); figure;plot(y') figure;plot(source')
function grafico = geragrafico (p) xneg=input("Entrar valor negativo de X: ", "s"); xpos=input("Entrar valor positivo de X: ", "s"); escala=input("Entrar com a escala de valores X: ", "s"); x=xneg:escala:xpos; k= ((str2num(xpos)- str2num(xneg))/str2num(escala))+1; funcao = input("entre com a funcao: ",...
function [L,U,piv] = OuterLU_PP(A) % function [L,U,piv] = OuterLU_PP(A) % Outer product LU with partial pivoting. % A is nxn. % L is nxn and unit lower triangular. % U is nxn and upper triangular % piv(1:n-1) houses the pivot row indices. % PA = LU where P = P_{n-1}...P_{1} and P_{k} is the identity with % ro...
function [ LPT, Cycle ] = LPTurb( LPT, LPC, IPT, Cycle_In, DesignInputs, DesignCriteria ) % Set outputs equal to inputs, add to throughout code Cycle = Cycle_In; % Set shafts speeds to be equivalent LPT.N = LPC.N; % Determine row indices for IPT stations Station_48 = find(ismember(Cycle(:,1),48),1); % IPT Inlet Stat...
function [Xh, Xl, Yh, varargout] = Sample_PreProcess( params, varargin) %% % ====================================== =================================== % 04/03/2016 optional preprocess involving blure, downsampling, interplolation, % feature extraction. % 03/03/2016 Assume the measurement matrix is unknown; % =======...
% % Calc data for Voce plots % (Uses files generated in Step9) % function calcVoceData marker = ['o';'p';'v';'s';'d';'^';'h';'<';'x';'>';'+';'*']; color = [[0.90 0.10 0.10];[0.10 0.90 0.10];[0.10 0.10 0.90];... [0.75 0.25 1.00];[1.00 0.75 0.25];[0.15 0.30 0.70];... [0.30 0.50 0.80];[0.25 0.7...
function WriteCentered(win, text, x, y, color, margin, linespacing, yPositionIsBaseline) % % WriteCentered(win, text, x, y, color, margin, linespacing, yPositionIsBaseline) % % function writes a string TEXT to screen WIN in color COLOR. The center % of the TEXT occurs at postion X and Y. % % If the text ...
function [ freq_trials ] = readBinDevFreq( subj_num, E) %READDEVFREQ reads the input txt file of a subject's deviation %frequencies (represented as binary numbers). %Outputs a structure with all the conditions (frequencies %tested) on the subject, in the order that they were tested in. % %This function is used for sin...
function lineBest = ransacEstimate(line, modelmode, errormode, maxiter, modeloptions, falsePositions) % RANSACESTIMATE Gives the best fitting RANSAC model fit for a line. % % LINEBEST = ransacEstimate(LINE, MODELMODE, ERRORMODE, MAXITER, MODELOPTIONS, FALSEPOSITION) % % LINE: The original linepoints (OCTSEG format). ...
classdef Node %NODE Summary of this class goes here % Detailed explanation goes here properties Pose Invariant Transition Level Parent ChildrenList Cost EdgeList end methods function obj = Node(pose,invariant,transit...
%{ common.Injection (manual) # record of injections -> common.Animal injection : tinyint # number of injection (first, second, etc...) --- injection_guidance="2P" : enum('2P','stereotactic','other')# guidance method injection_type="virus" : enum('virus','dye','beads','other')# substance in...
function X = mwptrec(dec,varargin) %MWPTREC Multisignal wavelet packet 1-D reconstruction. % M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 18-Feb-2011 % Last Revision: 28-Aug-2011. % Copyright 1995-2011 The MathWorks, Inc. % $Revision: 1.1.6.2 $ $Date: 2011/10/11 16:07:01 $ % Check arguments. error(nargchk(1...
classdef HexagonalLattice <Lattice methods function rect= getPatchRects( obj ) sz= obj.size .* obj.baseSize; rect= zeros([4 sz(:)'] ); for k1= 1:sz(1), for k2= 1:sz(2), rect( :, k1, k2 )= [-.45+0.86*.9*k1 -0.86*.45+k2*0.86+mod(k1,2)*0.4...