text
stringlengths
8
6.12M
%% TANGLEANALYSIS.m % This analysis determines how 'tangled' a given dataset is. That is, how % often the projections in high D space cross over each other in different % directions. The tangle index of two time points is given by the squared % difference in derivative divided by the squared difference in state at % t...
DataOriginal = runData.original; h1 = figure(); subplot(3,1,1) histfit(runData.original.rt) title('RT cue-reach start') subplot(3,1,2) histfit(runData.original.reach) title('Reach Time') subplot(3,1,3) title('Return Time') histfit(runData.original.return) if saveProcess str = 'RT_phases'; saveas(h1,[f...
clear; clc; load('dvrk_mtm_psm.mat'); %% the configuration of PSM syms s1 s2 s3 s4 s5 s6 s7; DOF = 7; mtm_config = [% type a alpha d theta 'r' 0 0 0 s1+pi/2;... 'r' 0 pi/2 0 s2-pi/2;... 'r' -0.2794 ...
function [opts] = opt_init() %UNTITLED2 Summary of this function goes here % Detailed explanation goes here opts = []; if ~isfield(opts,'mu') opts.mu=20; end %% regularization term scale if ~isfield(opts,'delta') opts.delta=1; end %% delta<||A^*A||, since A here is a subsampled Fourier matrix, could be fixe...
clc;clear; addpath('../functions') addpath('../functions/l1_ls_matlab') addpath('../data') % Mosek setup % javaaddpath('C:\Program Files\Mosek\8\tools\platform\win64x86\bin/mosekmatlab.jar') % addpath('C:\Program Files\Mosek\8\toolbox\r2014a') addpath ~/mosek/8/toolbox/r2014a % Read in data & some general setup file_n...
%fprintf('%15s %6i %10i %10i %10i\n', 'n=',5,10,20,90) for e=1:5 es = [1 0.5 0 -0.5 -1]; eps = 10^(es(e)); P = rand(100); eigs = rand(100, 1)*3 for i =1:100 if(eigs(i) < 1) eigs(i) = 4 + (eigs(i) - 0.5)*eps; elseif(eigs(i) < 2) eigs(i) = 5 + ...
function varargout = loc_laser_left(varargin) % loc_laser_left M-file for loc_laser_left.fig % loc_laser_left, by itself, creates a new loc_laser_left or raises the existing % singleton*. % % H = loc_laser_left returns the handle to a new loc_laser_left or the handle to % the existing singleton*. % ...
function OUTctf = ctFIRE_1(imgName,imgPath) % ctFIRE to process one image each time % image % Input: % imgName: name of the image to be processed % imgPath: path of the image to be processed % Output: % OUTctf: a structure containing the extracted fiber information % with options to process the original as we...
function prob_048 % The series, % % 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317. % % Find the last ten digits of the series, % % 1^1 + 2^2 + 3^3 + ... + 1000^1000. % % % A: 9110846700 % nDigits = 10; base = 10^nDigits; % Index of last summand N = 1000; val = 0; for i = 1:N val = val + pow_a_b_mod_n(i...
%%%%%%% Lab 6 DSP - Test Phaser close all; clear; clc; %%%%% 0. Importación de señal file1 = 'soplo_rodrigo.wav'; file2 = 'soplo_rodrigo_phaser.wav'; [data1, fs1] = audioread(file1); [data2, fs2] = audioread(file2); %%%%% 1. Parámetros %%% Muestreo T_spect = 0.05; %%%%% 2. Obtención de espectrogramas figure spectr...
function [coeffs,LegPoly] = expand_Legendre(x,f,N) % This function expands f(x), on range -1<=x<=1 on the basis of the first N % Legendre-polynomials, and returns the expansion coefficients and the polynomials. x=map2colvec(x); f=map2colvec(f); dx=[diff(x); (max(x)-min(x))/length(x)]; for ind1=1:N temp = leg...
% calculate rate of OH + 12C2H2Cl2 -> products % Updated 6/10/15 % Based on MCM v. 3.3 % rate = kOH12C2H2Cl2(T,M) % 1-2-Dichloroethane, 1-2-DCE function j = kOH12C2H2Cl2(T,M) j = 1.94e-12.*exp(90../T);
clf fc = 6 down = 3 up = 6 N = 30 % number of sinusoid wave t = 0:0.01:(N)/(2*pi) origin_signal = cos(2*pi*fc*t) load('./filter/FIR_LP') load('./filter/IIR_LP') % up and down sample signal up_sampling_signal = DAC(origin_signal,up) down_then_up_signal = DAC(ADC(origin_signal,up),up) % filter the signal [h,w] = freqz(...
function rf = vigraImporthdf5RF( filename, groupname); % function rf = vigraImporthdf5RF( filename, groupname); % % Import a previously trained Random Forest from a hdf5 file % % rf - MATLAB cell array representing the random forest classifier % filename - name of hdf5 file % % groupname - opti...
figure(414); subplot(2,1,2); plot(IRDB.abfil_ft, abfil_fpspec_simdata(:, 1),... '-x','MarkerIndices' , peak.idx(1: peak.ctr(1), 1),... 'MarkerSize', 15, 'MarkerEdgeColor', 'red'); title('(b)'); xlabel('Frequency'); ylabel('Amplitude');
%%%%%%%%%%%%%%%%%%%%%%%%%% % % Sam Feig % Vladimir Zhdanov % % CSCI 4831/5722 % Homework 4 % Instructor: Ioana Fleming % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [outImg] = detectOutliers(D_LR, D_RL, T_LR) [m, n] = size(D_LR); outImg = zeros(m, n); for i = 1:m for j = 1:n % If outl...
% Multi-graph manifold alignment for RGB image visualization. % Neighbourhood preserving projections % Sparcity preserving projections % Locality preserving projections %% bandsList = [10, 18, 26, 35, 51, 56,70, 75, 87, 99]; % bandsList = [120, 126, 135, 151, 156, 170, 175, 187, 199]; reduceImage = Reduce...
%[s_read_REF] read, save and show REF data in LIST/DATA format. % % % Last modified % 2010.07.26. % Change psi to PSI to remove a conflict with Matlab function 'psi()'. % 2010.08.09. % This is generated from [REF_readsaveshow.m]. This only contains the % last comment from the file. % 2010.08.18. % ...
function pValue = hotellingModified(bin,time1,time2) [iInd, jInd] = find(bin.uVar(:,:,time1)~=0 &... bin.uVar(:,:,time2)~=0); T2=zeros(length(bin.x),length(bin.y)); nu=zeros(length(bin.x),length(bin.y)); for m=1:length(iInd) S1=zeros(2,2); S1(1,1)=bin.uVar(iInd(m),jInd(m),time1); S1(2,2)=bin...
function [Sv] = SkewSymm(v) %UNTITLED8 Summary of this function goes here % Detailed explanation goes here v1 = v(1,1); v2 = v(1,2); v3 = v(1,3); Sv = [0 -v3 v2; v3 0 -v1;-v2 v1 0]; end
function SunRef = Task3_SunPointingFrame SunRef.RN = Euler1232C([pi/2 0 0]')*Euler1232C([0 0 pi]'); SunRef.omega = [0 0 0]'; end
% TEST_POROV % Testuje parametre zadaneho modelu v POROVNAT % Ak su zadane parametre v poriadku, spusti sa POROVNAT2 % Copyright is with the following author(s): % % (c) 2012 Juraj Oravec, Slovak University of Technology in Bratislava, % juraj.oravec@stuba.sk % (c) 2012 Monika Bakosova, Slovak University of Technology...
function [x,fx,ef,numit] = gennewton(f,x,cc,varargin) % input arguments: f function handle % x starting values % cc convergence criteria % varargin either empty or string 'Newton' or 'Broyden' %% get conver...
% 03_确定最优特征 clearvars -except FC Important_fc FC_Important % 1)初始化变量,前55个被试为PD,用-1来表示,后50个被试为NC,用+1来进行表示 PD = -ones(1, 55); NC = ones(1, 50); labels = [PD, NC]; n = 65; % 划分的个数分别是:35:30:40;将前75个作为训练集+验证集; % 最后40个作为测试集 % 2)随机抽取样本的过程如下所示: % 打乱所有被试的编号 x = randperm(105); y = x(1:n); ...
function [eigVecs,eigVals] = ... DispEigCalcIsoSS(DiffMobObj,GridObj,ParamObj,Interactions,Diffusion,... SparseMat,kxHolder,kyHolder) % Vectors are column vectors Nm = ParamObj.Nm; % Prefactors DiagPreFac = -( DiffMobObj.D_par + DiffMobObj.D_perp) / 2 .* ... ( GridObj.kx(kxHolder) .^ 2 + GridObj.ky(kyHold...
clear; clc; global HAND; global threshold; threshold = 10; delta = 8; dr = 0.5; dh = -1; hi = 315.05; ri = -12.675; % dr = -0.5; % dh = 1; % hi = 90.05; % ri = 99.825; opengl software hvec = hi:dh:HAND;%315.05 rvec = ri:dr:(ri+(length(hvec)-1)*dr); % for i = 1:length(rvec) % [a, b, thetavec(i)] = findLimit(ri,h...
function sig = genSpikeSignal(m,n) % generate spike signal sig = zeros(n,1); ids = randperm(n,m); val = randi(2,m,1)-1.5 ; sig(ids) = val*2;
function v4 = rule4(n,boid,pred,zop,fov) % RULE4: function that calculates the effect of Rule 4: boids try to avoid % a possible incoming predator % % INPUTS: % n = number of boids % boids = boids position and velocity % pred = current predator position and velocity % zop = (circular) zone of predator avoidance ...
%PLC_EEG_Analyzer3.m %Created by YY, 1/22/15 %% Extract ERPs %Sub 48 52 (updated 2/8/15; old rej: 16,48,49,52) be removed from further EEG analysis due to too many %movements and preculiar extraneous experimental conditions (ie. refusal to %use chin rest, physiological symptoms during experiment, no contignency %retai...
function x = unitstep(t) % -- unitstep (t) % unit step function (heaviside function) % % if t >= 0 returns 1 otherwise 0. % if t < 0 x = 0 else x = 1 end end
function Check = checkRules(rules) N = length(rules); Check = zeros(N,1); for i = 1:N if isempty(rules{i}) Check(i) = 0; else t = strtrim(char(rules{i})); AND = strfind(t,'and'); OR = strfind(t,'or'); if length(AND) + length(OR) == 0 Check(i) = 1;...
function u = ctrlGetOutOfTheWay(~,z,xi,wn,P) % This controller attempts to actively move the motor out of the way, % preventing oscillations and allowing nearly free swinging of the pendulum qf = z(1,:); qm = z(2,:); dqf = z(3,:); dqm = z(4,:); Jm = P.Jm; % Motor inertia Ks = P.Ks; %Spring constant u = (Jm*wn*wn...
clear all; brick = ConnectBrick('EV3PP'); brick.beep(); global key InitKeyboard(); brick.ResetMotorAngle('C'); while true pause(0.01); switch key case 'uparrow' disp('forward'); forward(brick); case 'downarrow' disp('backward'); ...
% Ograniczenia du_max = 0.1; u_min = 0.6; u_max = 1.6; % Punkt pracy u_pp = 1.1; y_pp = 2.5; % Nastawy D = 200; N = 32; Nu = 3; lambda = 1; % Macierz M M = zeros(N,Nu); for i = 1:size(M,1) for j = 1:size(M,2) if i>=j M(i,j) = s(i-j+1); end end end % Macierz Mp Mp = zeros(N,D-1); for ...
clc; clear; x=input('Enter the first sequence: '); y=input('Enter the second sequence: '); display(' '); display(' Convolution with function:'); convolution_ans1=conv(x,y) lx=length(x); ly=length(y); con_l=lx+ly-1; x=[x zeros(1,con_l-lx)]; y=[y zeros(1,con_l-ly)]; for i=1:con_l ...
%% For reproducing Figure 6a-c combined subject data clear; close all; inits = {'Subject1','Subject2','Subject3'}; figure(1); clf; purple = [0.5961 0.3059 0.6392]; % load data allTrials = table; for ini=1:length(inits) load(['data/' inits{ini}]); allTrials = [allTrials; trials]; end D = unique(trials.Di...
% PROFILE - Profiles the performance of calculating sliding window correlations between large data sets. % % After writing the simple correlation function MEXCORRELATE in C earlier today, I decided it wouldn't require much more % effort to just write the whole sliding window algorithm in C for even greater efficien...
Nvoxels = 50; NSub = 100; X = round(rand(NSub,1)); a = 0.5; M = a.*repmat(X,1,Nvoxels) + randn(NSub,Nvoxels); b = 0.5; cP = 0.5; Y = cP.*X + b.*M(:,4) + randn(NSub,1); corr([X M Y]); BaseDir = '/home/steffejr/Scripts/TestThimgs'; data = {}; data{1} = X; data{2} = M; data{3} = Y; % Create a structure of corresponding...
function output = DeZigZag8x8(img) %DEZIGZAG8X8 Summary of this function goes here % Detailed explanation goes here ZigZag = [1 2 6 7 15 16 28 29; 3 5 8 14 17 27 30 43; 4 9 13 18 26 31 42 44; 10 12 19 25 32 41 45 54; 11 20 24 33 40 46 53 55; 21 23 34 39 47 52...
f = @(x) (1./(1+2.*x)) - ((1-x)./(1+x)); g = @(x) (2.*(x.^2))./((1+x).*(1+(2.*x))); %simplified version x = 2:1e-6:2.1; y = -1e-6:1e-10:1e-6; figure(1); plot(f(x)); figure(2); plot(f(y)); figure(3); plot(g(y));
% Compute the error of a pose-landmark constraint % x 3x1 vector (x,y,theta) of the robot pose % l 2x1 vector (x,y) of the landmark % z 2x1 vector (x,y) of the measurement, the position of the landmark in % the coordinate frame of the robot given by the vector x % % Output % e 2x1 error of the constraint % A 2x3 Jaco...
function [w2] = fitlinreg(y,X,lambda) w2 = (X' * X + (lambda*eye(size(X,2)))) \ (X' * y);
function [obj,ctrl_prob,gp_prob] = solve_HIFOO(obj,ctrl_prob,gp_prob) % Set options for controller design <- needs nice way to set them options.cpumax = 10; options.nrand = 5; options.epsilon = 0; % options.fast = 1; % set up some handy variables nobj = ctrl_prob.nobj; ncon = lengt...
function loglikelihood = ComputeLogLikelihood(P, G, dataset) % returns the (natural) log-likelihood of data given the model and graph structure % % Inputs: % P: struct array parameters (explained in PA description) % G: graph structure and parameterization (explained in PA description) % % NOTICE that G could be eit...
clear variables; close all; n_cases=24; cx=[0:n_cases]; cy=[0:n_cases]; [CX,CY]=meshgrid(cx,cy); hold on; mesh(CX,CY,zeros(n_cases+1,n_cases+1)); M = zeros(n_cases,n_cases); for k = 1:537 a = 1; switch a case 0 x = (n_cases) * rand(); y = (n_cases) * rand(); plot...
clear all; images = dir('./imgre/ojo*.jpg'); for img = 3:length(images) redEye = imread(['./imgre/',images(img).name]); figure, subplot(2,1,1), imshow(redEye); mask = getMask2(redEye); subplot(2,1,2), imshow(mask); end
% show slices and points given the brain area %************************************************************************** function[] = showSlicesOfArea(string) % string is a string including acronym of brain areas, / as separator % location of object points pointListFolder = 'H:\NP histology\probe_points'; % ...
classdef sphericalHarmonicsMatrix < matlab.mixin.SetGet %SPHERICALHARMONICSMATRIX: this class holds the coefficients and data for conversion to and from SH domain. % Constructor: % sh = sphericalHarmonicsMatrix; % creates an empty object. We need to populate this with the order, compute the T matr...
function A = generateSPDmatrix(n) % Generate a dense n x n symmetric, positive definite matrix A = rand(n,n); % generate a random n x n matrix % construct a symmetric matrix using either A = 0.5*(A+A'); %OR %A = A*A'; % The first is significantly faster: O(n^2) compared to O(n^3) % since A(i,j) < 1 by construction a...
function save_figure( figure, name, height, width ) FIGURES_DIR = 'figures'; % Format figure to specified size set(figure,'Units','inches'); set(figure,'Position', [1 1 width height]); set(figure,'PaperPositionMode','auto'); %set(figure,'Units','normalized','Position',[0.15 0.2 0.75 0.7]); % Find the current...
function [ cache, cache_index ] = cache_get_entry_by_hash( cache, yhash_i, psi_i, loss_i, ... cache_scores, max_cache_size, removeFromActiveSetIfFullCache ) % [ cache, cache_index ] = cache_get_entry_by_hash( cache, yhash_i, psi_i, loss_i, ... % cache_scores, max_cache_size, removeFromActiveSetIfFullCache ) % %...
function mysim_nav_swarm_comms % initial dynamic state [pos;vel] in 2D % each column is one agent % random initial position, stopped Nagents = 30; x = [3*2*(rand(2,Nagents)-0.5)-3; zeros(2,Nagents)]; % initial channel simulation for comms channel = initChannel(); % initial decision maker memory % same for each a...
% Clear the command window clc; %% Estimation with linear hedonic price gradient % Perparing First Round Variables/Data n = numel(Y); p = Y'; intercept = ones(2404,1); x = [intercept walleye salmon panfish ramp restroom]; X_names = strvcat('intercept', 'walleye', 'salmon', 'panfish', 'ramp', 'restroom' ); for i = n...
%Tally辅助变量最小二乘的递推算法 %Z(k+2)=1.5*Z(k+1)-0.7*Z(k)+u(k+1)+0.5*u(k)+e(k),e(k)为有色噪声 %e(k)=v(k)+0.5*v(k-1)+0.2*v(k-2),v(k)为零均值的不相关随机噪声 %======================================== clear clc %==========产生M序列作为输入=============== x=[0 1 0 1 1 0 1 1 1]; %initial value n=403; %n为脉冲数目 M=[]; %存放M 序列 for i=1:n temp=xor(...
% odev 3, % katsayilar = polyfit(x,y,derece) ilgili katsayilar verir % odevde polyfit kulanilmayacaktir!!! % % ornek % Close all figures, clear variables in memory and MATLAB command screen close all; clear all; clc; % Set the output format to the short format with compact line spacing format short; format compact;...
clc; close all; %parzen window %[fileID, errmsg] = fopen(filename); %disp(errmsg) nc = 3; % number of classes [traindata] = textread('wine_uci_test.txt'); [testdata] = textread('wine_uci_train.txt'); testdata_size = size(testdata,1); c = size(traindata,1)/nc;%number samples in each class nf = size(traindata,2);% number...
function [ polygon ] = Make( pixelList_xy, polyIdx, label, frame, color, reductions, quiet ) %[ polygon ] = D3d.Polygon.Make( pixelList_xy, polyIdx, label, frame, color, reductions, quiet ) if (~exist('color','var') || isempty(color)) color = [1,1,1,1]; end if (~exist('label','var') || isempty(label)) label = ...
function ret = open ret = 1; end
function [plotCSV] = csvPlot( fileName ) fileName = csvread(fileName); [m,n] = size(fileName); joint1AngVel = fileName(:,1)' joint2AngVel = fileName(:,2)'; joint3AngVel = fileName(:,3)'; time = fileName(:,4)'; figure(2) hold on; plot(time, joint1AngVel, time, joint2AngVel, time...
function [net, stats] = loadState_deploy(fileName) % ------------------------------------------------------------------------- load(fileName, 'net', 'stats') ; net = dagnn.DagNN.loadobj(net) ;
%function C_list = Search_Salient_points(Ds_i) %clear all Records =load('Senders and recievers.csv'); [~,j]=size(Records); selected_user_number =400; for user=1:selected_user_number %% Determine the number of users up to 400 Try(1,:) = Records(user,:); %% use to select user Try(2,:)= [1 2 3 4 5 6 7 8 9 10]; C...
%------------------------------------------------------------------------------------ % rh_temp_vertWindow.m % % analysis of multi-model data from RCEMIP, 21 models at time of writing % % creates plots of relative humidity, fractional detrainment rate, and wv lapse rate % plotted as a function of temperature % % the wa...
function [figureHandles, axesHandles] = PlotEdgesTimeAverage(roiSummaryMatrix,allParamsPlot,timeShift, duration, regCheck, numPhases, varargin) detectorArray = true; paramsPlot = allParamsPlot(1); repeatSection = true; barToCenter=2; if any(strcmp(varargin, 'detectorArray')) detectorArray = varargin{[false strcm...
function SFNet = SFNG(Nodes, mlinks, seed) seed = full(seed); %zabezpieczenie, zapisuje w postaci macierzy pos = length(seed); %ilosc wezlow w macierzy seed Net = zeros(Nodes, Nodes, 'single'); %tworzy macierz zerowa Net(1:pos,1:pos) = seed; %przypisuje seed do glownej macierzy, by zaczac od tego miejsca sumlinks = sum...
%% build final models that only omits the last lasso iteration % needed for face - noFace - whole brain contrast clear; %% Preparation % CONSTANTS NUM_OMIT = 1; NUM_FOLDS = 10; LABEL = 'TrueFaces'; % Load the results wholeBrain = load('JLP_HF_TrueFaces.mat'); faceOnly = load('JLP_HF_onlyFace_TrueFaces.mat'); noFace...
% Calculate responses for gaussian RBF units from sample vector x function Phi = calcPhi(x, m, var); %Dimension the function matrix fi Phi = zeros(rows(x), rows(m)); %Calculate the RBF responses for i = 1 : rows(x) Phi(i, :) = gauss(x(i, :), m, var)'; end
function [m, var] = initrbf(units, dims, dmin, dmax); % plots rbf set two dimensionally as points. p1 and p2 are the actual % dimensions plotted. Here we assume that the variances per unit are % one dimensional. %i=rows(m); span = abs(dmax - dmin); m = rand(units, dims)*span + min(dmin, dmax); sdev = 0.1*span*ones(unit...
function [ GMST ] = MJD2GMST( MJD ) %[ GMST ] = MJD2GMST( MJD ) Convert Modifided Julian Date to Greenwhich %Mean Siderial Time % INPUT % MJD - Modified Julian Date % OUTPUT % GMST - Greenwhich Mean Sidereal Time % % Function by: % Shawn Swist ~2018 GMST = 280.4606 + 360.9856473*(MJD-51544.5); ...
function theta = PPLR(X,y,epsilon,initial_theta) [~,N] = size(X); lambda1 = 2; t = gamrnd(N,2/(epsilon*N*lambda1) ); b = rand( N,1 ); s = sign(rand(N,1)-0.5); b = s.*b/norm(b)*t; [theta, cost] = fminunc(@(t)(objFunction_PPLR(t, X... , y ,b )), initial_theta); end
% comment classdef runSim properties basePath = '/Users/jeremysment/Documents/ClassWork/ClassesF12/NeuralNetworks/ProjectDocs2012/Project/svn/' %basePath = '/Users/casper/cs547-svn/'; end methods % Called first to load the jar function init(this) javaaddpa...
function [ref_x] = jeden_krok(r,okno) %Funkce jeden_krok stanovuje vlnu/kmit, který je charakteristický %u konkréního naměřeného signálu pro jeden krok. %Vstupy: % r = vstupní signál % okno = délka okna, které klouže po signálu, pomocí kterého se % signál po určitých charakteristický...
function [output] = mapingF(block, subkey) b1 = block(1); b2 = block(2); b3 = block(3); b4 = block(4); k11 = subkey(1); k12 = subkey(2); k13 = subkey(3); k14 = subkey(4); k21 = subkey(5); k22 = subkey(6); k23 = subkey(7); k24 = subkey(8); % expansion / permutation of input block ep = horzcat(b4, b1, b2,...
function [y] = ex_post_W1(a,b,c1,x,c2,n,k,th1) % What is the equilibrium demand and price? Qs = exp(a-b*(c1+x)); Q2 = max(0,c1+x+th1-c2); if Q2 <= Qs; p = c1+x; else; q0 = [Qs exp(a)]; Q2 = fzero(@m1_comp_Q,q0,[],a,b,c2,th1); p = (a-log(Q2))/b; end CS = exp(a-b*p)/b; PS = Q2^2/2; ...
function lr_test(name) disp('======Training======'); % load data from csv files % data = importdata('data1_train.csv'); data = importdata(strcat('data/data',name,'_train.csv')); X = data(:,1:2); Y = data(:,3); % Carry out training. % outputs an approximation of a function's gradient % fn: function whose gradient is...
%% 时域信号 Fs=1000; %采用频率 f1=50;f2=125;f3=135; N=5012;Nfft=N;n=0:N-1;t=n/Fs; %采用的时间序列 xn=cos(2*pi*f1*t)+1.5*cos(2*pi*f2*t)+cos(2*pi*f3*t)+1.5*randn(size(n)); figure; plot(t,xn);grid on;title('时域信号 t——y '); %% % 该函数计算的是功率谱归一化后的结果,计算公式中还除了Fs,量纲为dB/Hz。 % 比普通的周期图法大大约3dB window= boxcar(length(xn)); ...
function [u_T, lambda_T] = Autov(A) %% %Compute the eigenvector assiacted with the largest eigenvalue and the eigvenctor % of a adjacency matrix A. % Input: % A: Adjacency Matrix % Output % u_T: Eigenvector % lambda_T: Largest eigenvalue %% [W, D] = eig(A);% V eigenvector column % D diagonal matrix ...
function [ a ] = Zhang_CoSaMP( u,Phi,s ) % CoSaOMP construct a signal approximation given the compressive samples. % Based on the CoSaMP algorithm proposed in "Iterative signal recovery from incomplete and inaccurate samples" % Detailed explanation goes here % input u(R*1) is the noisy sample vector % inp...
function [W,C,Lambda,avgAc,stdAc,accuracy] = calculation(X,Y) [numFeature,numSample]=size(X); class1=X(:,1:numSample/2); class2=X(:,numSample/2+1:numSample); label1=Y(1:numSample/2); label2=Y(numSample/2+1:numSample); setPara.W=ones(numFeature,1); setPara.C=0; setPara.t=1; setPara.Epsilon=0.000001; setPara.Beta=15; se...
function Exp= initTriggers(Exp) %====================== %SET TRIGGER PROPERTIES %====================== % Create a device object % dio = digitalio('nidaq',1); % warning('off', 'daq:digitalio:adaptorobsolete'); % dio = digitalio('parallel','LPT1'); daqhwinfo('parallel'); Exp.Trigger.dio = digitalio('parallel'...
function idof = smoothitudc_idof (time, dof, itime, inum, dt, idof_method, ignore_self) %SMOOTHITUDC_IDOF Interpolation of degree-of-freedom for smooothitudc. if (idof_method==0), idof = []; return; end if isscalar(dof) idof_sum = inum * dof; else [idof_sum, idof_avg] = smoothit (time, dof, dt, itime...
load('f10.mat'); cols = [0.9 0.3 0.3; 0.3 0.3 0.3]; f=figure; mhi = squeeze(mean(d)); ehi = squeeze(std(d)./sqrt(size(d,1))); e=errorbar([1 1; 2 2], mhi, ehi, 'LineWidth', 1.2); e(1).Color =cols(1,:); e(2).Color = cols(2,:); ylim([0 0.6]); xlim([0.5 2.5]); t=gca; t.XTick=[1 2]; halfstr ={'First Half', 'Second Half'}...
function startRpts(appName) % startRpts(appName) % Sets the 'rptMsgFlag' field of all applications under the APPS % structure to true if no arguments are given. Otherwise, turns on % the rptMsgFlag of the application whose field name under APPS is % specified by the string 'appName'. % % Usage: startRpts % sta...
% ti_checkerboard_2d: 2D checkerboard TI % % TI=ti_checkerboard_2d(w,N,ncat) % w: width of checkerboard % N: Number if pixels in each direction % ncat: Number of categories % % % examples: % TI = ti_checkerboard_2d(2); % TI = ti_checkerboard_2d(3,10); % TI = ti_checkerboard_2d([3 3],[30...
function [avg, bins] = isoscalar_average(data, scalar, bins) if isscalar(bins) bins = linspace(min(scalar), max(scalar), bins); elseif isvector(bins) bins = bins; end Y = discretize(scalar, bins); % this is the slow step avg = nan(size(data, 1), length(bins)-1); for binindex=1...
classdef location < handle properties ID; database_index; index; x; y; group; end properties(Constant,Hidden) INDEXcol =2; Xcol = 3; Ycol = 4; GROUPcol = 5; IDcol = 6; end ...
function PhasePanel=PhaseHARHAR(T, EXP); % PhaseHARHAR - Phase panel for the HARHAR stimulus GUIs. % F=PhaseHARHAR(Title, EXP) returns a GUIpanel F allowing the % user to specify the phase component of the harmonic. % The Guipanel F has title Title. EXP is the experiment % definition, from which the number of...
function result=perimeter_in(long,lat,fire_area,wrfout,time_now,time,interval,count); % Volodymyr Kondratenko July 19 2013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Input: % long,lat longtitude and latitude converted to meters % fire_area fire map,[0,...
function [tsnp, err, errmsg] = tsnpimporti(fts, varargin) % (c) Jianhua Zhou 2012, 2013, 2014 % % Description: imports network parameters in Touchstone file, % returns the S,Z,Y and other allowable network parameter data in tsnp struct. % noise data is ignored % Input variables: % ...
%==数据预处理===== close all; for i = 1979:2016 year_num = int2str(i); dataname = ['./data/',year_num,'_area.txt']; [y,m,d,Data,Minimum,b10,b30,Mean,b70,b90,Maximum] = textread(dataname, ... '%d-%d-%d %f %f %f %f %f %f %f %f',360,'headerlines',6); nan_colm = find(Data == -9999); Data(nan_col...
% % Copyright 2016 Vienna University of Technology. % Institute of Computer Graphics and Algorithms. % function[P1P2_saved, P2P3_saved, P3P1_saved, Normal_normalized, P1P2_length, P2P3_length, P3P1_length, Area, alpha, beta, gamma, angles_sum, angles_max, angles_min, angles_avg] = Triangles() %% General Hints: % If yo...
function result = NatureNeighborSpectralClustering(filename) X = load([strtrim(filename),'.txt']); C_Label = load([strtrim(filename),'_label.txt']); K = length(unique(C_Label)); % Number of clusters N = size(X,1); Dist = squareform(pdist(X)); sigma = max(Dist(:)); tmp = Dist.^2/sigma; A = exp(-tmp); Na...
function latex_string = tableLatex(input_table, with_table_environment, with_resize, table_name) export_as_file = false; with_resize = false; if (nargin < 2) with_table_environment = false; table_name = ''; elseif (nargin < 3) table_name = ''; elseif (nargin < 4) ta...
% Roselynn Conrady M E 556 % MATLAB image from Lecture 3 and 4 clear all; close all; I = imread('photo_sample.jpg'); I1 = rgb2gray(I); I2 = imnoise(I1, 'gaussian'); % adding noise figure, imshow(uint8(I2)) % Median filtering w/o built in function FS = 3; sigma = FS/3; [rows, cols] = size(I1); I2 = I1; for i = (F...
function emotion = emotion_detector(neutral, extreme) %import image data as taken from clm_trackr data = dataInit(); [~, ~, ~, Mdl] = svm_classify(data); [~, e_align] = procrustes(neutral,extreme); emotion_feature = neutral - e_align; confidences = zeros([1,length(Mdl)]); for i = 1:length(Mdl) [~, score] = predi...
clc; close all; clear all; x=imread('cameraman.tif'); subplot(3,3,1); imshow(x); title('colour image'); for i=1:256 for j=1:256 y(j,i)=x(257-i,j); end end subplot(3,3,2); imshow(y); title('rotate 90 degree'); for i=1:256 for j=1:256 z(j,i)=y(257-i,j); end end ...
% % hw1q2_ADALINE.m-- % % % Developed in Matlab 9.5.0.944444 (R2018b) on Debian 9. % Ayberk Karaakın (ayberk.ka@gmail.com), 29.10.2018 % Repository: https://github.com/akarakn/Perceptron-ADALINE.git %------------------------------------------------------------------------- %----------------------------Not workin...
% FAST-ADAMS-Simulink CertTest comparisons: function PlotCertTestResults( newPath, oldPath, PlotFAST, PlotAdams, PlotSimulink ) %function PlotCertTestResults( newPath, oldPath, PlotFAST, PlotAdams, PlotSimulink ) % This function plots the FAST, ADAMS, and/or FAST_SFunc CertTest results, % comparing .out/.plt, .elm, ....
function length = GetPathLength(path,cityLocation) % Reusing already written function length = CalculateRouteLength(path, cityLocation); end
function valid = ishandleandvalid(h) valid = ~isempty(h) && isvalid(h); end
Vin = 0.002; L = 1.5; W = 0.8; h0 = 0.5; D = 0.038; g = 9.81; uout = @(h) sqrt(g*h/2.5); func = @(t,h) Vin/L/W - pi*D^2/4/L/W*uout(h); [t,h] = ode45(func,[0,900],h0); plot(t,h,'*'); xlabel('time (s)'); ylabel('height (m)'); grid on;