text
stringlengths
8
6.12M
function output = test_function(x) output = sin(x); end
function xyz = rgb2xyz_cvip(varargin) % RGB2XYZ_CVIP - Converts Red-Green-Blue Color value to XYZ Chromaticity Color value. % % Syntax: % ------ % OutputImage = rgb2hsv_cvip(InputImage, type) % % Input parameters include : % ------------------------ % 'InputImage' RGB Image % 'type' o...
fo = 4; %frequency of the sine wave Fs = 100; %sampling rate Ts = 1/Fs; %sampling time interval t = 0:Ts:1-Ts; %sampling period n = length(t); %number of samples y = 2*sin(2*pi*fo*t); %the sine curve sequence = amplitudeA(:,2); sequence = medfilt1(sequence,40);%ÖÐÖµÂ˲¨ y = sequence; Fs = 100; %sampling rate Ts = 1/Fs...
function BorderAndLuminance(varargin) % Wrapper to call JitterBackTex_JitterObjTex % % Divide the screen in object and background. % Object will be a given texture changing phases every so often. % Back will be a grating of a giving contrast and spatial frequency % that reverses periodically at backReverseFreq. global ...
function x=getRealizationsFromRandomVariables(numRealizations,probabilityInfo) % Hugo Esquivel, 2021 % - numRandomVariables=length(probabilityInfo.name); x=zeros(numRealizations,numRandomVariables); for i=1:numRandomVariables if strcmpi(probabilityInfo.name{i},'Uniform') % uniform distribution (defined in [-1,1]...
function CLIA(Global) % <algorithm> <C> % An Interactive Many Objective Evolutioinary Algorithm with Cascade Clustering & Reference Point Incremental Learning % Hongwei Ge & Mingde Zhao et al., 2018 % stable_threshold --- --- BLAHBLAHBLAH % delta --- --- maximum number of reference vectors participating the selection...
function matunion=fununion(mat) if ~isempty(mat) [nrow,~]=size(mat); [fcolsor,indsort]=sort(mat,1); mat=mat(indsort(:,1),:); itrow=1; while itrow<nrow if mat(itrow+1,1)<=mat(itrow,2) if mat(itrow,2)<mat(itrow+1,2) mat(itrow,2)=mat(itrow+1,2); end ...
function f = structdata_plotTemporalWaveform(S_structdata,S_fig) if strcmp(S_structdata.type,'coeffs') [~,CFvecs,~,x] = cavity_loadBasis(S_structdata.basis_loc,S_structdata.k_a); field_t = userdata_calcTemporalField(S_structdata.Y,CFvecs,x,S_structdata.x0); elseif strcmp(S_structdata.type,'fi...
%% %Plot ESD results for each Earth Station figure(1) phimax=20; fontsize=14; num=0; close all [trash, idx] = sort([EMISSION{:,4}], 'descend'); EMISSION = EMISSION(idx,:); Uplink_Emission={}; %(Pwr_Max,PwrDens_Max,Pwr_Min,PwrDens_Min) for es = 1:length(p.EarthStation{:,1}) PwrDensUpMax=[];PwrDensUpMin=...
close all clear all clc Obj1.mean = 1 * [0.3; 5]; Obj2.mean = 1 * [-3; 5]; Obj3.mean = 1 * [3; -5]; Obj4.mean = 1 * [-3; -5]; % K-NN Inv = 7; K = 2; Im = zeros(300); for iii = 1 : 300 for jjj = 1 : 300 xx = (iii - 150) / 150 * Inv; yy = (jjj - 150) / 150 * Inv; d(1) = norm(Obj1.mean - [x...
function n_est = ess(y) %ESS Calculate the Estimated Sample Size (ESS) of MCMC chain % N_EST = ESS(Y) calculates the ESS of MCMC chain, Y. % See: Kass, Carlin, Gelman, & Neal, 1998, p. 99. % % Kyle Honegger, Harvard University % h------r@fas.harvard.edu % % Version: v1.0 % Last modified: Sept 22, 2...
% Test program to do some RSA example maple('p:= nextprime(1897345789)') maple('q:= nextprime(278478934897)') maple('n:=p*q'); maple('x:=101'); maple('e:=nextprime(12345678)') maple('d:=e&^(-1) mod ((p-1)*(q-1))') maple('y:=x&^(e) mod n') maple('c:= y&^(d) mod n')
function orms = odd_rms(nn) odd = 1:2:2*(nn-1)+1; orms = sqrt(mean(odd.^2, 2)); end
0load('C:\Users\WHY\Desktop\JK_Aux\workspace\json_all_data_16\squat_coords\Alessandro.mat'); x = squat_coor...
function bob=booster_base(proto, boost_steps, param1, param2) % bob=booster_base(proto, boost_steps) % % Constructor for booster_base class % % BASECLASS(ES) : learner % Copyright (c) 1998 GMD Berlin - All rights reserved % THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of GMD Berlin % The copyright notice above does no...
%% Reset fclose('all'); close all clear clc %% File paths topDir = '\\root\programs\Light-and-Health\IAI_CircadianMonitoringAndRegulation\CMR2-Exp1-Data'; sub300 = '300-43DF\43DF_2017_01_11_10_06_04_archive'; % last sub301 = '301-A4D7\A4D7_2017_01_04_09_13_14_archive'; % last sub302 = '302-0780-F900\F900...
function efficiency = box_efficiency(points,rect) %BOX_EFFICIENCY Box efficiency of covering flagged cells. % EFFICIENCY = BOX_EFFICIENCY(POINTS,RECT) returns the efficiency of the box RECT % of covering the flagged cells POINTS. POINTS is a binary image, and RECT is described % by the d-dimensional box conve...
% load_captured_data.m % Copyright 2003-2010 The MathWorks, Inc. [fileName,pathName]=uigetfile('captured*.mat','Select file'); if length(fileName)>0 load([pathName fileName]) else error('User aborted program') end if exist('fps','var') if exist('t_stats','var') disp(sprintf('fps=%.3g, Cv=%.2g%%'...
classdef Motorcycle < Vehicle methods function obj = Motorcycle(varargin) obj@Vehicle(varargin{:}); end end end
%========================================================================= % % Simulation of nonlinear and linear exponential models. % %========================================================================= clear all clc RandStream.setDefaultStream( RandStream('mt19937ar','seed',1) ) % Simulate data t = 5...
function ivim__rmalloutliers(iSubj,iPrePost) disp('Saving voxelwise map data... ') global vars init_vars % difference between rmalloutliers_2 and rmalloutliers_1 is that the % boundary exclusion criteria used for D* is actually the minimum bound, % whereas in rmalloutliers_1 it is the theoretical boundary (0.00251). % ...
function disableStim(hObject, ~, hGui) global stimEnable if get(hObject, 'value') stimEnable=0; set(hGui.stimDisableButton,'Enable','off') set(hGui.stimDisableButton,'Value',0); cla((hGui.Axes6)); end set(hGui.stimDisableButton,'Enable','on') end
function [Y] = convolution_output_side(X,H) N = size(X)(1,2); M = size(H)(1,2); H = flip(H)'; X = [zeros(1,M-1),X,zeros(1,M-1)]; Y = zeros(1,(M+N-1)); for i = 1:(M+N-1) Y(1,i) = X(1,i:i+M-1)*H; endfor endfunction
function move_cb_distribution(obj,delta_hsl) % Adjust for filament compliance delta_x = delta_hsl * obj.parameters.compliance_factor; % Shift populations by interpolation switch (obj.kinetic_scheme) case '3state_with_SRX' % 3state SRX model interp_positions = obj.myofilaments.x - delta_x; ...
%We used a Quasi Newton method where the Hessian used in each update step %is the Hessian evaluated at the initial point, x0. I.e. it is fixed %throughout the procedure. %Newton method converges in approx 30 iterations to the same %result as acheived by BB method of HW3 (and in fewer iterations) for the same %data @x ...
function r = funbiseccion(x) r = (x.*x) - 25; endfunction
function compare_HRF_peak(session_dir,srcROI,trgROI,map_type,ROIs) % Creates scatter plots of HRF peadata. % % Usage: % compare_CF_pRF(session_dir,srcROI,trgROI,map_type,ROIs) % % Examples: % compare_CF_pRF(session_dir,'volume','prf_V1','movie') % % Written by Andrew S Bock Jul 2015 %% if ~exist('ROIs','var'...
function [L_star]=poiProxOperator(Tr,Content,Z,lambda_5,tau) if lambda_5~=0 L_star=zeros(size(Z)); n_clusters=length(unique(Content.poi_cidx)); [n_users,~]=size(Tr.R_bool); for h=1:n_clusters h_idx=find(Content.poi_cidx==h); rho_h=sqrt(length(h_idx)); ...
function mean = localmean(f, nhood) %LOCALMEAN Computes an array of local means % MEAN = LOCALMEAN(F, NHOOD) computes the mean at the center of every % neighborhood of F defined by NHOOD, an array of zeros and ones where the % nonzero elements specify the neighbors used in computation of the local % means. The siz...
%% Introduction % This Matlab script runs the complete NLO algorithm and uses the supporting Matlab functions located in this folder. % The approach is based on % "State observation in medium-voltage grids with incomplete measurement infrastructure through online correction of power forecasts" % which was extended ...
function [O_error, O_grad]=jacobiandet_cost_gradient(O_grid,sizes,O_goal,sizeI,Spacing) % Convert Grid vector to grid matrix O_grid=reshape(O_grid,sizes); % Delta step used for error gradient step=0.001; if(nargout>1) if(length(Spacing)==2) [O_error1,O_grad1]=jacobiandet_error_2d_double(O_grid(:,...
function result = PSNR(f, g) assert(min(min(f)) >= 0); max_intensity = max(max(f)); % assumptions about the max intensity.. assert(max_intensity <= 255); if (max_intensity <= 1) max_intensity = 1; else max_intensity = 255; endif result = 10*log10( (max_intensity^2) / MSE(f,g) ); end function result = MSE...
% remove files % mixed= dir('./images/mixed/*.png'); % text= dir('./images/text/*.png'); % pictorial= dir('./images/pictorial/*.png'); % % % sample 17 images from each category % ind = randsample(length(mixed), 17); % sample_mixed = mixed(ind); % ind = randsample(length(text), 17); % sample_text = text(ind); % ind = r...
function [FDPD,MDPD,Thrust] = defQuadPropulsionModel6DoF(... w1, w2, w3, w4,... T2W_max, RPM_max, cM, m, g,... r1, r2, r3, r4) % % Inputs: % - Motor commands: % - w1 [rpm]: rotational speed motor 1 % - w2 [rpm]: rotational speed motor 1 % - w3 [rpm]: r...
function [g, y, z] = mllcalcf(mllparam) % Calculates filter and pulse % 1. Determine whether nop even or odd (even = 1 or 0) ****** % starts at 0 for odd, at +1/2 for even *** % Initialize *** global mllmu mllcu mpgdtmu mmggamma; % Set local values mu = mllmu ; n = mllcu ; cycls = mllparam(5) ; nop = mllparam(4) ...
%% Test that JtreeInfEng Returns the Same Results as VarElimInfEng % We compute prior marginals of each single node %#testPMTK dgmVE = mkAlarmNetworkDgm; dgmVE.infMethod = VarElimInfEng('verbose',true); dgmJT = dgmVE; dgmJT.infMethod = JtreeInfEng('verbose',true); queries = num2cell(1:37); tic; [mVE, logZVE] = ...
function varargout = graymat2avi(data, scale, frameRate, fileName, map) % graymat2avi converts grayscale data matrix to avi video and matlab mov % file % graymat2avi(data, scale, frameRate, fileName, map) % mv = graymat2avi(data, scale, frameRate, fileName, map) % scale is used by image resize, like [320 400] or 0.9 %...
% pop_readedf() - load a EDF EEG file (pop out window if no arguments). % % Usage: % >> [dat] = pop_readedf( filename); % % Inputs: % filename - EDF file name % % Outputs: % dat - EEGLAB data structure % % Author: Arnaud Delorme, CNL / Salk Institute, 13 March 2002 % % See also: eeglab(), readed...
function [ projy ] = proj_box( y ,a,b) %See "Fast Projection onto the Simplex and the ?1 Ball", Laurent Condat, 2015 for i =1 : size(y,2) low_ind = y(:,i)<a; up_ind = y(:,i)>b; y(low_ind,i)=a; y(up_ind,i)=b; projy = y; end end
clear clc lambda_avg = 1.11; mu_avg = 1.67; CV = 0.1; Lc = 5; L = 100; H = 100; Nx = 50; Ny = 50; %solving shape and scale parameters A = 1/CV^2; B_lambda = lambda_avg*CV^2; B_mu = mu_avg*CV^2; %mesh Np = Nx*Ny; Sx = linspace(0,L,Nx); Sy = linspace(0,H,Ny); [Xmesh,Ymesh] = meshgrid(Sx,Sy); %KL expansion tol = 0.01;...
function f_x = f_marginal_benifit_desc_16(x, base_point, target_point, p) k = -log(1 - p) ./ (target_point - base_point); f_x = 1 - exp(-k * (x - base_point)); % f_x = (1 ./ (1 + exp( -a * (x - b)))); end
function [a_up, a_diag, a_down] = tridiagonal_LU(a_up, a_diag, a_down, n) % a_down: a vector with (n-1) elements containig lower diag elements % a_up : a vector with (n-1) elements containig upper diag elements % a_diag: a vector with n elements containig main diag elements for k = 1:n-1 a_down(k) = a_d...
clc; clear all; close all; %Iniciando vetor D com valores de 1 a 10 D = [0:0.1:10]; D = D'; %Gerando valores entre -0,5 e 0,5 xmin= -0.5; xmax = 0.5; [nPadroes, nEntradas] = size(D); a=xmin+rand(nPadroes,1)*(xmax-xmin); %Adicionando o ruído na reta aleatorio = D + a; %Gerando as entradas através dos pont...
% This is the test script for the image_sort function. % The pixels of an image are sorted. % Author: Atakan Varol I = imread('exp_curve4.bmp'); % Read the image I_not = uint8(not(I)); % WB conversion I_edge = edge(I_not,'sobel'); % Edge detection [y x] = find(I_edge); ...
function net = somunpak(net, w) %SOMUNPAK Replaces node weights in SOM. errstring = consist(net, 'som'); if ~isempty(errstring) error(errstring); end % Put weights back into network data structure net.map = reshape(w', [net.nin net.map_size]);
function f_bubble(x,y,z,mx,sq,srt) % - create B&W bubble plots % % USAGE: f_bubble(x,y,z,mx,sq,srt) % % x = x-coordinates % y = y-coordinates % z = symbol size at each x,y coordinate (pos values produce black symbols, neg % vaues produce white symbols) % mx = maximum symbol size % sq = scale symbols ac...
% % Path -> /Users/djones/work/mWork/Fathom/RF % % f_RFaic - AIC-based variable selection for Random Forest Classification % f_RFclass - train a Random Forest classifier % f_RFclassPlot - create diagnostic plots of a Random Forest classification % f_RFclassPredict - predict class membersh...
%% Redes Neuronales Competitivas MultiCapa 2 (Back Propagation) clear all %limpiar Workplace close all %limpia ventanas clc %limpia command window %% Cargar Datos load RNCDatos4.mat; %% Datos del Modelo data = IPCfinal(:,5); nsal = 8; % Numero de Salidas nrez = 3; % Numero de Rezagos (debe ser mayor ) temp = []; %Vecto...
function a = ann_forward(X, theta, L, s) a = zeros(s, 1, L); a(:,:,1) = X'; for l=(2:L) z = theta(:,:,l-1) * a(:,:,l-1); a(:, :, l) = ann_sigmoid(z); end end
% Noms des fichiers d'output a analyser filename1 = '200_steps.out'; filename2 = '400_steps.out'; filename3 = '800_steps.out'; filename4 = '1600_steps.out'; filename5 = '3200_steps.out'; filename6 = '6400_steps.out'; % Chargement des donnees data1 = load(filename1); data2 = load(filename2); data3 = load(filename3); d...
%% Header % Project Name: OPT Projekat: Prepoznavanje Cifara % % File Name: AnalyseGroup.m % % Author: Nemanja Jankovic, 2015/3303 % % Date: /9/2016 function ErrorArray = AnalyseGroup(InputImage, FileName) NUMBER_OF_SAMPLES = 1000; H = 28; W = 28; Xcenter = W / 2; Ycenter = H / 2; File =...
Tstart = 0; Tend=1; % length of time Tspan = Tend - Tstart; Ts=1/1000; % time interval between samples mean = 0; variance = 3; f=10; phi = 0; t = Tstart:Ts:Tend; sp = subplot(2,2,1) x = cos(2*pi*f*t+phi) [phase_cos, ssf] = phase_calc_max(x,Ts) % call plotspec ...
function [angle_est,nn_idx] = nearest_neighbor(Y,euc_dist_vect) [~,nn_idx] = min(euc_dist_vect); angle_est = Y(nn_idx); end
%% gettfparams: Gets paramaters for a transfer function function [K, Tau, Theta] = gettfparams(t, u, y) %% Initialize variables deltay = max(y) - min(y); deltau = max(u) - min(u); y2 = 0.02*deltay + y(1); y10 = 0.10*deltay + y(1); y90 = 0.90*deltay + y(1); %% Find K K = deltay/deltau; %% Find Tau i = 1; w...
clc;clear all;close all; m=.1;Fricc=0.1; long=0.6;g=9.8;M=.5; h=0.0001;tiempo=(20/h);dpp=0;fipp=0; t=0:h:tiempo*h; omega=0:h:tiempo*h; alfa=0:h:tiempo*h; d=0:h:tiempo*h; dp=0:h:tiempo*h; u=linspace(0,0,tiempo+1); %Condiciones iniciales alfa(1)=pi-0.8; color='b'; d(1)=0; dp(1)=0; u(1)=0; d(1)=0; i=1; %Versión linealizad...
%% % We design a LQR controller for stabilyzing the fractional reaction diffusion equation %% % $$ % \begin{cases} % y_t + (-d_x^2)^s y-\delta y = u\chi_\omega, & (x,t) \in(-L,L)\times(0,T) % \\ y = 0, & (x,t)\in [\mathbb{R}\setminus(-L,L)]\times(0,T) % \\ y(x,0) = y_0(x), & x\in(-L,L), % \end{cases} % $$ %% % where...
%% Pilot_In_Loop_Bank_Angle_Plot %% Bank Angle-Time Diagram figure('Name','Bank Angle-Time Diagram') plot(Phi) title('Bank Angle Variation due to Time') xlabel('Time (sec)') ylabel('Bank Angle Phi (rad)')
function [results, success] = ... scopf(mpc, cont, mpopt, tol) %SCOPF Solves an optimal power flow with security constraints. % [RESULTS, SUCCESS] = SCOPF(MPC, CONT, MPOPT) % % Returns either a RESULTS struct and an optional SUCCESS flag, or individual % data matrices, the objective function value and a SUCC...
classdef (Abstract) CustomGuiInterface < handle properties (Access = protected) uiInstance text backgroundColor fontColor fontName fontWeight fontAngle fontSize end methods (Abstract) setText(obj, text); s...
% Clustering data in groupsNum groups % Returns groupsNum cells with three columns, one for % each outcome variable (TE,PE,SL3) function WCSTclusters_stats = createClusters(indivStats, groupsNum) % indivStats_matrix format: CC, WTE, PE, SL3 indivStats_matrix = [[indivStats.TE]', [indivStats.PE]', [indivStats.SL3]', [...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2013 Analog Devices, Inc. % % 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:/...
%% Receiver Operating Characteristic (ROC) curve % This script plots the ROC for the Gibbs concentration factor % and a 5-point detector. close all; clear all; clc %% Initialization % Define the Fourier modes nModes = 64; fourModes = (-nModes:nModes).'; % Generate a (periodic) physical space grid nGridPts = 256; x...
% group bounding boxes using non-maximum surpression % Written by Xikang Zhang, 06/21/2013 function [bb, weights] = groupBBox_nonMaxSup(bb,weights,winSiz) if nargin<3 winSiz = 30; end assert(size(bb,1)==length(weights)); valid = true(size(weights)); xc = bb(:,1)+bb(:,3)/2; yc = bb(:,2)+bb(:,4)/2; for i=1:length(v...
function [] = train() symbolVecs = readSymProps('spade'); symbolVecs = [symbolVecs;readSymProps('heart')]; symbolVecs = [symbolVecs;readSymProps('club')]; symbolVecs = [symbolVecs;readSymProps('diamond')]; % numberVecs = []; % for i = 2:9 % numberVecs = [numberVecs;readNumProps(i)]...
function s=ks(); c=clock; s=sum(c(4:6).*[60^2 60 1])/1000; end
F = 50; vector_1 = 0:0.001:0.2; sinusoidal_1 = 2*sin(2*pi*F*vector_1); figure(1) subplot(3,1,1) , plot(vector_1,sinusoidal_1,'.-'),xlabel('Timp [s]'),grid F = 50; vector_2 = 0:0.01:0.2; sinusoidal_2 = 2*sin(2*pi*F*vector_2); subplot(3,1,2) , plot(vector_2,sinusoidal_2,'.-'),xlabel('Timp [s]'),grid ...
function test_svm_struct_learn % TEST_SVM_STRUCT_LEARN % A demo function for SVM_STRUCT_LEARN(). It shows how to use % SVM-struct to learn a standard linear SVM. randn('state',0) ; rand('state',0) ; % ------------------------------------------------------------------ % ...
function [ fis, extended_training_set, extended_actions, new_state ] = q_learning( fis, sys_tf, training_set, actions, state, iteration, sample_time, epsilon, gamma ) % fis - нечеткая система % training_set - обучающее множество % extended_training_set - обучающее множество, расширенное новым ...
function [ydot] = fofy(t,y,u) ydot=u(1)*y; %ydot=-u(1)*(y-(t*t+1))+2*t; end
function I = filtro_general(A, text) % A en 8 bits % I en 8 bits if text == 'promedio' B = (1/9) * ones(3,3); elseif text == 'gaussiano' B = (1/16) * [1 2 1; 2 4 2; 1 2 1]; elseif text == 'gaussiano5' B = (1/256) * [1 2 64 1; 4 16 24 16 4; 6 24 36 24 6; 4 16 24 16 4; 1 4 6 4 ...
% Mean Function Abstract Class % All mean function classes must inherent from this class. classdef MeanFunc < tacopig.taco methods(Abstract) % Returns the number of parameters required by the mean function. % n = npar(D); % Input : D (dimensionality of the input da...
%CGpipeline %close all; clear; clc; CGpipeline %Load neural data load bint_fishmovie32_100 data=reshape(bint(1,:,:),[160,953]); data=data*2-1; mean(sum(data>0,2)/953); mean(mean(data,2)); %Pre-allocate space for saving each GC step CGevents=70; %Number of iterations C{1,CGevents+1}=[]; C{1}=data; Rec=d...
function dfdxval = SEIR_var_dfdx(t,y,p,more) p = more.p.fun(t,more.pdef); beta = more.beta.fun(t,p,more.betadef); r = zeros(length(t),size(y,2),size(y,2),size(y,2)); % dimnames(r) = list(NULL,colnames(y),colnames(y),colnames(y)) r(:,1,1,1) = beta.*(p(2)+y(:,3)) + p(3); r(:,1,1,3) = beta.*y(:,1); r(:,2,2,1) = beta.*(p(...
function save_lda_model(model, model_root) filename = sprintf("%s.beta", model_root); file = fopen(filename, "w"); disp(filename) for i=1:model.num_topics for j=1:model.num_terms fprintf(file, '%5.10f ', model.log_beta(i, j)); end end fprintf(file, '\n'); fclose(file); filename = sprintf("%s.ohter", m...
function [out1,out2,out3] = Localize_Fix(closestPiMat,nVals,BCNstruct,theWPs,RSSI_0,noise) % Method to localize a patient carrying a mobile beacon % out1: a structure containing the (x,y) coordinates % out2: a vector of known location errors for testing global locPiOne locPiTwo locPiThree... locPiFour l...
function adaboost_model = ADABOOST_tr(tr_func_handle, te_func_handle, train_set, labels, no_of_hypothesis) % % ADABOOST TRAINING: A META-LEARNING ALGORITHM % adaboost_model = ADABOOST_tr(tr_func_handle,te_func_handle, % train_set,labels,no_of_hypothesis) % % 'tr_func_handle' and '...
%q1 [y1, y] = fourierseries(1, 1, 200, .25, .75); [y2, ya] = fourierseries(1, 2, 200, .25, .75); [y3, yb] = fourierseries(1, 3, 200, .25, .75); x = linspace(0,1,200); %plot of first 3 figure hold on plot(x, y) plot(x, y1, '--') plot(x, y2, ':') plot(x, y3, '.') title('Square Wave with First 3 Nonzero Fourier Modes') x...
function [ BoWvec, Label ] = encodingImage( ImageSets, Vocabulary, Norm ) % SIFT Feature extraction: via hard voting (i.e, assignment to the nearest(K=1) codeword) % % Inputs-> % % ImageSets : imageSet class % Vocubulary: visual words or centroids or cluster centers (each column is a word) % Norm : Normal...
figure(3) % close all clear phi_val theta_val pot_s pos_r1=interp1(radial_r_value_flux,1:Nradial,r1) pos_r2=interp1(radial_r_value_flux,1:Nradial,r2) % pos_r3=interp1(radial_r_value_flux,1:Nradial,r3) for offset=1:2:size_r_TAE-1 posTAE_value=pTAE_inf+offset qcheck=q_initial_profile(posTAE_value) Phi_thet...
function weights=fitnessfun(x) % a=weight_to_optimise; weights=x;
% File: P2_92.m clear; M = 6; N = 2^M; T1 = 10; T = 1; dt = T1/N; n = 0:1:N-1; tk = n*dt; tk = tk(:); % Generating waveform % Note in the FFT time domain, points for negative time are the same as those % measured from the end of the data span-lenght T1 for positive time. w = zeros(length(n),1); for (i = 1:1:length(w...
function [x, y, z] = voxelRange(neuron, voxelSize) % VOXELRANGE % % Description: % Split the area within a bounding box into voxels of a specific size % % Syntax: % [x, y, z] = voxelRange(neuron, voxelSize) % % History: % 9Feb2021 - SSP % ------------------------------...
function [ y ] = findVal( x1,x2,y1,y2,x) %findVal Finds linearly interpolated value slope=(y2-y1)/(x2-x1); y=slope*(x-x1)+y1; end
function [expVals] = expectedVal(obsVectors) %Calculates expected values for chi2 %Each row points to one observation rowSums=sum(obsVectors,2); colSums=sum(obsVectors,1); totalSum=sum(obsVectors,'all'); expVals=rowSums.*colSums; expVals=expVals./totalSum; end
%optimization script N=3000; f=@(x) Par_est_obj2(x(1:3),x(4:7),N); OPS=optimset('Display','iter','MaxIter',120); [a,b,c,d,e]=fminsearch3(f,[1.7,5,10,0.01,16,2.5,10],OPS) %resposta é a=[3,5,8,0,16,2.47,1.4] f2=@(x) Par_est_obj_LS(x(1:3),x(4:7)); opt = optimoptions(@lsqnonlin,'Display','iter-detailed','MaxIter',20...
function dydt = f(t, y, p) % eval(p); force = 2/(1+sqrt(1+8*keq*y(2))); dydt = [ vm/(1+(y(2)*(1-force)/(2*pc))^2)-km*y(1); vp*y(1)-(kp1*y(2)*force+kp2*y(2))/(jp+y(2))-kp3*y(2); ]; % ======================================================================= % the information below is written into the file name...
% must run liat's script first! % file_name = '11-Mar-2019 09_12_39.mat'; % file_name = '11-Mar-2019 09_11_33.mat'; file_name = '11-Mar-2019 10_28_43.mat'; record.TX.info_msg_bits = info_msg_bits; record.TX.info_msg_with_CRC = info_msg_with_CRC; record.TX.crc = [1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1]; reco...
clear; %Low-pass Gaussian Filter (LPGF); f = imread('monarchg.png'); [N M] = size(f); f = double(f); % Compute padded size to prepare for FFT-based filtering. NM = [N M]; PQ = 2*NM; % Set up range of variables. u = single(0:(PQ(1)-1)); v = single(0:(PQ(2)-1)); % Compute the indices for use in meshgrid. idx = find(u > P...
function [mND, Index] = ave_NearNeighborStats(rrt,Nt,nbins, Maxx, Scale, Fign,figname) %% average NN stats for a group % Created by Wan-Qing Yu No = length(rrt); NeighData = []; for i = 1:No [ND{i},Index(i)] = NearNeighborsStats(rrt{i},Nt(i),nbins,Scale(i),Maxx,i); mND(i) = mean(ND{i}); NeighData = cat(2,N...
function vectors3d(varargin) %VECTORS3D Description of functions operating on 3D vectors. % % Vectors are represented by their 3 Cartesian coordinates: % V = [VX VY VZ]; % % List of vectors are represented by N-by-3 arrays, with the coordinates % of each vector on a row. % % % See also % vectorN...
function imVolWrite(data, imDir, fileList) % writes image stack variable into grayscale tiff images. % SYNTAX: % imVolWrite(data, imDir, fileList) % % INPUT: % "data" is the returned 3d matrix contains the image stack. Elements of % data are assumed to have real value within [0, 1]. % "fileList" is the...
data = dlmread('full_params.csv',','); data = data(1:66404,:); data(:,1) = data(:,1)./60; n = size(data,1); nTest = 10000; sets = [500, 1000, 2000, 4000, 8000, 15000, 30000, n-nTest]; ind = randperm(n); % dlmwrite('bayesNetData.csv',data(ind(1:10000),:)); %% dlmwrite('testSet.csv',data(ind(1:nTest),:)); data=data(in...
function layersE = makeLayersE(layers_our,E,num_points,all_layers) % initializing fields for layersE struct layersE = layers_our; interpnames = cellstr(['N/A']); [layersE(:).interp_name] = deal(interpnames{:}); efieldnames = cellstr(['M1_PA_MCB70']); [layersE(:).Efield_solution] = deal(efie...
h1 = subplot(3, 1, [1 2]); iP = 1; n_c = find(abs(diff(ux)) > D/2); n_c = [n_c'; n_c'+1]; n_c = [1; n_c(:); length(t)]; uxc = ux(n_c); lxc = lx(n_c); t_c = t(n_c); %fill([t fliplr(t)], [lx; flipud(ux)]', 0.8*[1 1 1], 'EdgeColor','none'); fill([t_c fliplr(t_c)], [lxc; flipud(uxc)]', 0.8*[1 1 1], 'EdgeColor','...
function [] = pupilUncertaintyTimecourse(plotAll) % This code reproduces the analyses in the paper % Urai AE, Braun A, Donner THD (2016) Pupil-linked arousal is driven % by decision uncertainty and alters serial choice bias. % % Permission is hereby granted, free of charge, to any person obtaining a % copy of this soft...
function [result] = simpson033(f, atas, bawah, segmen, h) totalGenap = 0; totalGanjil = 0; for i = 1:segmen-1 xi = bawah + i*h; if(mod(i,2) == 0) totalGenap = totalGenap + f(xi); else totalGanjil = totalGanjil + f(xi); end end result = (...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function doPrecomputeHistoObjBg_testData % Pre-computes the histograms of the entire image, each of its objects, and the background of each % of these objects. % % Input parameters: % % % Output parameters: % % %%%%%%%%%%%%%%%%%%%%%%%%%...
function [energy_per_kg_mango, air_per_kg_mango] = ... idealDrying(UIaxes, m_hum_in, m_hum_out, s_air_t, s_air_hum, ... t_in, t_out) %IDEALDRYING calculates an ideal convective dryer (e.g. ideal ATESTA) % % inputs: % m_hum_in: humidity of raw-mango (in percent) % m_hum_out: humidity of dry-mango (in...
%Case 1: dimx=256; indata = single(rand(dimx,1)); outdata = tom_bandpass(indata,5,126,10); fid = fopen('Input_Bandpass_1.bin','W'); fwrite(fid,indata,'single'); fclose(fid); fid = fopen('Output_Bandpass_1.bin','W'); fwrite(fid,outdata,'single'); fclose(fid); %Case 2: dimx=256; dimy=255; indata = single(rand(dimx,dimy)...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 该函数用于获得color数据的各个特征数据,如直方图、纹理等信息 2017.03.18 % image_rgb:输入数据为归一化的double数据 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function imdata = get_imgData2( infolder, frameName, ScaleH, ScaleW ) image = imread(fullfile(info...