text
stringlengths
8
6.12M
function Space = ChebyshevSpace(Start,End,Length) if (nargin < 3) Length = 100; elseif (nargin > 3) error('Too many input arguments passed to LinearSpace') end switch (Start ~= End) case (true) Avg = (Start + End) / 2 ; MidDist = (End - ...
%------------------------------------------------------------------------% %---Finite Differencing of Time Independent Schrodinger Equation---------% %------------------for a particle in a box-------------------------------% %------------------------------------------------------------------------% clc close all clear...
%% % SUMMARY: Generates mxm synthetic image used as input for various % experiments. % % Specifically, images are generated by first choosing a randomly positioned % "foreground" square. The size of this square is a parameter % ("fraction_fg") that is a fraction of the total image's area. Intensities % of background p...
tic; videoReader = vision.VideoFileReader('store1.mp4', 'ImageColorSpace',... 'Intensity', 'VideoOutputDataType', 'uint8'); converter = vision.ImageDataTypeConverter; opticalFlow = vision.OpticalFlow('ReferenceFrameDelay', 1); opticalFlow.OutputValue = 'Horizontal and vertical components in complex form'; shapeIns...
function C = main(X,epsilon,MinPts) %% Run DBSCAN Clustering Algorithm [IDX,noise,C]=DBSCAN(X,epsilon,MinPts); %% Plot Results PlotClusterinResult(X, IDX); title(['DBSCAN Clustering (\epsilon = ' num2str(epsilon) ', MinPts = ' num2str(MinPts) ')']);
function z=ParticleAtTheLeft(NParticle,NStep) %% Функция, возвращающая единичную реализацию зависимости n=n(t) % NParticle-число частиц в левой половине ящика в момент времени t=0 % NStep-длина еденичной реализации LeftN(1)=NParticle; for i=2:NStep Prob=LeftN(i-1)/NParticle; if rand(1)<=Prob Lef...
% Spectral Ewald 0P (free-space) Laplace, basic accuracy/convergence computation clear rng(1); N = 5000; % number of source particles L = 3; % box side length box = [L L L]; % periodic box [x, f] = NEW_vector_system(N, box); % random sources Neval = N; % number of evaluation points % Ewald parameters M0 = 16; % Set ...
function Filter3 = gene_ThirdOctave_Filters(Fs) %%%%%%%%%%%%%%% % % Filter3 = gene_ThirdOctave_Filters(Fs) % % FUNCTION % This function designs IIR filters for each third octave bands with % the following center frequencies % Fc = [25, 31.5, 40, 50, 63, 80, 100, 125, 160, 200, 250, 315, 400, 500,...
function R = rotMat(theta) R=[cos(theta) -sin(theta); sin(theta) cos(theta)];
function diff_fig(old,new,var,i,j) var_old=old.(var); var_old=var_old(i,j); var_new=new.(var); var_new=var_new(i,j); [ii,jj]=ndgrid(i,j); subplot(1,3,1) mesh(ii,jj,var_old) title([var,' old'],'Interpreter','none') subplot(1,3,2) mesh(ii,jj,var_new) title([var,' new'],'Interpreter','none') subplot(1,3,3) mesh(ii,jj,var_...
w = linspace(-pi,pi); b = [0.3 0.24]; a = [1 -0.9]; h = freqz(b, a, w); subplot(2,1,1) plot(w, abs(h)) title('mag(H(w))') xlabel('w') ylabel('mag (dB)') axis([-pi pi 0 6]) subplot(2,1,2) plot(w, angle(h)) title('phase(H(w))') xlabel('w') ylabel('phase (deg)') axis([-pi pi -2 2])
function eig=QuickBisection(A,a,b,tol) %% % Using Sturm sequences and Bisection to solve for all eigenvalues of % A in [a,b]. % This is a naive version which has no detection of bad edge cases. % precondition: the eigenvalues of A must be unique in context of % tolerence. A is tridiagonal and PS...
function [L_j, L_jj] = Linear_Interp(t_j, t_jj) %t_a = lower bound of integration %t_b = upper bound of integration %t_c = syms tau L_j = (tau - t_jj) / (t_j - t_jj); L_jj = (tau - t_j) / (t_jj - t_j); end
function m = mape(testY, pred) % Compute mean absolute percent error % % m = mape(actual, pred) % % actual is a column vector of actual values % pred is a matrix of predictions (one per column) % % m is the mean absolute percent error (ignoring NaNs) for each column of % pred. % Copyright 2014-2015 The MathWorks, Inc...
%% ArimotoBlahutDiscretise usage example % Iteration = 1000; % Tollerance = 0.05; % % m = 1; % n = 1000; % % sigma = 1; % s = [1 2 3]; % createdata = @(s) normrnd(s, sigma, n, m); % data = [createdata(s(1)), createdata(s(2)), createdata(s(3))]; % % K = 0.6:0.01:1; % binsnumbers = 10:1:50; % % [Cbias Clinear] = A...
function indxout = BuildIndexMF(range,indxin) % BuildIndexMF: Given a range, make the corresponding index % See BuildRangeMF for more detail % indxout = BuildIndexMF(range,indxin) % If indxin is absent, the range is interpreted literally, otherwise the % subrange of indxin is returned for i = 1:size(range,2) indxo...
function this = plus(this, d2) % See help on dbase/dbplus. % -IRIS Macroeconomic Modeling Toolbox. % -Copyright (c) 2007-2017 IRIS Solutions Team. pp = inputParser( ); pp.addRequired('this', @isstruct); pp.addRequired('d2', @isstruct); pp.parse(this, d2); %-------------------------------------------------...
%% E.m % % Function that performs the matrix-vector multiplication that models a 2D % parallel MRI experiment for given arbitrary k-space trajectory and % sensitivity maps. % % INPUTS: * the original 2D image % * a structure containing the parameters (k-space trajectory, % sensitivity maps, metho...
function [U, S] = pca(X) %PCA Run principal component analysis on the dataset X % [U, S, X] = pca(X) computes eigenvectors of the covariance matrix of X % Returns the eigenvectors U, the eigenvalues (on diagonal) in S % % Useful values [m, n] = size(X); % You need to return the following variables correc...
nboot = 1000; genotype = 'WT'; epoch = 'sleep'; groupDefs = struct('genotype',genotype,'behavioral_state',{'sleeping','resting','moving'},'epoch',epoch); groupNames = {'Sleeping','Resting','Moving'}; projDir = '~/Projects/rn_Schizophrenia_Project/'; baseFigDir = [projDir 'RZ-RW_PrelimAnalysisFigs/']; baseFigDir = [bas...
% newstring = stripString(oldstring, toremove) % % Removes all instances of string TOREMOVE from string OLDSTRING and % returns the modified string. % % 05.18.07 - S.Fraundorf % 11.21.09 - S.Fraundorf - replaced stripCharacter with this. % improved efficiency with strrep function newstring = s...
%% SUMMARY_BAR -- Script interface to summary_bar() conf = dsp2.config.load(); date = '072617'; kinds = { 'nanmedian' }; sfuncs = { @nanmean }; measures = { 'coherence' }; epochs = { 'reward', 'targacq' }; manipulations = { 'pro_v_anti' }; to_collapse = { {'trials', 'monkeys'} }; bands = Container( {[15, 30]; [35, ...
function [ angle ] = anglecorrection( angle ) % ANGLECORRECTION removes the values that generate singularity on the % measurement of the angles for all length of array % for i = 2:length(angle) % if ((angle(i) - angle(i-1)) < - 0.5 ) % angle(i) = angle(i-1) + (angle(i) - angle(i-1)) + pi * 2; % elseif...
function [ A ] = SudokuBacktracker( A ) [C,s,e] = candidates(A); p=256; k=sqrt(p); while ~isempty(s) && isempty(e) A(s) = C{s}; [C,s,e] = candidates(A); end if ~isempty(e) return end %% backtracking if any(A(:) == 0) B = A; z = find(A(:) == 0,1); for x = [C{z}] A = B; ...
function [list, errors] = visitNode(tree, data) errors = 0; list = []; len = length(data); len_tree = length(tree); for row = 1:len x = data(row).line; x_len = length(x); x_new = zeros(1,70000); y = x(1); if x_len >1 for j = 2:x_len ...
function [indicador]=compare(input_image,background,threshold) indicador = 0; %% % Perform image difference from the new image and the background image difference = (abs(input_image(:,:,1) - background(:,:,1)) > threshold) | (abs(input_image(:,:,2) - background(:,:,2)) > threshold) ... | (abs(input...
function J = costFunction(X, y, theta) % X is the 'design matrix' contains our training examples % y is the class labels m = size(X, 1); predictions = X * theta; sqrErrors = (predictions - y) .^ 2; J = 1 / (2*m) * sum(sqrErrors); endfunction
% find which set of 4 segments has the top of the tee % assume that the Tee bar is the longest side in one set that has 3 other % shorter segments that total about the same length % also reorder the set to give the crossbar 1st, the 2 sidebars second % and the foot last function [flag,headset] = findheadset(set1,set2)...
function per_sol() find_figure('per_sol'); clf; hold on; h1=subplot(3,1,1); hold on; h2=subplot(3,1,2); hold on; h3=subplot(3,1,3); hold on; R=5.0/2; %%% calculate and plot the texture % inf solition xx0= -3*R:0.01:3*R; a0 = 2*atan(exp(xx0)); plot(h1, xx0,a0, 'k-') % periodic solitons xx= -R...
%% ranges lb_x=-2;N_x=100;ub_x=2; lb_y=-3;N_y=100;ub_y=3; % lb_x=-5;step_x=0.2;ub_x=5; % lb_y=-5;step_y=0.2;ub_y=5; x=linspace(lb_x,ub_x,N_x); y=linspace(lb_y,ub_y,N_y); %% xlab = 'weight w_1'; ylab = 'weight w_2'; % xlab = 'x'; % ylab = 'y'; %% Weighting for the sloped [X,Y] = meshgrid(x,y); Z = weighting(Y); fig = fi...
% simple accuracy track function behavior_accuracy(vars) wind = -49:50; count = 0; T_Range = 50:10:length(vars)-50; accuracy = NaN(1,length(T_Range)); for i = T_Range count = count+1; Tr = i+wind; accuracy(count) = mean((vars(Tr,3)-vars(Tr,6)>0) == (vars(Tr,9)==1)); end figure; plot(T_Range,accuracy*100); y...
function [ G ] = filtre_gradient( I,method ) switch method case { 'sobel','prewitt' } h = fspecial(method); case 'roberts' h = [-1 0 0;0 0 0 ; 0 0 1]; case 'MavoVassy' h = [0 1 1 ;-1 0 1; -1 -1 0]; case 'laplacian' alpha = input('laplacian...
function postProb=GMM_LIKELIHOOD(d,DataPoint,K,PI,Means,Cov) format long; postProb=0; for i=1:K postProb=postProb+PI(1,i)*N(d,DataPoint,Means(i,:),Cov(:,:,i)); end
%17-16 w = input("length of side of square in mm: ")/1000; p = input("area density of material in kg/m^2: "); massCir = (pi*w.^2*p); massSqr = (w.^2*p); Io = .5*massCir*w.^2 + massCir * w.^2 -(1/12)*massSqr*2*w.^2 - massSqr * w.^2; sprintf("moment of inertia of plate is %.3f kg m^2", Io)
function [y, opt] = WrapperPred(X, opt) % % WrapperPred(X, opt) gives the prediction for data in X using the fields % in struct OPT. % % Use: For evaluating IterativeRLSWrapper functions. % % NOTE: This is function is probably obsolete and should be removed. if ~isa(opt, 'GurlsOptions') % warning('Compatibility mo...
function fig = spikeWaveformsFromOps(ops, sp, varargin) % PLOT WAVEFORMS % Inputs: % ops@struct - ops struct % sp@struct - spikes struct % Optional Arguments (as pairs) % 'figure' - figure number or handle % 'numWaveforms' - default 500 % 'postSpikeBuffer' - numbe of samples after spike t...
% Calculate covariance according to spectrum % spectrum S is p * p * fftlen dim matrix % m is the max offset of covariance R you want % note that the length of fft should at least 2*(m+1), bigger can reduce bias problem function R = S2cov(S, m) [p, q, fftlen] = size(S); covs = real(ifft(S,fftlen,3)); R = zeros(p,p*(m...
%% UiTerminating classdef UiTerminating < event.EventData properties LeavePlantRunning logical; end methods function this = UiTerminating(leavePlantRunning) arguments leavePlantRunning logical = false; end this.LeavePlantRu...
classdef MvnJointGaussInfEng < JointGaussInfEng % everything done in JointGaussInfEng methods(Access = 'protected') function [mu,Sigma,domain] = convertToMvn(eng,model,varargin) %#ok mu = model.params.mu; Sigma = model.params.Sigma; d...
%Monte Carlo De-noising for Binary Images %Read noisy image data rng(0); format long X = textread('stripes-noise.txt'); %Read true pixel values I = textread('stripes.txt'); %Initialize parameters - *** UNCOMMENT the one you need *** %WP = 0; %WL = 0; WP = 1; WL = 1; %WP = 1; %WL = -1; %WP = -1; %WL = 1; %WP = -1; %WL...
function direction_matrix=mtlrdir(filename,n_directions) % function direction_matrix=mtlrdir(filename,n_directions) [fid,message] = fopen(filename,'r','ieee-le'); if fid==-1 % file can't be opened disp(message); return; end; fseek(fid,512,'bof'); direction_matrix=fread(fid,2*n_directions,'f...
clear close all clc %Intervall [X,Y] = meshgrid(-2.5:.25:2.5,-2.5:.25:2.5); %Bestimmung des Tangentialvektors: 1 + f(x,y).^2 N = sqrt(1+Y.^2./X.^2); U = 1./N; %f(x,y)/N V = -Y./X./N; %Graph (0.5 = Verkürzungsfaktor der Vektoren) quiver(X,Y,U,V,0.7)
clear all clc %IVP condition sx = [1 100]; x = linspace(5,10,sx(2)); Y = zeros(sx); Y(1) = 2; f = @(p,q) (sin(p))^3 + (tan(q))^(2); for i = 1:sx(2)-1 Y(i+1) = Y(i) + f(x(i),Y(i))/sx(2); end plot(x,Y,'black'); axis equal;
%% example of training and testing OSVR for expression intensity estimation clear all; close all; %% load data % train_data_seq: an array of cells containing training feature sequences, % each cell contains a D*T matrix where D is dimension of feature and T is % the sequence length % train_label_seq: an array o...
function[W_WheelMainGear, W_WheelNoseGear, W_DynamNoseGear, LbsReqMainGear, LbsReqNoseGearStatic, LbsReqNoseGearDynamic] = WheelLoads(W0, x_NoseGear, x_MainGear, x_cg_min, x_cg_max, z_cg_max) % This function is used to calculate the wheel loads % Going off of the rough guidelines, we can decide to have the main gea...
% Simple ndf_*.m example for CNBI loop. It implmements alpha rhythms % monitoring on channel Cz, when coupled with a gTec gUSBamp. % Classificiation output is forwarded to a feedback through iC interface. function ndf_miw() % Include any required toolboxes ndf_include(); %addpath(genpath('/home/cnbiadmin/Git/Miw/MOD_...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% MXB324 % Group 1: Johnathan Adams, James Beattie, Georgia Harman, Thyraphol Sutanujinda % Dalby Groundwater model % Main Script Operations Script %%%%%%%%...
% Löschen clc close all % überflüssig clear all % format long % Fourier syms x fx = log(x+1); %% n1 = 3; summe1 = 0; for j=(-n1):n1 c = (1/(2*pi))*int(fx*exp( (-1i)*j*x), 0, 2*pi); % immer j statt n summe1 = summe1 + c*exp(1i*j*x); end y1 = summe1; % %% % % n2 = 9; % summe2 = 0;...
function response1 = getResponse1(gfunc,DNew,Vocc,occ,opt1D,index) Nt = length(occ); NsGrid = opt1D.NsGrid; DIM = 1; na = opt1D.Ne; % na = Ne; response1 = zeros(NsGrid,1); for i = 1:Nt for j = 1:Nt if( abs(occ(i) - occ(j)) > 1e-8 ) response1 = response1 + gfunc(Vocc(:,i)).*conj(Vocc(:,j)) ...
function [W, b] = My_FCNN (X, Y, learning_rate, activation_function, num_epoch, num_units, keep_prob, batch_size, update_algorithm, print_flag, plot_flag, save_flag) %%%%%% My Fully Connected Neural Network %%%%%% 函数功能描述: % 输入训练数据X和对应标签Y以及其他网络参数,训练输出全连接神经网络各层神经元的权值矩阵W和偏置向量b(cell结构) % 网络中的非线性激活函数采用ReLU或者...
audio_file = strcat("Sample/","ADha.wav"); audio_file = char(audio_file) [y,fs] = audioread(audio_file); plot(psd(spectrum.periodogram,y,'Fs',fs,'NFFT',length(y)));
function S = fSimulateRDMP(param, Stimulus) % fSimulateRDMP models models a simple RDMP model for % % Inputs: % Stimulus: structure of input % Stimulus.prob probability of reward for a color % param: structure of parameters value % param.nSt...
function [ Out_Im ] = bilinInterp( CFAIm,BinFilter,CFA ) %BILININTERP Summary of this function goes here % Detailed explanation goes here MaskMin=1/4*[1 2 1;2 4 2;1 2 1]; MaskMaj=1/4*[0 1 0;1 4 1;0 1 0]; if ~isempty(find(diff(CFA)==0)) || ~isempty(find(diff(CFA')==0)) MaskMaj=MaskMaj.*2; end Ma...
function [norm_pdfs_bp] = txminer_apply_bp(data,norm_pdfs) addpath BP_macos % addpath BP C = 0.01; beta = 1e-3; eps = 1e-2; nComponents = length(norm_pdfs(1,1,:)); [nrows, ncols] = size(data); % Get the data in the cell format required by SmoothBP Beliefs = cell(nrows, ncols); for i = 1:nrows for j = 1:ncols ...
function LONG_pushAVGtoICBMviaDARTEL(scans_to_process, templatepath) %LONG_pushAVGtoICBMviaDARTEL - warp longitudinal images from subject avg to %ICBM % % Syntax: scans_to_process = LONG_pushAVGtoICBMviaDARTEL( scans_to_process) % % Inputs: scans_to_process - array of objects of class LONG_participant, % tem...
function [p_y_given_x,y_pred] = h_o_layer(input,w,b,activation) if activation == 'sigmoid' p_y_given_x = (1 ./ (1 + exp(-(w*input+repmat(b,[1 size(input,2)]))))); elseif activation == 'softmax' p_y_given_x = softmax((w*input+repmat(b,[1 size(input,2)]))); end [pred_max y_pred] = ma...
%% PCA降维 %% 加载数据 load fisheriris; X = meas'; %% PCA降维 % 中心化 meanX = repmat(mean(X,2),1,size(X,2)); center_X = X - meanX; % 求协方差矩阵 C = 1/size(X,2) * (center_X * center_X'); % 求特征值并降序排序 [W, Lambda] = eig(C); sum(W.*W, 1) % 可以验证每个特征向量各元素的平方和均为1 feature = diag(Lambda)'; feature = feature(:,end:-1:1...
function [best_err, A_out, Z_out, best_m] = Refine_EM(c,Z, y, Q, K) %round to K N = length(y); [c2, ind] = sort(c,'descend'); best_err = 1e300; T=100; m_upper = 8; for m = 1:min(m_upper,length(c)) %count frequency of distinct patterns of length k [Zuni,ia,ic] = unique(Z(:,ind(1:m)),'rows'); [ic2,ind2] = sort...
function poly=inset(skel,h) % INSET - Polygon inset from a straight skeleton % Inset takes the vectorized skeleton, skel, of a polygon and uses that % to compute the polygon inset of the original polygon. The inset % distance is specified as h >= 0. The output polygon may contain a % number of perimeters (w...
function [ score ] = realizedRet( inSeq, varargin ) %% realizedRet 算从第N步到现在的收益 % [ score ] = realizedRet( inSeq ) % returns realized logarithmic return starting from N slices before. % % [ score ] = realizedRet( inSeq, MODE ) % MODE is optional. It decides if logarithmic or ordinary return will % be used. % 'c' log...
%% Evaluate_EOS_Instruments.m % RBES_Init_Params_EOS; % [r,params] = RBES_Init_WithRules(params); % mission_set{1} = create_test_mission('ACRIM',{'ACRIM'},1990,8,[]); % mission_set{2} = create_test_mission('SOUNDERS',{'AIRS','AMSU-A','HSB'},1990,8,[]); % % orbit.altitude = 1300; % orbit.i = 'near-polar'; % orbit.raan...
function [minx, miny] = Refinement(impartL,impartR) %% quadratic polynomial interpolation, *2-D* % improved from % Stereo Matching with Color-Weighted Correlation, % Hierarchical Belief Propagation and Occlusion % Handling, Qingxiong Yang [a,b] = size(impartL); ca = round(a/2); cb = round(b/2); marg = round(ca/3); a2 ...
function axes = principal_axes( M,d ) % returns first d principle axes in order as columns of matrix S = cov(M); axes = eigens(S); axes = axes(:,1:d); end
%% RUN EKF % This script requires derive equations and the data from cameras % measurements % tic clear close all T = 0.01; %(100 Hz) @frame rate=100fps; imu logged at 100Hz% load('testData_Run.mat'); load('CamMatrix.mat'); c_FL=[stereoParams_Front.CameraParameters1.IntrinsicMatrix(3,1);stereoPa...
%% legend_shark % specification of a legend for shark % function legend = legend_shark % created at 2016/09/05 by Bas Kooijman %% Syntax % legend = <legend_shark.m *legend_shark*> %% Description % Specifies a legend for shark % % Output % % * legend: (6,2) cell matrix with (marker, taxon)-pairs % ...
%% Raw FCV Tarheel data folders directory and subfolder paths datadir = 'F:\EmilFristedMScDBMEW\Awake_data\RawData'; folderpaths = {'29\20130227_SAL', '29\20130301_LY', '32\20130227_LY', '32\20130301_SAL', '34\20130227_LY', '34\20130301_SAL', '52\20130911_SAL', '52\20130913_LY', '54\20140617_LY', '54\20140619_SAL', '5...
rtpset='subset'; rtp_core;
function VisualizeWord (word) % This function allows you to visualize the characters for a single word. % % Input: % word: A struct array, each with an 'img' attribute that gives the 16x8 % pixel matrix for that image. % % Copyright (C) Daphne Koller, Stanford University, 2012 padding = zeros(size(word(1).img, 1),...
function P = P(x,z) % returns orth([x z]) described in the paper notation % ------------------------------------------------------------------------- % x, z are matrices (n times r) P = orth([x z]); end
z=1:7; for i=1:7 z(i) = complex(randn,randn) end % am creat un vector cu elemente complexe ma=media(z) % ma imi calculeaza media aritmetica a partilor reale g=patrat(z) % functia g calculeaza patratul vectorului p=transpusa(z) % functia p returneaza matricea obtinuta prin inmultirea vectorului initial cu %tr...
function [ op,days ] = day2num(tt) %day2num - convert Monday, Tuesday, etc to a series from 1-7 days = {'Monday';'Tuesday';'Wednesday';'Thursday';'Friday';'Saturday';'Sunday'}; op = zeros(size(tt)); for n = 1:7 fx = strcmpi(tt,days{n}); op(fx) = n; end end
%Kiran Rao %ME 2016 - Section B %902891012 %Homework 4: Problem 2 function HW4Pb2RaoKiran deltaX = 2; %step size of x between each iteration Y0 = 5; %lower boundary condition Y20 = 8; %upper boundary condition n = 9; %number of iterations A = sparse(n,n); %create sparse(empty) mat...
function [x, A, A_star,ThroatLoc,y] = getNozzle7(leng,Ed,Post_Length,Throat_Radius, endlength, divpm, minpt, taper, inlet) % This nozzle has same expansion as getNozzle6 but a different inlet to % allow for a more gradual taper % Returns: x (position [m] along the nozzle) % A (Area [m^2] along the nozzle...
classdef SRGBToLinearGamma < LUT1DHalfDomain %SRGBToLinearGamma Summary of this class goes here % Detailed explanation goes here methods function value = getLUTValueForFloat(obj, floatVal, channel) a = 0.055; if floatVal <= 0.04045 value = floatVal / 12...
function hsi = rgb2hsi(rgb) % hsi = rgb2hsi(rgb)把一幅RGB图像转换为HSI图像, % 输入图像是一个彩色像素的M×N×3的数组, % 其中每一个彩色像素都在特定空间位置的彩色图像中对应红、绿、蓝三个分量。 % 假如所有的RGB分量是均衡的,那么HSI转换就是未定义的。 % 输入图像可能是double(取值范围是[0, 1]),uint8或 uint16。 % % 输出HSI图像是double, % 其中hsi(:, :, 1)是色度分量,它的范围是除以2*pi后的[0, 1]; % hsi(:, :, 2)是饱和度分量,范围是[0, 1]; % hsi(:, :, 3)是亮度分量,范...
%生成未均衡化的清晰图像% clear; clc; close all; M=384; N=288; Fr=290;%Fr=frame=第几帧 TH=35; TL=20; HL_num=100; flag1=1; flag2=1; limit=5;%优化直方图算法级别 medfilt_grade=3;%中值滤波级别 ADC=14;%数据为14比特 fg=fopen('38CvData2000.dat','r'); WriterObj=VideoWriter('video_source.avi');% xxx.avi表示待合成的视频(不仅限于avi格式)的文件路径 writerObj.FrameRate = 25; open(Wr...
function [resultTableAll, resultTableAgg] = modelStatisticsAdaptation(modelFolders, functions, dimensions, instances, snapshots, exp_id, varargin) % modelStatistics -- creates a table with statistics, % each aggRow represents model and number of snapshot (combined), % each colum...
function [distToLineSeg] = distanceToLineSegment(startPt,endPt, pt ) L = sqrt((endPt(1) - startPt(1))^2 + (endPt(2) - startPt(2))^2); global MMA_DEBUG; global MMA_ABS_TOL; global MMA_REL_TOL; if (L < MMA_ABS_TOL) distToLineSeg = sqrt((startPt(1) - pt(1))^2 + (startPt(2) - pt(2))^2); return; end % else lineTange...
function drawPendulum(fh,x,theta,l,w,h) % Draws pendulum on a cart if nargin == 4 w = 0.15; h = 0.10; end if not(isempty(fh)) figure(fh) else gcf; end clf, hold on, grid on % draw cart rectangle('Position',[x,0,w,h],'FaceColor','r') % draw link plot([x+w/2, x+w/2-l*sin(theta)], [h*0.9, h+l*cos(theta)], '-ok...
function secondderivative y = dsolve('D3y = 2*(D2y -1)*cotg(x)', 'y(pi/2) = 1, y') end
function conn_subjects_loader() % conn_subjects_loader % Batch load all groups, subjects and sessions from a given directory root into CONN. This saves quite a lot of time. % The script can then just show the CONN GUI and you do the rest, or automate and process everything and show you CONN GUI only when the results ar...
%execute Q learning procedure function [Q, rewards]=Q_learning(map, T, nStates, Q) %get global settings global mapSize; global N_ACTIONS; global initialQValue; global pNoCarOnRowTest; global showProgress; global execLearning; %generate distribution for Pno Car when learning distrib=...
function data=findKurtosis(data) totalwindow=length(data); for windowindex=1:totalwindow tempwindow=data(windowindex); data(windowindex).kurtosis=kurtosis(tempwindow.winSound); end end
clc; clear; close all; load fourLetterWords.mat % Cast every string to lowercase dictionary = cellfun(@lower, fourLetterWords, 'UniformOutput', false); initial_state = 'kalt'; goal_state = 'warm'; frontier_queue = Queue(); explored_set = {}; solution = 0; tree = Tree(initial_state); current_node = tree.root; fr...
function sFilesNotch = script_pre_sub8(SubjectNames, RawFiles, NoiseFiles, RawEventFiles, iSubj) % Process: Create link to raw file sFilesRun = bst_process('CallProcess', 'process_import_data_raw', [], [], ... 'subjectname', SubjectNames{iSubj}, ... 'datafile', {RawFiles{iSubj}, 'FIF'}, ... 'chann...
function [x_ne, r_ne] = nels(A,b) G = chol(A'*A); y = linsolve(G',A'*b); x_ne = linsolve(G,y); r_ne = norm(A*x_ne-b); end
function h = findByTag(parentHandle, tag) % FINDBYTAG % % Description: % Convenience function for finding plot objects by tag % % Syntax: % h = findByTag(parentHandle, tag) % % Input: % parentHandle handle to figure or axes % tag char % ...
function plotRangeSigi clear all; close all; format short e; % % Plot S_i vs T (at various strain rates) % fig1 = figure; set(fig1, 'Position', [412 313 915 632]); epdot = [1.0e-6 1.0e-4 1.0e-2 1.0e0 1.0e1 1.0e2 1.0e4 1.0e6]; color = [[1 0 0];[0 1 0];[0 0 1];[0.75 0.25 1.0];[0.25 0.7...
function filenameSysParams=setSysParamsFilename(filenameParameters) k=strfind(filenameParameters,'/'); if(isempty(k)) filenameSysParams='SysParams.mat'; else k=k(length(k)); filenameSysParams=filenameParameters(1:k); filenameSysParams=[filenameSysParams,'SysParams.mat']; ...
% MODULUS 5IRMETHODp1et2 % % DEPENDENCY % 1CONSTANTS.mat % 2cal_simdata.mat (for vsc) % 3fpspec_simdata.mat % FILE OUTPUT % 5IRDB.mat % clear variables; % fprintf('5IRMETHODp1et2\nLOADING\n'); % load('.\mat\1CONSTANTS.mat'); % load('.\mat\2cal_simdata.mat'); % load('.\mat\3fpspec_simdata.mat'); % init ...
function distance = computeDistanceMixDataWei(data, noCatFeatures) %DO: catFeature distance will be 0 if there are a coincidence %data: row wise is observation %noCatFeatures; Number of cat feature %OUT: %distance: matrix, matrix(i, j) = distance( data(i), data(j)) % normalize the distance at every feature, i.e. ...
% La classe DescriptorBuilder creare la variabile descriptor per % per un'immagine. classdef DescriptorBuilder < handle properties parameters ; tmpBGR ; tmpHSV ; hsvConversionCache ; random ; end ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% %%% %%% Solve the Barotropic Potential Vorticity Equation %%% %%% %%% %%% d ...
%Code for Question 1-3 clc;clear; Re = 6378.145; %Earths Radius rp = Re + 500; %Periapsis altitude ra = Re + 800; %Apoapsis altitude mu = 398600; %Semi-Major Axis a = (rp+ra)/2; %Eccentrcity e = (ra - rp)/(ra + rp); %semi-latus rectum p = a*(1-e^2); %magnitude of the specific angular momentum h ...
function state = pooling(data,pooling_a) % calculation layer operation [data_row,data_col] = size(data); [pooling_row,pooling_col] = size(pooling_a); for m = 1:data_col/pooling_col for n = 1:data_row/pooling_row state(m,n) = sum(sum(data(2*m-1:2*m,2*n-1:2*n).*pooling_a)); ...
function display_table_values(data_matrix, cell_column, cell_row_label) sTable = array2table(data_matrix,'RowNames',cell_row_label,'VariableNames',cell_column); sTable end
mex waveResampleMex.cpp addpath d:/users/jang/matlab/toolbox/audio fileName='主人下馬客在船.wav'; [y, fs1, nbits]=wavReadInt(fileName); fs2=9131; % The following commands are synchronous if waveResample.m use the method of "linear" for interpolation. z1 = waveResample(y, fs1, fs2); z2 = waveResampleMex(y, fs1, fs2); time=...
symulacja=zeros(20398,4); for hhy=1:20398 Xij(1,1)=Xij(1,1)-10; mgr1; symulacja(hhy,1)=hhy; symulacja(hhy,2)=J1(1,4,2); symulacja(hhy,3)=J1(2,4,2); symulacja(hhy,4)=J1(3,4,2); end symulacja
B = NET.G <= 0; I = Iu; [x,y,~] = find(B); nbf = size(I,2); %% figure(); for i=1:nbf-1 a = I(:,i); bf = reshape(a,[nx,ny]); subplot (floor(nbf/3),3,i); imagesc(bf); title(num2str(i)); axis off; hold on; plot(y,x,'w.'); end %% % partition of unity figure(); a = reshape(sum(I,2),[nx,ny]); surf(a); sh...
% xSigmoidMapping.m % % Testing out the idea of taking measurements of R2' and DBV, and then mapping % their ratio to values of OEF (probably using a sigmoid function). Script % outline derived from Figure_R2pScatter.m % % MT Cherukara % 16 April 2019 % % Actively used as of 2019-04-16 % % CHANGELOG: % % 2019-07-29 (MT...