text
stringlengths
8
6.12M
total_days = size(W_feeder,3); for day=1:total_days day display_feeder_network(W_feeder(:,:,day),X_feeder_number_of_visitors(:,day),LOCATIONS) title(strcat('day:',num2str(day))); pause(.15); %FRAMES(day)=getframe; end
function write_instructions() screen1_file; screen2_file; screen3_file; screen4_file; screen5_file; save([pwd(),filesep,'data',filesep,'texts',filesep,'text_welcome.mat']); end
%% YPOLOGISTIKH NOHMOSUNH 2021 PTUXIAKH EXETASTIKH %% NIKOLAOS ISTATIADIS AEM:9175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CROSS VALIDATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DATASETS function [Dtrn_Cross , Dval_Cross] = cross_Validation(Dtrn,characteristics,Index_F,i) ...
a=0.02; e=0.04; b=0.5; g=1; d=0; dt=0.001; t=1:500/dt; lt=length(t); ltI=10; %duration of pulse v=zeros(1,lt); w=zeros(1,lt); for t=1:ltI; v(t+1)=v(t)+dt*(-w(t)-v(t).*(v(t)-a).*(v(t)-1)+20); w(t+1)=w(t)+dt*e*(b*v(t)-g*w(t)-d); end for t=ltI:lt; v(t+1)=v(t)+dt*(-w(t)-v(t).*(v(t)-a).*(v(t)-1)); w(t+...
function [new_cluster,centers] = clustering(toBeClustered) %toBeClustered = relative_ac; [cluster , centers ] = kmeans(toBeClustered,3); [~, indice_max ] = max(centers); [~, indice_min] = min(centers); indice_remain = setdiff(1:3,[indice_min,indice_max]); new_cluster = zeros(length(toBeClustered),1); new_cluster(...
close all; clear all; clc; %select the correct path: it will open the images' folder path = '~/Desktop/'; %allows the user to select the first image to analyze [FileName,PathName] = uigetfile('*.TIF','Select the first image',path); img1 = sprintf('%s%s',path,FileName); %allows the user to select the secon...
function betaandsmectite() set(0,'defaultLineLineWidth',3) set(0,'DefaultAxesFontSize',15); %load 'thermal_history_wells.mat' kb_ST168=130; wd_ST168=70; lat_ST168=28.57276479; bht_depths=[17060;17552;19361]; bht_depths=[0;bht_depths-(wd_ST168+kb_ST168)]; Tswi_ST168=tswi_calc(lat_ST168,wd_ST168); bht_ST168=[265;280;30...
function [elog gradMuq, gradSigmaq] = opperElogGaussFullQuad( y, fwdFunc, ... muq, Sigmaq, diagSigmay, S ) %OPPERELOGGAUSSFULLQUAD Elog for Opper's method using quadrature % Detailed explanation goes here % S argument is irrelevant here but we need it for consistency with % o...
function uq_SVR_print(SVRModel, outArray, varargin) %% Consistency checks and command line parsing if ~SVRModel.Internal.Runtime.isCalculated fprintf('SVR object %s is not yet calculated!\nGiven Configuration Options:', SVRModel.Name); SVRModel.Options return; end if ~exist('outArray', 'var') || isempty(ou...
figdir = './figs/'; %% Compact Configuration sp.fov = 29.0; sp.win_d = 0.72; sp.dk_off = [0., 0.9271]; sp.el_off = [0., 2.3]; sp.az_off = [0., 0.]; sp.min_el = 50.0; sp.n_rx = 3; %sp.gs_dim = [0,0]; scoop_h = 0:0.01:3; fb_h = [1.75, 2.5, 3.5]; gs_r = nan(length(fb_h), length(scoop_h)); gs_h = nan(length(fb_h), lengt...
function res = eval_this() global params AE mapping = java.util.HashMap; theorbits = cell(params.orbit_list); theinstruments = cell(params.instrument_list); for o = 1:params.norb orb = theorbits{o}; valid = false; while(~valid) tmp = input(['Payload in orb ' orb '...
function str = Int2UCText(Vec) % str = Int2UCText (Vec) % Input: Vec = a vector of nonnegative integers in the range % (0, 1, ..., 25) % Output: str = a string of corresponding Upper-Case text (alphabet: A, B, ..., Z): % 0 -> A, 1 -> B, ..., 25 -> Z if max((Vec < 0) | (Vec > 25)) > 0 e...
function [J, grad] = linearRegCostFunction(X, y, theta, lambda) %LINEARREGCOSTFUNCTION Compute cost and gradient for regularized linear %regression with multiple variables % [J, grad] = LINEARREGCOSTFUNCTION(X, y, theta, lambda) computes the % cost of using theta as the parameter for linear regression to fit the ...
function IM = ReadITKImage(filename, dims) % READITKIMAGE reads in image formats supported by ITK. % SYNTAX: % IM = ReadITKImage(filename) reads the image identified by filename and % returns the image in metaimage format % % OUTPUTS: % IM is the image in metaimage format % % EXAMPLE: ...
function [X_pool, ind] = max_pool_forward(X_relu, pool_param) % X_conved: conved images now wait for pooling. % we adopt distinct pooling strategy. % the 'pool_param.stride' is not used. % function works like sub2ind, but faster! (maybe...) get_ind = @(siz, x1, x2, x3, x4) x1 + (x2-1)*siz(1) + ...
% Does webtree as a binary integer programming problem. This is our second shot % at it. % % Author: Alden Hart and Rich Korzelius % 3/22/2015 FILENAME = 'processed_data_spring-2014.csv' OUTFILE = 'MATLAB_result_spring-2014.txt' all_data = csvread(FILENAME); student_ids = all_data(3:end,1); crns = all_data(1,2:end); ...
function plot_velocity(vc_history, error_history) shape = size(vc_history); vels = shape(2); total_iter = shape(1); figure(3); gcf; xlabel('iterations'); ylabel('Velocity'); for i = 1:vels plot([1:total_iter],vc_history(:,i)'); hold on; end legend('vel-x','vel-y','vel-z','omega-x','omega-y','omega-z...
% The following example is based on the tutorial available in the % following webpage: % https://mattmazur.com/2015/03/17/a-step-by-step-backpropagation-example/ % This has been used as a trail to ensure that the MLP equations % are right x1 = [0.05; 0.10]; y = [0.01; 0.99]; % In this example we are considering only ...
function results = ASSIGN_evaluate_architecture(arch) %% ASSIGN_evaluate_architecture.m global params r = global_jess_engine(); % This function asserts missions corresponding to the packaging % architecture given in the input, and then evaluates them instr_list = params.assign_instrument_list; % Clear expl facility c...
function ii=ImageToIntg(i,W,H); s=[]; ii=[]; for m=1:H for n=1:W if n==1 s(m,1)=i(m,1); else s(m,n)=s(m,n-1)+i(m,n); end if m==1 ii(m,n)=s(m,n); else ii(m,n)=ii(m-1,n)+s(m,n); end end end
x_mean=61; % assume this is the effect size x_sigma=(68^2 + 68^2)^0.5; df = 30; x_mean=10 x_sigma=20 df = 55*4 - 100 - 6 -1 t = x_mean/(x_sigma/sqrt(df)); zdata = spm_t2z(t,df-1) pval = 0.001; p=1; z=0; while p >= pval p = 1-spm_Ncdf(z); z=z+0.01; beta = spm_Ncdf(z,zdata,1); end beta zcrit= z ...
clearvars; m1 = 1.2540; l1 = [0.3240 0 0]; r1 = [0.1471 -0.0237 -0.0091]; i1 = [ 0.0038 -0.0001 -0.0026 -0.0001 0.0143 -0.0003 -0.0026 -0.0003 0.0143]; l1f = l1(1); r1f = [r1(1) 0 0]; %% Load Corke Model % L(1) = RevoluteMDH('d', 0, 'a', 0, 'alpha', 0, 'offset', 0,... % 'm', 0, 'r',...
% Abstract class for the kinematics and dynamics of a single cable % % Please cite the following paper when using this for multilink cable % robots: % D. Lau, D. Oetomo, and S. K. Halgamuge, "Generalized Modeling of % Multilink Cable-Driven Manipulators with Arbitrary Routing Using the % Cable-Routing Matrix," IEEE Tr...
clear; clc; Ntask = 100; Nworker = 10; Ndom = 7; Redun = 5; ndom = 3; [L,groundtruth] = L_simulation_noNoise(Ntask,Nworker,Ndom,Redun,ndom); model = crowd_model(L,groundtruth); Ntask = model.Ntask; p0Set = 0.05/32:0.05/32:0.05; p1Set = 0.5:0.025:0.95; [x,y]= meshgrid(p0Set,p1Set); [n,m] = size(x); SEEKresultSet =...
%% gen pure tone stim with ITD fs = 195312.50; dur = 200*1e-3; % 200ms sound nSamp = round(fs*dur); MAX = 0.8; % constrain each wave to be within [-0.8,0.8] to allow some modulation of amplitude, either increase or decrease of amplitude % load following calibration data from 03012016 % amplitude difference betwee...
function [] = plot_rank(x, varargin) loglog(sort(x, 'descend'), varargin{:}); xlabel('Rank'); ylabel('Frequency');
%% Derive the robotics dynamics: clear all tic %% Get DH parameters, rotation matrices, ... % Get d1,...,d6, a1,...,a6, alpha1,...,alpha6 % A1(theta_1), ..., A6(theta_6) % Transformation Matrices T1...T6: % T1(theta_1), ..., T6(theta_1, theta_2, theta_3, theta_4, theta_5, theta_6) % Rotation Matrices R1, ..., R6: % R1...
%Bład drugi i nieskonczony function [deltaSr, deltaMx]= wskBlad(A) deltaSr = max(sqrt(eigs(A' * A))); deltaMx = max(sum(abs(A), 2)); end
function [Sdraw] = Kalman_companion(data,S0,P0,H,R,F,Q) [t,nm]=size(data); kml=size(S0,1); km=size(H,2); % KF Sp=S0; % p for prediction: S(t|t-1), Stt denotes S(t|t) Pp=P0; S=zeros(t,kml); P=zeros(kml^2,t); for i=1:t y = data(i,:)'; nu = y - H*Sp(1:km); % conditional forecast error f = H*Pp(1:km,1:km)*H...
%%Stereo to Ambisonic %parameters n = 1; %ambisonic order azi = [0, 90, 180, 270]; %azimuths azi = azi .* pi/180; elev = zeros(size(azi)); %elevations, 0 for no height elev = elev .* pi/180; Fs = 44100; %sample rate %calculate Spherical Harmonics clear front clear right clear back clear left front = zero...
% Metodo de Newton en dimension n para aproximar % una solucion del sistema F(x)=0. % F se especifica en este archivo. F' se aproxima con % diferencias finitas. % x0 es un valor semilla y es un vector de dos entradas. function [Indicador,r] = MetodoNewton_n(x0, MaxNumIter, Tol) Indicador = 0; r=Inf; for i=1:MaxNumIter...
%清除画布 clf; %清除坐标轴 cla; %关闭窗口 close all; %清除所有原有变量 clear all; %清除命令窗口的内容 clc; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %图像1 Image1=imread('data/1.jpg'); Image2=imread('data/2.jpg'); %RGB分量 Image11=Image1(:,:,1); Image12=Image1(:,:,2); Image13=Image1(:,:,3); Image21=Image2(:,:,1); Image22=Image2(:,:,2); ...
function [tree2_num,pathfind] = extend_rrtree2only(tree2_num,tree1node) global rrtree2 thickenline map STEP Astar_Goal; [map_row,map_col] = size(map); while(1) % rand num if (rand()<0.5) rand_node = rand(1,2).*[map_row,map_col]; else rand_node = tree1node; % from Goal to Start end...
% Check that we are running a compatible version if (~contains(version, '9.5.0')) || (~contains(computer, 'GLNXA64')) error('You must compile this function using R2018b (9.5.0.1067069) 64-bit (glnxa64). You are using %s, %s', version, computer); end disp('Configuring spm to be used as part of a standalone executa...
%% Modelli cD close all; clear; clc addpath('LiteratureModels') % Implemented, working models for cD calculation % ["Holzer&Sommerfeld", "Holzer&Sommerfeld_simplified", "Swamme&Ojha", % "Ganser", "Chien", "Dioguardi", "Heymsfield&Westbrook", % "VenuMadhav&Chhabra", "Standard" (SPHERE ONLY!), "debug"] models_default...
function [ferr,dW_total,dh_total,dv_total, poshidprobs, poshidstates, negdata, stat] = ... fobj_tirbm_CD_LB_sparse_audio(imdata, W, hbias_vec, vbias_vec, pars, CD_mode, bias_mode, spacing, l2reg) % imdata:sample_size * 1 * 80; W:6*80*300 hbias_vec:300* 1 vbasis_vec:80*1,spacing:3 ws = size(W,1);% ws:6 % poshidexp:(...
classdef IsoMapTransform < ATransform % Pricipal Component Analysis transform class properties (SetAccess=protected) %The different components mapping = []; %How many components are used (default 1) degree = 1; end methods function obj = IsoMapTransform(degree) ...
function [X,lon] = regrid2gcm(Xo,lon_o) %REGRID2GCM Regrids lat-lon data sets into lons that resemble GCM output % Simply switch the bounding box of the data such that lons go from 0 to % 360 instead of -180 to 180. Xo is in units of (lat,lon,time), and this % also assumes that the grid is regular lat-lon. X=zer...
function [ValveLift,ValveOverlap] = AdaptValveData(VD,RunCond) %UNTITLED Summary of this function goes here % VD: struct containing original Valve Data % RunCond: struct containing Running Conditions IntDephasing = RunCond.IntakeShift; % [CAD] Shift of the intake camshaft ExhDephasing = RunCond.ExhaustShift;...
function C=extractdiagblocks(A,n) %EXTRACTDIAGBLOCKS Extract diagonal blocks. % % C=EXTRACTDIAGBLOCKS(A,N), returns a sparse matrix C with the % N-by-N diagonal blocks of A. A must be real double with an integer % number of diagonal blocks. A can be sparse or full. error('Cannot find mex file')
epochNum = readtable('epochNum.csv'); epochTime = epochNum(:,1); epochState = epochNum(:,2); epochLength = epochNum(:,3); length = 3600; %Set to the number of seconds we will run, 1 hour = 3600 hour = 1; Fs = 512; %Set standard frequency %hourOneDelta = []; %hourOneNormal = []; unf...
function s_out = remove_quotation_marks(s_in) s_out = cell(length(s_in),1); for i=1:length(s_in) elems = strsplit(s_in{i},'"'); if length(elems)==1 s_out{i} = elems{1}; elseif length(elems)==3 s_out{i} = elems{2}; end % convert date to american format if i==2 co...
function xLim3 = xLimCOB(theta,x1,xMid,x2) [A,~,H,volume,V_all,~,~,~,thetaL,thetaR] = setValue(); tol = 10^-6;%精度 runtimes = 100; precision = 6;%分数转小数保留的位数 if nargin == 1 x1 = 0;%初始化x1作为5的第一次迭代下界 x2 = -sqrt(H/A);%初始化x2作为1的第一次迭代下界 xMid = sqrt(H/A); end xLim3 = [x1 xMid x2]; % fileID =fopen('迭代信息.txt','w'); c...
function importDaVisSet(outfile,infiles) if (nargin < 2), [fn,pn] = uigetfile({'*.vec;*.vc7','DaVis vector files (*.vec,*.vc7)'; ... '*.*', 'All files'}, 'Choose DaVis input files', ... 'MultiSelect','on'); %attach the path name to every file for i = 1:length(fn), infiles{i} = ...
cd('/Users/abrahamn/Documents/MIT/21cm/sat_cal/updates/2014/jan28/unpolarized_beam_analysis'); nsides=32; angcell = pix2ang(nsides); pixang=cell2mat(angcell)'; interleavingtimes = zeros(1,10); beams = zeros(2,nSide2nPix(nsides),10); beamind = 1; %% label='Zenith_20130905'; disp(['starting ',label]); strs=strspli...
function A2 = project_to_simplex(A) %PROJECT_TO_SIMPLEX Summary of this function goes here % Detailed explanation goes here [N,M] = size(A); [A1,IX] = sort(A',1,'descend'); J = ones(N,1)*(1:M); J = J'; A1cum = cumsum(A1,1)-1*ones(M,N); A1minus = (A1 - (A1cum ./ J)) > 0; rho = max(double(A1minus).*J,[],1); theta = A1...
% Find the frequency response of first order IIR digital filters. alpha = 0.4; num = ((1-alpha)/2)* [1 1]; den = [1 -0.4]; freqz(num, den); % Compare the magnitude and phase response with FIR filters. % Design a second order IIR bandpass filter with center frequency 0.4? % and 3-dB bandwidth of 0.1?. Use...
function boxScatterFitPlotWrap(vs, xlbl, ylbl, sB, sF, nb) if nargin < 4 sB = true; end if nargin < 5 sF = true; end if nargin < 6 nb = 12; end figure; hold on; set(gcf, 'color', 'w'); xs = [vs.(xlbl)]; ys = [vs.(ylbl)]; ix = ~isnan(xs) & ~isnan(ys); ...
function [E] = pose_estimate_nlopt(Eg, Ipts, Wpts) % POSE_ESTIMATE_NLOPT Estimate camera pose from 2D-3D correspondences via NLS. % % [E] = POSE_ESTIMATE_NLOPT(Eg, Ipts, Wpts) performs a nonlinear least squares % optimization procedure to determine the best estimate of the camera pose in % the calibration targ...
% Script for normalizing sub-regions % (C) Copyright 2019 The Huang Lab % % All rights reserved Weldon School of Biomedical Engineering % Purdue University % West Lafayette, Indiana % USA %...
function [out]=shake(in,center,shakes) % % Written By: Michael Hutchins switch nargin case 1 center=1; shakes=1; case 2 shakes=1; end for i=1:shakes if i>1 in=out; else in=logical(in); end dimension=ndims(in); if dimension==1; out=circshift(...
function [p,l_map,l_cnt] = init_population(ss,N) % Initialize population through random state assignment to ss edges. % ss acts as a mutation matrix: if edge (i,j) is oriented in the ss then % it can change state in each individual in the population. n = size(ss,1); % #nodes p = cell(1,N); % population ...
function YY=position_Ali(ImageFolder,files,Threshold) % size of the probe in pixels probe_size=21; Nfiles=length(files); minFrame=min(15,Nfiles) AliYY=zeros(minFrame,1); for i=1:minFrame %Nfiles %----- read one image in folder----% imfile = fullfile(ImageFolder,files{i}); grayImage = imread(imfile); ...
function [aV] = vol_binarize(aV_input, varargin) % % NAME % % function [aV] = vol_binarize(aV_input, [, af_binValue, af_false]) % % % ARGUMENTS % INPUTS % aV_input volume data space to binarize % % OPTIONAL % af_binValue float binary value (default = 1) % af_false ...
%%%%%%%%%%%%%%%%%%%%%%%%%% % calculate_stiffness % Marie Moltubakk 26.6.2013 % Read stiffness equation and max force % Produce stiffness for a range, i.e. 80-100%, of ind max force %%%%%%%%%%%%%%%%%%%%%%%%%% function stiffness = calculate_stiffness(stiff_eq, force100, percent_start, percent_stop, label) ...
%% Top level settings % Here, the model which is to be simulated is set (h) with a controller (c) % which is then simulated in a specified time (t). To change model or % controller parameters, alter the corresponding init file or the % appropriate parameter in the workspace. No parameters are hard coded in % the simul...
close all; clear all clc; %% Step 1: Initial Allocation of Households on the Checkboard rand('seed',0); % initializes the random number generator parcel = randperm(225)'; resarea = zeros(15,15); resarea(parcel(1:110)) = 1; % black resarea(parcel(111:220)) = -1; % whites clear parcel; resar...
function [pose, d] = setup_GUI_Screen(s_Per) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% input %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % s_Per: Screen Coverage percentage % num: figure number %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%% Screen Coverage %%%%%%%%%%%%%...
%% Collecting all individuals’ solutions into a n × n agreement matrix, % where n is the number of pieces of the puzzle. % Each cell aij in the matrix records the proportion of individuals that set cities i and j as neighbors. function [cMat_Right,cMat_Down] = calcAgreementMatrix(expPop, b1, b2, Nsubimages) [...
if ~exist('toyset'), disp('Error: please specify toy set.'); return; end; toysetcases = dir([toyset '\*.mat']); toysettestcasecount = 1; for ii = 1 : length(toysetcases) load([toyset '\' toysetcases(ii).name]); runtest; testresult{toysettestcasecount} = {toysetcases(ii).name lda pl rp km nn nn3}; toysettest...
function [A] = mean_angle(x) %% [A] = mean_angle(x) calculates % for a vector x of angles in radians the % mean angle between 0 2pi % convert to complex plain y = exp(1i*x); % cal average point in complex plain A = angle((nanmean(real(y)) + 1i*nanmean(imag(y)))); A(A>2*pi) = A(A>2*pi)-2*pi; A(A<0) = A...
function testOnlineTracking_helper % Do not call this function directly. % See 'testOnlineTracking' for more details. global TEST_MTT MTT; offset = 0.5; %offset for grouping observations: big difference on outcome n = get(TEST_MTT.timer,'TasksExecuted'); %Number of time intervals that have passed if (n == T...
function [ResultStruct, ResultStructBW]=Average_Smooth(CDataSetInfo, Param) %%%Doc Starts%%% %-Description: %This method is to perform 2D averaging filter in slice-by-slice. %-Parameters: %1. Size: The kernel size in the pixel unit. Kernal is a square matrix. %-Revision: %2013-10-12: The method is implemen...
%zmienne a1=0.9; a2=0.1; b0=0.1; b1=0.2; b2=0.3; a=[a1,a2]; b=[b0,b1,b2]; x=0:1:15; imp=zeros(1,length(x)); imp(1)=1; odp_imp=filtr(b,a,imp); %podpunkt a figure; stem(odp_imp); title('OdpowiedŸ filtru obliczona z równania ró¿nicowego'); xlabel('Numer próbki'); ylabel('Amplituda'); %podpunkt b figure; af=[1,a1,a2]; bf=...
[inspeech, Fs1] = audioread('wav\\aslp_zhy_00010.wav'); [outspeech, Fs2] = audioread('lpcWav\\aslp_zhy_00010.wav'); % Draw the speech wavwform figure; subplot(2,1,1); plot(inspeech); title('original speech waveform'); grid; subplot(2,1,2); plot(outspeech); title('synthesised speech waveform'); grid; % Draw the speech...
% Aitken's algorithm in affine space % % o history % Daniel Klawitter % 19-01-2010 - 16:20 created % % o summary % Startfile for De Casteljau algorithm in affine space. % Gerald Farin - Curves and surfaces for CAGD, A pratical guide % p. 43 % % % o TODO: % coords{1}.x=0; coords{1}.y=0; coor...
function u=masscons(u0,h,w) % mass consistent approximation % given % u0 3 wind vectors on staggered grids % h step, vector length 3 % w weights, vector length 3 % solve % min_u 1/2 <D(u-u0),u-u0> s.t. div u = 0, D=diag[w(1)I,w(2)I,w(3)I] % <=> % min_u max_lambda 1/2 sum_i <D(u-u0),u-u0> + <lambda,div u>...
% Model: % sum_{d=1}^M(log(p(w_d))) % perp = exp( - ----------------------------- ), % sum_{d=1}^M N_d % where M is the number of documents, w_d is the words in document d, N_d % is the number of words in document d. We specify w_d as % w_d = prod_{i=1}^{N_d} p(w...
[X, Y] = meshgrid(linspace(.02, .2), linspace(100, 2000)); [power_W, copper_volume_m3] = helmholtz_power(X, Y); figure() subplot 211 contourf(X, Y, power_W, 1000, 'LineStyle','none') colorbar xlabel('Wire diameter (in)') ylabel('Number of turns') title('Power (W)') subplot 212 contourf(X, Y, copper_volume_m3, 1000, '...
%1(a) img = zeros(304,304); img(2:303,2:303)=dat; medfiltimg = zeros(302,302); x=[]; for i=2:303 for j= 2:303 x = img(i-1:i+1,j-1:j+1); x = x(:); x = sort(x); medfiltimg(i-1,j-1) = x(5); end end medfilt2img = medfilt2(dat); figure imagesc(dat); colormap(gray); figure imagesc...
function net = train_neuralnet(net, data, labels, n_epochs, lr, lambda) % n_epochs = 1000; % lr=0.5; % lambda = 1; disp('Training!!!'); for epoch = 1:n_epochs total_loss = 0; for i = 1:length(labels) input = [1, data(i, :)]; % dim: 1 x (n_input+1) label = labels(i); ...
function NewTFNumber=AddIncrementalHuangFuzzyGranulation(OldData,NewData,OldSumDominantMatrix,LeftSum2,LeftSum1,RightSum2,RightSum1,BreakPoint,OldTFNumber,OldRightAscendData,OldLeftAscendData) NewTFNumber=zeros(1,4); OldDataNum=size(OldData,1); NewDataNum=size(NewData,1); CombinedData=[OldData;NewData]; M1=Increme...
% load the source clear; clc; K = 10; K1 = 60; d = 38; source = load('2k2k.mat'); train = source.fea(source.trainIdx, :)'; trainLabel = source.gnd(source.trainIdx); test = source.fea(source.testIdx, :)'; testLabel = source.gnd(source.testIdx); all_data = [train, test]; all_labels = [trainLabel, testLabel]; for K = 1...
%% Initialize arduino and DS18B20 sensors <<<<<<< Updated upstream a = arduino('COM4', 'Uno', 'Libraries', 'PaulStoffregen/OneWire'); sensor = addon(a, 'PaulStoffregen/OneWire', 'D2'); ======= a = arduino('/dev/tty.usbmodem1411', 'Mega2560', 'Libraries', 'PaulStoffregen/OneWire'); sensor = addon(a, 'PaulStoffregen/OneW...
function y=y_trajectory(x, Da, F) %compute the y coordinate on the nappe trajectory %use the aerated nappe profile, i.e., equation 1 in "predicting stress %and pressure at an overfall" by Robinson (1992) if nargin==2 %assume critical flow at the brink F=1; end K=-0.483; A=-0.546; B=1.6; C=0.823; y=Da*K*F^A*(...
function plot_1d_DM(seqpos, reactivity, error, labels, color_code, file_name, flg) if ~exist('color_code','var') || isempty(color_code); color_code = {'k','g','m','c','r','b'}; end; if ~exist('flg','var'); flg = 0; end; figure; clf; set_print_page(gcf, 1); plots = size(reactivity, 2); for i = 1:plots; subp...
x = normrnd(0,1,100,1); hist(x); mean(x); std(x); size(x,1); hist(x(x<1)); sum(x<1); sum(x<1)/size(x,1); normcdf(1,0,1); disp('Standard Error') SEM = std(x)/sqrt(length(x)) % Standard Error disp('T-Score') ts = tinv([0.025 0.975],length(x)-1) % T-Score disp('Confidence Interval') CI = mean(x) + ts*...
clear all;close all; savePath = '/home/omartin/Projects/Turbulence Profiling/PEPITO/Simulations/'; %% Define the system % Define an atmosphere r0 = 0.1; L0 = 25; alt= 8e3; w0 = 1; wS = 15; wD = pi/4; atm = atmosphere(photometry.V0,r0,L0,'altitude',alt,'fractionnalR0',w0,... 'windSpeed',wS,'windDirection',wD); % De...
function input_resistance(recdate,varargin) if nargin>1 cellnum=varargin{1}; else cellnum='A'; % Cell number end if nargin>2 trials_control=varargin{2}; else trials_control=1; end if nargin>3 trials_propofol=varargin{3}; else trials_propofol=1; end if nargin>4 conc_propofol=varargin{4}; else...
clear all; close all; clc; % Dataset load('Person1\rec_1m.mat'); % Info Fs = 500; Ts = 1/Fs; t = 0: 1/Fs : length(val)/Fs-1/Fs; x = val(1,:); % Highpass load('coeffHighpass.mat'); yh = iir(x, bm, an); % Lowpass load('coeffLowpass.mat'); yl = fir(yh, bm); % Plot figure(1) plot(t,x) hold on; plot(t,yl) legend('Origi...
function runner_3b_optimisationRun_HPC(intRun,opFileListName,opSaveFolder) if ischar(intRun) intRun = str2num(intRun); end addpath OFfunctions cauchy(1,[1 0]); load(opFileListName); fileToLoad = fileListHPC{intRun}; disp(['loading file ' fileToLoad]); load(strcat(opSaveFolder,fileToLoad)); disp([opSave.saveFileNa...
% Yiwen Mei (ymei2@gmu.edu) % CEIE, George Mason University % Last update: 10/31/2019 %% Functionality % This function adjust for wind speed and direction based on opographical properties % of terrain. %% Input % ws : spatial wind class (Wind2DCls.m) object or workspace variable for meridional % and ...
function [A,B,C,D,freq,td,varargout] = sinDecayFitTilt(t,P,... A0,ABnd,... B0,BBnd,... C0,CBnd,... D0,DBnd,... freq0,freqBnd,... td0,tdBnd) % SinDecayFit fits curve P = P(t) with a Sinusoidal Decay function: % P = A +B*(exp(-t/td)*(sin(2*pi*freq*t+D)+C)); % % varargout{1}: ci, 6 by 2 matrix, ci(...
% Main Run for material decomposition % Author: Hanna Liu % Date: 01/12/2017 clc;clear;close all; rng(100); % generate repeatable simulation data %% Data structure % structDet: energy discreminating detector properties % structMas: mass attenuation coefficients % structSrc: X-ray tube spectral % struct...
/* * Copyright (c) 2015 Lutz Hofmann * Licensed under the MIT license, see LICENSE.txt for details. */ AttachSpec("lib/buildings.spec"); SetAssertions(1); SetVerbose("buildingLib", true); SetVerbose("buildingQuotient", true); SetVerbose("harmonicCochains", true); // set true for profiling PROFILE := false; if PROF...
clear all; close all; % PART 1 Q1 A = [0.9 0.2 0.1 0 -0.3; 0 0.9 0.1 0 0; 0.1 0 0.2 0.1 0; 0 0 0.3 0.4 0.2; 0 0.2 0 0 0.8]; B = [0 0; 0 0; -1 0; 1 0; 0 1]; C = [1 0 1 0 0]; D = [0 0]; Binv = pinv(B); %% a) rank(ctrb(A, B)); rank(ctrb(A, B(:,1))); rank(ctrb(A, B(:,2))); %% b) x0=...
function GetCellSize( obj, mesh ) % Jacobian determination on each quadrature points one = ones( obj.cell.Np, obj.Ne ); % Volume for each cell of the studied mesh obj.LAV = mxGetMeshIntegralValue( one, obj.cell.wq, obj.Js, obj.cell.Vq ); end
function [ X, pos, eulAngle ] = FK( angles, arm, robot ) % Calculate forward kinematics for arm % @arm - string "L" or "R" % @angles - angles array (6x1) % @robot - constants for robot % result(1) - (4x4) result matrix % result(2) - (3x1) position, which were extracted from result(1) % result(3) - (3x1) Euler angles (Z...
%% generate data clear all, close all rand('seed', 0); randn('seed', 0); x = rand(1,100); y = exp(x.^3 - x.^2 + 0.01*x + 2) + 0.04 * randn(size(x)); plot_data(x,y) %% Polynomial model close all grade = 2; theta = polynomial_train(x,y,grade); points = linspace(0,1.5,100); ypredicted = polynomial_predict(points, t...
function Network = makeCartesianGridNetwork (n, numDims) if numDims ~= 2, error ('*** Only 2-D grids supported at present. ***'); end Dims = makeGridDimensions (n, 2); x = Dims(1); y = Dims(2); I_x = speye (x); e_x = ones (x, 1); T_x = spdiags ([e_x e_x e_x], -1:1, x, x); I_y = speye (y); e_y =...
%here we search for an optimum configuration of the rocket clearvars addpath("../simulator", "../SQP") global R_t H_c R_c V_p V_c M_i t_c m_e v_e k_ alpha %we prepare some values data() %see that assignment in the first flow chart V_p = 1.2*V_c; %tolerance tol = 10; maxnbiter = 5;%maximum number of it...
%% Simulate response rMax = {1 1}; c50 = {2 2 }; order = { 2 2}; base = {0 0}; %input{1} = repmat([ones(10,1); -ones(10,1)],10,1); %input{2} = repmat([-ones(10,1); ones(10,1)],10,1); w1 = 3*.33; w2 = 5*.33; ph2 = 0; t = linspace(0,6*pi,200); t2 = linspace(0,6*pi,200)+2*pi/1; input{1} = (sin(w1*t)); input{2...
function generateSeedData(N_seeds, N_freqs, seed) % This function creates seed data and saves it as fibro_seedinfo.mat % This function only needs to be called when seed data needs to be changed % or (re)generated. Usage: % % generateSeedData( N_seeds, (N_offsets), (seed) ); % % N_seeds: number of unique seeds ...
function [ap] = precrec_driver(out, gt, draw) % precrec_driver(OUT, GT, DRAW) % Utility function called by perf_precrec % compute precision/recall % % INPUTS: % -OUT: (nx1) vector of predicted labels % -GT: (nx1) vector of true labels % -DRAW: (logical) if 1, plots precision/recall % % OUTPUT: % -ap: average precisio...
%% Mathieu BROCHET_ Elsa DRONET clear all; close all; clc; %% Initialisation des variables Fp = 1.09*10^6; %fréquence porteuse Fe = 20*10^6; Te = 1/Fe; Ts = 1*10^(-6); Ds = 1/Ts; moy_fft = 100; Fse = Ts/Te; % 20 échantillons NFFT = 1000; % nombre de point par fft Nb = 5; % nombre de bits % nombre de FFT B = randi([0,1...
%% this example shows how to use staircase toolbox clear all % initialize it initializeStaircase % exp routine ntrail = 0; while (1) r = showStimuliAndGetResp(mysc.xnext); mysc.update(r); end
%hvnormalise - issue 1.2 (02/02/09) - HVLab HRV Toolbox %------------------------------------------------------ %[outdata] = hvnormalise (indata, mode, N) % Subtracts the mean value from a data set % % outdata = name of new workspace data structure array containing the % normalised input data set(...
function [id,p] = cpivProcessImageParams(p) id = []; if (iscellstr(p{1})), if (length(p{1}) == 1) error('You must have at least two images.'); end; id.FileNames = p{1}; id.NFrames = size(id.FileNames,1)-1; if ((size(p{1},1) == 1) && (size(p{1},2) > 1)), id.FileNames = id.FileNames...
function [corr_vector mean_vector] = f_correlation_vector(correlation_data, electrodes_to_use, separate_electrode_data) %% f_correlation_vector creates a vector of EEG-fMRI correlation data and a vector of all data averaged together. % % Syntax: % [corr_vector mean_vector] = f_correlation_vector(correlation_data...
A = [2 4 5 6 9 8 4.1 5 3] Aerror= [2 4 5 6 9 8 4.2 5 3] b = [220 490 274] [L U P] = lu(A); AN = P*A; bN = P*b; [LN UN PN] = lu(AN); y = LN\bN; x = UN\y; [Lerr Uerr Perr] = lu(Aerror); Aerr = Perr*Aerror; berr = Perr*b; [Lerr Uerr Perr] = lu(Aerr); yErr = Lerr\berr; xErr = Uerr\y...