text
stringlengths
8
6.12M
%PI¿ØÖÆ clc; clear all; close all; T=2; n=1; k=1; kp=1; ki=0.01; kd=0.01; st=20; dt=0.01; lp=st/dt; r=1; y=0; xi=0; a=exp(-dt/T); b=1-a; e0=0; T=[]; Y=[]; x(1:n)=0; for i=1:lp e=r-y; xp=e*kp; xi=xi+e*ki*dt; xd=(e-e0)*kd/dt; u=xp+xi; e0=e; x(1)=x(1)*a+k*...
% Copyright 2018, 2019, by the California Institute of Technology. ALL RIGHTS % RESERVED. United States Government Sponsorship acknowledged. Any % commercial use must be negotiated with the Office of Technology Transfer % at the California Institute of Technology. % -----------------------------------------------------...
function varargout = Karaoke(varargin) % KARAOKE MATLAB code for Karaoke.fig % KARAOKE, by itself, creates a new KARAOKE or raises the existing % singleton*. % % H = KARAOKE returns the handle to a new KARAOKE or the handle to the % existing singleton*. % % KARAOKE('CALLBACK',hObject,eventData,...
mass1=60; %Average human mass mass2=5.97219e24; %earth mass mass3=7.34767309e22; %moon mass dist1=6.38e6; %distance to earth's center dist2=1737400; constG=6.67e-11; %gravitational constant forceG1=(constG*mass1*mass2)/(dist1*dist1) forceG2=(constG*mass1*mass3)/(dist2*dist2) forceG3=(constG*mass1*mass1)/10 %force of ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function accHisto = computeColorDistanceHistogram(imgVector, interval, nbIter, nbPixelsDistances) % % Input parameters: % % Output parameters: % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function accHisto = co...
function NII = create_3D_nii(REFnii,matrix) REFnii = load_untouch_nii(REFnii); REFnii.img = matrix; REFnii.hdr.dime.dim(1) = 3; REFnii.hdr.dime.dim(5) = 1; REFnii.hdr.dime.pixdim(5) = 0; REFnii.hdr.dime.datatype = 16; REFnii.hdr.dime.glmax = max(matrix(:)); REFnii.hdr.dime.glmin = min(matrix(:)); REFnii.hdr.dime.cal_m...
%%生成类间约束 function [ML,CL]=cconstrains(cml,ccl,cl) [mlrow,mlcol]=size(cml); [clrow,clcol]=size(ccl); for i=1:mlrow ML(i,:)=[cml(i,1) cml(i,2) cl(cml(i,1)) cl(cml(i,2))]; end for i=1:clrow CL(i,:)=[ccl(i,1),ccl(i,2),cl(ccl(i,1)),cl(ccl(i,2))]; end
%clear all %open mask [FileName,PathName] = uigetfile('*.nii','Select the Nifti file','/media'); file=strcat(PathName,FileName) M=MRIread(file); Mask=M.vol; %Mask=1-Mask;%use that line if mask from segmentation editor %Md=double(M); %open data [FileName,PathName] = uigetfile('*.nii','Select the Nifti file','/media');...
% clouds2curve(x,y,'initialize'); % [distance,intersection]=clouds2curve(x,y,u,v) % clouds array is [ function varargout=clouds2curve(clouds,varargin) persistent AllowedAngles % manage input assert(nargin>=2,'ERROR: insufficient input'); if (nargin==2) && strcmpi(varargin{1},'initialize') AllowedAngles=initi...
function project_pRF2vol(session_dir,subject_name) % Projects the *_pRF.nii.gz retinotopic template maps to the volume % % Usage: % project_pRF2vol(session_dir,subject_name) % % Written by Andrew S Bock Nov 2015 %% set defaults hemis = {'lh' 'rh'}; maps = {'ecc' 'pol' 'areas'}; %% Project maps to volume for hh ...
function imdb = createIMDB_RAM(folder) % imdb is a matlab struct with several fields, such as: % - images: contains data, labels, ids dataset mean, etc. % - meta: contains meta info useful for statistics and visualization % - any other you want to add % labels we use train=1, val=2, test=3 imdb = struct(); classes =...
function [fitresult, gof] = createFit(horz_train_x, horz_train_y, horz_train_z) %CREATEFIT(HORZ_TRAIN_X,HORZ_TRAIN_Y,HORZ_TRAIN_Z) % Create a fit. % % Data for 'untitled fit 1' fit: % X Input : horz_train_x % Y Input : horz_train_y % Z Output: horz_train_z % Output: % fitresult : a fit object rep...
clear; clc; format compact; % Use this script to generate a file of background spectra cutoff = 0.025; % radius = 22; radius = 0; filePath = '/Users/mattmcpartlan/Desktop/'; fileName = input('File name on Desktop (Dont include extensions): ', 's'); readPath = csvread([filePath fileName '.dpt']); isSquare = input(...
function objs = genObjects(css,mainWin) % GENOBJECTS Define graphic objects in objs struct %%%% Right Hand Side PLOT objs.pnl = uipanel(mainWin,'FontSize',12,... 'BackgroundColor',css.rgbcolorb'./255,... 'Position',[280 20 css.width-280-20 css.height-30]./css.size); ...
function n = ejercicio10(coef, x) n = 0; for i = 1 : length(coef) n = n*x + coef(i); end endfunction
function x = Features(word_indices,vocablist,bi,tri) n =length(vocablist)+3; max=length(vocablist)+length(bi)+length(tri); x = zeros(n, 1); [j k]=size(word_indices); for i=1:k if(i<=n) x(word_indices(i))=1; endif endfor %%x(n+1)=m1; %%x(n+2)=m2; %%x(n+3)=m3; end
%GM_PHD_Simulate_Measurements %Last modified 27th August 2013 %Matlab code by Bryan Clarke b.clarke@acfr.usyd.edu.au %This file generates simulated measurement data for the simulation %described in Vo&Ma. %There will be gaussian noise on the measurement and Poisson-distributed clutter %in the environment. %...
function [ak,bk] = FourierCoefficients(Ta, T0, x, K) N = length(x); t = [0:(N-1)]'*Ta; ak = zeros(K+1,1); bk = zeros(K+1,1); ak(1) = mean(x); bk(1) = 0; for k = 2:K ak(k) = (2/N)*x'*cos(2*pi*(k-1)*t/T0); bk(k) = (2/N)*x'*sin(2*pi*(k-1)*t/T0); endfor endfunction
clear all; clc; parent = 'C:\Documents and Settings\Neeraj.NEERAJ\Desktop\Final Project\CroppedYale\yaleB'; for i = 1:38 direct = strcat(parent,int2str(i)); addpath(direct); for j = 1:65 imgsrc = strcat(int2str(i),' (',int2str(j),').pgm'); a = imread(imgsrc); imgdst = strcat(int2str...
function [RHSdiv, RHSdivx, RHSdivy, RHSdivz] = divergenceTerm3D(F) % This function calculates the divergence of a field using its face % average flux vector facevariable, which is a face vector % % SYNOPSIS: % [RHSdiv, RHSdivx, RHSdivy, RHSdivz] = divergenceTerm3D(F) % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: ...
function morphed_im = morph_tps( im_source, a1_x, ax_x, ay_x, w_x, a1_y, ax_y, ay_y, w_y, ctr_pts, sz ) %This function finds the morphed image using tps parameters [nr, nc, ~]= size(im_source); [X, Y] = meshgrid(1:nc, 1:nr); Ux = zeros(nr, nc); Uy = zeros(nr, nc); for i = 1:size(ctr_pts,1) diff_x = X - ctr_...
function figures = renorm_plot(surface, ico, STATE, varargin) fprintf('Teste\n'); histcut = 2; if nargin > 3 histcut = varargin{1}; % order = varargin{1}; end inv = true; if nargin > 4 inv = varargin{2}; % order = varargin{1}; end order = 5; if nargin > 5 order = varargin{3}; end palpha = true; i...
classdef WealthPlotter properties p; dims; agrid; pmf_a; fig; fontsize = 12; end methods function obj = WealthPlotter(params, agrid, pmf_a) obj.p = params; obj.dims = [obj.p.nx_DST, obj.p.nyP, obj.p.nyF, obj.p.nz]; obj.agrid = agrid; obj.pmf_a = pmf_a; end function [ax, wealth_his...
% Model of a square-wave source. This is used to represent the (forced) external membrane potential. % To test- % test_t=linspace(0,60,600); % plot(test_t,SquareSource(test_t)) function V=ChenModelMembrane(t) Vrest=-70; Vburst=-20; tstep=0.0; ton=6.0; toff=6.0; % Uncomment below for Figure 2 % to...
function [Csat_approx]=VBS_equilibration_extractCsat_withLLEpartition_KGv2(Cp_j_VBSold, Cstar_j_VBSold, ... aw_measurment, molecular_weight, O2C_values, H2C_values, BAT_functional_group, BAT_refinement_mode,N2C_values_denistyOnly ) %% % Created by Kyle Gorkowski [LAPTOP-A4QKFAC8] on 2018-Jul-13 11:21 AM % Cop...
function pp = plant_defn(pp,flag) %{ 05/10/2022 Purnanand Elango Define the discrete-time plant model Input: flag: 0 - Random neutrally stable system 1 - System of oscillating masses %} switch flag case 0 % Neutrally stable random system pp.A = randn(pp.n,pp.n)...
%-------------------------------------------------------------------------- % This function takes the groups resulted from spectral clutsering and the % ground truth to compute the misclassification rate. % groups: [grp1,grp2,grp3] for three different forms of Spectral Clustering % s: ground truth vector % Missrate: 3x...
function my_polar_plot( imn, XR ) %MY_POLAR_PLOT Summary of this function goes here % Detailed explanation goes here Im_filt=polar2cart(XR,256,inf,10) Im0=polar2cart(double(imn),256,inf,10); figure(1) figure,imshow(log(1+abs([Im0,Im_filt])),[]) end
function output_folder = LymphNodeGenerateCNNImagePatches(FileName,physicalPointsFilePrefix,opt) %% PARAMS if ~isfield(opt,'itkResampleRegionOfInterestExe') opt.itkResampleRegionOfInterestExe = ''; end if ~isfield(opt,'pointList_suffix') opt.pointList_suffix = '_physicalPoints.txt';...
function varargout = gsGUI_saveSettings(varargin) % % stores/loads the current state of the interface % store info in a file called settings_<name>.mat, placed in % FS_labMfilePath('FIRA', 'gui', 'figs') % % Assumptions: % parent function is called "getGUI_<name>" and % it has a function named "updat...
function plotRandomBasisVectors(Psinum,probabilityInfo) % Hugo Esquivel, 2021 % - numRandomVariables=length(probabilityInfo.name); if numRandomVariables==2 numRandomBasisVectors=length(Psinum); numPoints=50; s=getProbabilitySupports_Plot(probabilityInfo); x1=linspace(s(1,1),s(1,2),numPo...
clc clear close all %{ The following code will alnalyze the mechanical system with respect to θ_2 Independant Variable: θ2 Dependant VariableS: θ3, R3 1. Displacement of point C 2. angular velocities and accelerations of all links, 3. Linear velocities and accelerations of point C, 4. Polar plots of the forces at ...
function [STF,TVF] = computefield(u,Omega,sigma,rho) %% PARAMETERS %hsize = 15; hsize = 80; %scale_voting = [11:10:31]; scale_voting = [5:5:15]; % INLINE FUNCTIONS blur = @(f,sigma) imfilter(f,fspecial('gaussian',hsize,sigma),'replicate','same','conv'); nabla = @(f) grad_ij(f); tensorize ...
%% 1. kinematic eqn of a rocket t = linspace(0,30,500); % a. figure('name','Rocket'); % we can call a function within a script as long as it's on the PATH plot(t, prob1(t)); xlabel('time seconds'); ylabel('height meters'); grid on; % b. % i. analytic solution % ii. use ginput on the plot % iii. use the max function o...
function echo(obj,filename) fid = fopen(filename,'w'); for j = 1:size(obj.entryList,2) placeHolder = obj.(obj.entryList{j}); for i = 1:size(placeHolder,2) try echo(placeHolder(i),fid) catch exception error(['Issue executing echo. echo method likely undefined for ...
function rhs=nls_rom_rhs(t,a,dummy,phi,phixx) rhs = (i/2)*(phi.')*phixx*a + i*(phi.')*( (abs(phi*a).^2).*(phi*a));
function pa_genexp_ventriloquist_aftereffect_control %% Initialization home; disp('>> GENERATING EXPERIMENT <<'); % Default input minled = 300; maxled = 800; snd = 1:8; expfile = 'baseline_aftereffect_low.exp'; datdir = 'DAT'; minsnd = 200; maxsnd = 200; %% Some Flag...
function leaf = getnode(s,treepath) if nargin < 2 treepath = getleafpaths(s); end if iscell(treepath) % Got a cell, must be interpreted as a collection of treepath leaf = cell( length(treepath) , 1 ); for i = 1 : length(treepath) tp = treepath{i}; le...
% -------------------- Simulação de Objetos Abandonados ------------------- % % Relações Importantes: % v = vo + at % s = so + vot + at^2/2 % close all, clear all addpath('functions'); % -------------------------- Parametros Iniciais -------------------------- g = -9.809; % [m/s^2] Aceleração d...
function [wp_stack]=get_wpstack(host, port) % [WP_STACK]=GET_WPSTACK(HOST, PORT) % % Read number of waypoints in stack from Flightgear over socket % connection (HOST, PORT). % Run Flightgear on HOST (e.g. '127.0.0.1' = localhost) with % parameter "--props = PORT". import java.net.Socket import java.io.* f...
function randomfacegenerator; % randomfacegenerator; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Written by Joseph Hollmann, February 2013 % This file may be copied, used, or modified for educational and research purposes provided % that this header inform...
clear all; %% Get calibration whichApproach = ['OLApproach_' GetWithDefault('Use calibration for which approach','Squint')]; calibration = OLGetCalibrationStructure('CalibrationFolder',getpref('OLApproach_Squint','OneLightCalDataPath')); % Extract wavelength sampling S = calibration.describe.S; %% Create receptor fu...
function [g, dg] = reps_dual_state(etatheta, epsilon, R, Phi) eta = exp(etatheta(1)); theta = etatheta(2:end); N = length(R); V = Phi*theta(:); MR = max(R(:)-V); Zhat = 1/N* exp((R(:)-V - MR)/eta); g = eta*log(sum(Zhat)) + MR + eta*epsilon + mean(Phi, 1)*theta(:); dgeta = epsilon + log(sum(Zhat)) + MR/eta - sum(Zha...
classdef L2Loss < dagnn.Loss methods function outputs = forward(obj, inputs, params) predictions=inputs{1}; true_labels=inputs{2}; true_labels=true_labels(:,:,[4,5],:); %for size %mask= abs(true_labels) ~= single(0.1) ; mask = ~isnan(true_labels); diff = (predictions ...
function y_Call_dcm2nii(InputFilename, OutputDir, Option) % function y_Call_dcm2nii(InputFilename, OutputDir, Option) % Call Chris Rorden's dcm2nii for different platform as well as for parfor usage. ('eval' is not suitable for 'parfor') % Input: % InputFilename - The Input File name. Could be one of the DICOM file...
function [ AIF_estimated_ICA_Corrected, Scale_Factor ] = CorrectPVE( AIF_estimated_ICA, Vein_estimated_ICA, Sim_Struct ) % Take needed parameters from struct min_interval = Sim_Struct.min_interval; lambda_vec_larss = Sim_Struct.lambda_vec_larss; normalize = Sim_Struct.normal...
function [xOut, yOut, tOut] = trajectoryCalc() % This function calculates the trajectory of a projectile from its % starting velocity, angle, and height. % INPUTS: % none - function gathers information from user % OUTPUTS: % x - x coordinates over time, vector % y - y coordinates over time, vector % t - time to hit the...
function [A,Max]=EXTRACT_DMAX(A,d,n) % 函数功能:提出并移除max d-ary heap A的最大值。 if n < 1 return end Max=A(1); A(1)=A(n); A(n)=[]; n=n-1; A=MAX_DHEAPIFY(A,1,d,n);
function moment = calc_moment() global kg kgz % Difference in 3d sum over alternating layers (1:2:kgz vs. 2:2:kgz) moment = abs(double(sum(sum(sum(kg(:,:,2:2:kgz))))-sum(sum(sum(kg(:,:,1:2:kgz)))))); end
%funzione main per il dimensionamento dei link seguendo una inversione %della cinematica geometrica, su un sottoinsieme di punti opportunatamente %scelti della traiettoria da eseguire. clc; clear; close all; %mi definisco i parametri geometrici della mia traiettoria richiamando la %funzione 'inizializza_simulazione':...
function A = shiftAnglesFromMinus180To180(InA) %dont do anything to angles that are already in range %if we leave out this step, we get +180 shifted to -180 idx = find(InA>180 | InA <-180); if(isempty(idx)) A = InA; else A = InA; A(idx) = mod(InA(idx)+180,2*180)-180...
function varargout = chopper(varargin) % CHOPPER MATLAB code for chopper.fig % CHOPPER, by itself, creates a new CHOPPER or raises the existing % singleton*. % % H = CHOPPER returns the handle to a new CHOPPER or the handle to % the existing singleton*. % % CHOPPER('CALLBACK',hObject,eventData,...
function [y]=movingmean(data,windowSize) methodid=3; switch methodid case 1 y=zeros(1,length(data)-windowSize); for n= windowSize:length(data), y(n)= mean(data(n-windowSize+1:n)); %y[n] is the filtered signal end case 2 y=filter(ones(1,windowSize)/windo...
function t=trigamms(x); %TRIGAMMS TRIGAMMS(X) is the trigamma function for scalar argument X. % From Algorithm AS121 (Schneider, 1978). % % GKS Last revised 13 Jan 98 a=1e-8; b=12; b2=1/6; b4=-1/30; b6=1/42; if x<=0; disp('trigamma arg <= 0'); t=0; elseif x<a; t=1./(x.*x); elseif x>b; y=1./(x.*x); t=.5*...
function simPlot(a) N = length(a); % figure rectangle('Position',[-5 -5 10 10],'LineWidth',3) axis([-6 8 -6 6]) % hold on for i = 1:N plot(a(i).xn(1,:), a(i).xn(2,:), 'LineWidth', 1) end % hold off legend('1','2','3','4','5','6','7','8','9','10') grid on end
function [imo,imzc] = CS4640_LapG(im,s,sigma2) % CS4640_LapG - Laplacian of Gaussian of image % On input: % im (MxN array): input image % s (int): side length of LoG filter % sigma2 (double): variance of Gaussian filter % On output: % imo (MxN array): LoG image % imzc (MxN arry): zero-crossings % Ca...
function [X, bbox, conf] = volume2Cube( folder, bbox, dtype, confSeg ) %VOLUME2CUBE Load a volume tracing into a single matlab array. % INPUT folder: string % Path to folder containing the unzipped volume tracing. % bbox: (Optional) [3x2] double % The bounding box that is loaded. % (...
function [ gq ] = problem_G(q,quadpoint,appdata) % Evaluates g(q) for the given problem % written by data.Pierson Guthrey % ------------------------------------------------- % INdata.PUTS q % OUTdata.PUTS g evaluated for conserved variables g % Note: other variables may be %loaded in from the problem parameter fil...
% NOTE: This code is not yet matured. % Tuning the layout and size of the window is still independant of the data % dimensions and it's manual. % if you want the arrows not to collide sort the data in descending order % based on the rowwise means: % [~, I] = sort(mean(Data,2), 'descend'); % Pej_Heatmap(Data(I,:)); ...
function [cubics time]=Splines(midline, disp_flag) % Function [cubics time]=Splines(midline, disp_flag) returns % the cubic spline approximation of the curve specified in % the midline (a NxD matrix), D is the dimension. % The result is a 1xN-3 cell array of coefficients of % cubic polynomials that approximate the cur...
% Initialize Variables and Arrays ATCDR = zeros(1,1000); TIME = zeros(1,1000); FLAG1 = 0; XIDUMMY = 0; XIPRELOAD = 0; XISTEP = 0; TCDR = 0; TCDRPRELOAD = 0; DELTIME = 0; FS1 = 0; FS2 = 0; FS3 = 0; % TODO: XSTR = NFLAG = 0; PIANG = pi / 180; DEBUG = 0; ...
%% Test the Chain Transformer % Note, it is not usually necessary to instantiate transformers directly, as in % this example. If you specify a transformer to a model, this will be taken care % of automatically. %#testPMTK T = ChainTransformer({StandardizeTransformer, AddOnesTransformer}); setSeed(0); Xtrain = r...
% diode_loop_control.m % % clear global params thisTrialCodes trialTic global params thisTrialCodes trialTic matlabUDP('close'); matlabUDP('open','192.168.1.11','192.168.1.10',4243); exGlobals; pause(1); params.sendingCodes = 1; thisTrialCodes = []; trialTic = tic; for I=1:1000 disp(I) sendCode(codes.ST...
function main() % 现要画出其分组3维柱状图。 % 最简单的写法如下: clc; clear all; close all; label1 = {'张三', '李四', '王二', '胡汉三'};%标签 label2 = {'合格率','次品率','废品率'};%标签 Z = rand(3, 4); hb = bar3(Z); renderCDataByHeight(hb, false); colorbar; set(gca, 'xticklabel', label1); set(gca, 'yticklabel', label2); view([-28, 40]) %文字标注 for i = 1:size(Z,1...
function qpsk_msg = QPSK_incode(text) %this function incodes input characters on constellation %-------------------------------------------------------------------------- %Input argument is text (in this case from .txt file) %Output is array of QPSK symbols ready for OFDMgenerator %-------------------------------------...
function k = getstrfact(dom,domr,dr,kmin,kmax) % @author A.Gonzalo % % @brief function to find out the stretching factor needed to get a mesh % with boundary conditions fixed at a spatial domain % % @date 03-03-2015 by A.Gonzalo % Created % % @details % % MANDATORY ARGUMENTS: % -------------------- ...
function icdfnorm = imgnormcdf(img) % Author: Javier Montoya (jmontoyaz@gmail.com). % http://www.lis.ic.unicamp.br/~jmontoya % % IMGNORMPDF normalizes the CDF of image I. % Input parameters: % img: image I (passed as a bidimensional matrix). % Ouput parameters: % icdfnorm: normalized cdf % % See...
% % [centers, radii, blocks] = get_random_convsegment(D); % % c1 = centers{1}; c2 = centers{2}; % % r1 = radii{1}; r2 = radii{2}; % % [centers, radii, blocks] = get_random_convtriangle(); % c1 = centers{1}; c2 = centers{2}; c3 = centers{3}; % r1 = radii{1}; r2 = radii{2}; r3 = radii{3}; % % alpha = rand; % t = alpha * ...
function [] = detection(data,truth); % 参数说明: % 输入参数: % data 图像序列数据,图像数据必须是一维 % imgsize为图像数据长度 % imgdeep为图像深度 % framenum为图像序列数量,及到底有多少帧图像 [imgsize imgdeep byte framenum] = size(data); template = [1 2 1;2 4 2;1 2 1]; % 用于高斯滤波 dicnum = 3; % 单词最大数量 i...
%% ------------ Object removing, labbeling and device model ------------ %% %% --------------------------------------------------------------------- %% close all clear, clc %% ------------------------ Data set: Evans ---------------------------- %% %% ------------------------- Load matricies ----------------------...
if ispc addpath('../glmnet_win64_Selmaan'); else addpath('../glmnet_matlab/'); end %% %{ disp('Using GLMNET method...common snps only'); % addpath('../glmnet_win64'); % addpath('../glmnet_matlab'); % addpath('../PrediXcan_DBPipeline_elasticNet/glmnet/glmnet_matlab/'); % addpath('C:\Users\jcai\Desktop\glmnet\g...
function [masses, root, amps] = effective_mass_utility(connected_sum, parse_Nt, K, N, C) % Okay. Let's try this new effective mass method. This form assumes 2 % effective masses. %K = 2; % We want two states. M = K+1; % Don't look too far ahead. M>K %N = 20; % N >= M+K-1. %C = 0; % nu...
global K Vel Km; K = 0.3; Vel = 0.5; Km = 0.2; y0 = [2 0 2]; z_span = [0 2.4]; [z,y] = ode45(@rate1_mass,z_span,y0); plot(z,y); xlabel('x'); ylabel('Conc'); legend('A','B','C');
clear all; close all; tic app = actxserver('STK11.application'); app.visible = 2; root = app.Personality2; days=180; timestep=60; %Timestep of data acquisition in seconds start_time='21 Jun 2022 16:00:00.000'; stop_time='18 Dec 2022 16:00:00.000'; scenario = root.Children.New('eScenario','Data_Collection'); scenario....
%% Produces a normal render using normal values function l_out = FastRenderingInterfSeismic(obs, source, brdf_interf, num_ang, empty_source) n = obs(5); T = length(brdf_interf); angles_brdf_map = linspace(-180, 180, num_ang).*ones(T, num_ang); x_axis = zeros(1, T); obs_angle = linspace(obs(3)+90, o...
function [data_create,sessionNum,trialsNum,neuronsNum,samplingRate,nParamsToOptimize]=user_input() %USER_INPUT function to read some parameters for the user in order to %create or load data %Konstantinos Panagiotis Panousis %Gatsby Computational Neuroscience Unit %University College London %August 2015 %Outputs: data_...
function result = isRgb(image) result = size(image, 3) == 3; end
function [ph_delta_time_out ,ph_h_out,ph_dis_out] = ATLread2(h5filename,spot_num,distru) %UNTITLED 此处显示有关此函数的摘要 % flag_surface = 3; flag_surface代表地表类型,1为陆地,2为海洋,3为海冰,4为陆地冰,5为内陆水 % spot_num = 2;代表波束,取值为1,2,3 % distru = 'r';代表right还是left,取值为r,l % 此处显示详细说明 h_ph = h5read(h5filename,strcat('/gt',num2str(spot_num),distru,'...
%% KECA implementation sigma = estimateSigma(X); K = kernelmatrix('rbf', X', X', sigma); [E D] = eig(K); V2 = sum((E*(D.^0.5))).^2; [V2 ind] = sort(V2,'descend'); Vkeca = E(:,ind);
function [map_handle] = generateMap( seed_, map_height_, map_width_, food_n_, cache_n_, obs_n_ ) %Generate Map global obs_handles map food obs map_handle map_handle = figure; map_handle.set('Position',[100,100,1000,700]); rectangle('Position',[0 0 map_width_ map_height_]); axis('equal'); load('variables/constant...
function [lowpass, highpass] = predict_next_frame_index(video, positions, mask,n) % Input arguments: video - 3D structure (rows x cols x frames) containing video frames % (there are 16 frames in total) % positions - position/motion vector for the object for each frame (of dimensions 2x16, ... % each having [x;y] ) ...
function [varargout] = ZNLDetect(a,t,varargin); % [Fmat, f, ts_zc] = ZNLDetect(a, t); % or % ZNLDetect(a, t); % % Nonlinearity detection scheme based on zeroing the initial time response % over various intervals and computing the FFT of each, as described in: M. % S. Allen and R. L. Mayes, "Estimating the Degree...
function T=getCoords_old(lambda,delta,f,R,db,Nx,Ny,p,q,dire,AccuCtrl) lambda=lambda*db; delta=delta*db; f=f*db; R=R*db; sx=db*(p-1)*5e-3; sy=db*(q-1)*5e-3; dx=db*5e-3; dy=db*5e-3; T=lambda/sin(atan(delta/f/2)); Rx=sx; Rx(2)=Rx+dx; Ry=sy; Ry(2)=Ry+dy; [x,y]=meshgrid(linspace(Rx(1),Rx(2),Nx*2+1),linspace(Ry(1),Ry(2),Ny*2...
function M = matpro(M1,M2) %matrix product OK [r1,c1]=size(M1); [r2,c2]=size(M2); % if method==1 if c1~=r2 error("Dimention does not match."); end M=zeros(r1,c2); for i=1:r1 for j=1:c2 for k=1:c1 M(i,j)=M(i,j)+M1(i,k)*M2(k,j); end end ...
function [rR,rT,rZ] = rotatetoRTZ(inE,inN,inZ,baz) % ROTATETORTZ rotates data from ENZ to RTZ coordinates using a specified % source-station *backazimuth* to get the great circle path. % % % All 3 components are required for this code, although no rotation % is applied to the vertical component. % % % DKane 20120330 ...
function [] = islandsmx() % Help file for mex version. %ISLANDSMX finds all islands of four-connected elements in a matrix. % ISLANDSMX returns a matrix the same size as the input matrix, with all of % the four-connected elements assigned an arbitrary island number. A second % return argument is an nx3 matrix. Ea...
I=imread('T1_2.tif'); [M,N]=size(I); mat1=[0 1 0;1 -4 1;0 1 0]; mat2=[1 1 1;1 -8 1;1 1 1]; I1=padarray(I,[1,1]); lap1=zeros(M,N); lap2=zeros(M,N); blur=zeros(M,N); for i=2:M+1 for j=2:N+1 win=double(I1((i-1:i+1),(j-1:j+1))); win1=win.*mat1; win2=win.*mat2; blur(i-1,j-1)=round(sum(sum...
function y = f1(X) %f1 此处显示有关此函数的摘要 % 此处显示详细说明 x1 = X(1); x2 = X(2); y = 21.5 + x1 * sin(4 * pi * x1) + x2 * sin(20 * pi * x2); end
%This function solves Ax=B for x, where A is a tridiagonal matrix %represneted by vectors a, b and c, abd B is vector f function [X] = solveTriadiagonalByGE(a,b,c,f) for k = 1:length(a)-1 m = vpa(b(k+1)/a(k)); a(k+1) = a(k+1) - m*c(k); f(k+1) = f(k+1) - m*f(k); end X = vpa(zeros(size(a))); X(end) = vpa(f(en...
function linlosses = init_linlosses(triplets_trn, triplets_trn_Q, ... triplets_trn_diff_mat, diag_W) % linlosses = init_linlosses(triplets_trn, triplets_trn_Q, ... % triplets_trn_diff_mat, W) % % Evaluates the initial linlosses. linlosses is a vector that % holds the (per triplet) value of the product of % query_...
im=imread('C:\Users\ye\Desktop\1_0000_图层-1.png'); %文件名为1.jpg的图像,放在c盘底下,当然路径都可以自己改 if size(im,3)>1 %判断如果是彩色图像,转换为灰度图 im=rgb2gray(im); end hist_im=imhist(im); %计算直方图 bar(hist_im);%画直方图
%========================================================================= % % Estimating ARCH-NNH Models by ML (Han and Park, J. Ects. (2008)) % %========================================================================= function garch_nnh( ) clear all clc % Frequency freq = 'daily'; % 'daily','...
pkg load image; pkg load geometry; load('megaman.mat'); for o=1:100 img = RGB{o}; hsv_img = rgb2hsv (img); H = hsv_img(:,:,1); S = hsv_img(:,:,2); V = hsv_img(:,:,3); azul = (H >= 0.3 & H < 0.7 & V > 0.7 ); laranja = (H <0.4 & V < 0.98 & V > 0.5 & S > 0.64); for i=1:3 megaman...
addpath('half-edge-mesh'); warning('off','MATLAB:MKDIR:DirectoryExists'); % Demo 1: Pavilion. Reproduces Fig. 17, and shows a rendering of the % model that serves as the basis for the physical model shown in Fig. 1 % (left). An SVG file with the cutting paths for the cardboard model is % saved to the 'pavilion/strips...
function a = plx2events(input) %function a = plx2events(input) % % Works for stimuli like ori12_array in which the orientations are % numbered 0-11 and the blanks are not included as a condition. % Determine the channel list chl1 = double(unique(input.plx.TimeStamps(:,1))); chlist = []; for I=1:length(chl1) idx = fi...
function [Chassis] = calcChassisParameters(Chassis) % ************************************************************************* % FUNCTION NAME: % calcChassisParameters % % DESCRIPTION: % Calculates additional chassis parameters based on provided values. % This function should be used if a value in the Car...
%% Rand index Real = [ones(1,divnum(1)) 2*ones(1,divnum(2)) 3*ones(1,divnum(3))]; TP = 0; FP = 0; FN = 0; TN = 0; %% Pair Ίρ±³ for i = 1:30-1 for j = i+1:30 TP = TP + ((idx(i)==idx(j))&&(Real(i)==Real(j))); FP = FP + ((idx(i)==idx(j))&&(Real(i)~=Real(j))); FN = FN + ((idx(i)~=id...
% Grant David Meadors % contrastBeforeAfterRealImaginary % g m e a d o r s @ u m i c h . e d u % 02012-11-13 (JD 2456244) % Plots the power of Hann % windows for Hoft, both before and after feedforward beforeRaw = load('before.txt'); afterRaw = load('after.txt'); % Since each of these files contains not one but eleve...
function X = QLiftRec2Nevill(C, S, filtername) %----------------------------------------------------------------------------- % QLiftRec2Nevill % Multilevel 2-D reconstruction by inverting the lifting scheme and using % quincunx grids % % Calls for: NevilleR2Q, stencilR2Q, stencilCrop, stencilxgridfRVC, % r...
classdef KpcaTestBase < handle %{ CLASS DESCRIPTION A Base class for testing KPCA model Created on 16th November 2019 by Kepeng Qiu. -------------------------------------------------------------% %} methods(Abstract) test(~) end methods(Static) function testtype = se...