text
stringlengths
8
6.12M
function [MFCCs] = calcMFCCs(sig, params) % Define variables Tw = 25; % analysis frame duration (ms) Ts = 10; % analysis frame shift (ms) alpha = 0.97; % preemphasis coefficient M = 20; % number of filterbank channels C = 12; % numb...
function [state,isLoopClosed] = mpcNestedOptimizer(track,car,n,N,dt) initState = car.state; width = 1.25; isLoopClosed = false; xLast = []; % Last place computeall was called myceq = []; % Use for nonlinear inequality constraint myc = []; % Use for nonlinear equality constraint ...
fs=10000; A=[0.5 0.5]; F1=[350 440]; P=[0 0]; td1=4; x1=SumOfSines(A,F1,P,td1,fs); %sound(x1,fs); F2 = [480 620]; td2=0.5; b1=SumOfSines(A,F2,P,td2,fs); disp(size(b1)); z1=zeros(length(b1),1); x2=cat(1,b1,z1,b1,z1,b1,z1,b1,z1); %sound(x2,fs); F3=[440 480]; td3=2; b2=SumOfSines(A,F3,P,2,fs); z2=zeros(length(b2),1);...
clear all; close all; clc; fprintf("3.4 Ecuaciones stiff : explıcito vs implicito") fprintf('\n') fprintf("1.- Aplicar Euler implicito al PVI") fprintf('\n') %Genera [Tn Wn] con el metodo de Euler implicito Tn=0:0.5:20; %Crea el espaciado con h=.5 Wn=zeros(1,size(Tn,2)); Wn(1)=0.5; %condicion inicial for i=1:size(Tn,2)...
caps_KCl; [output] = extreme_GHK_elecoPoration_test(kcl_1M_bd,'KCl','Cation',1); zrcl4_1M_breakdown; [output] = extreme_GHK_elecoPoration_test(zrcl4_1M_breakdown,'ZrCl4','Anion',1); zrcl4_100mM_breakdown; [output] = extreme_GHK_elecoPoration_test(zrcl4_100mM_breakdown,'ZrCl4','Anion',1); caps_graphene_etching; [...
%% Create layerstack from Optical Indices and SAR: % M.Brechbühler, GEO441 % define your working directory %DataDir = 'S:/course/geo441/data/2020_Camargue/'; DataDir = 'W:/Desktop/GEO441/output\2016_feb_stack/'; cd(DataDir); coordRefSysCode = 32631; % Multiple files % get an overview of the data present sf...
function [ J ] = obj( S,b,G,S0,L ) %obj Computes the objective function % J -> Value of the objective function at the given L J = 0; for i=1:size(S,2) c2 = exp(-b*G(i,:)*L*L'*G(i,:)'); c1 = S(i) - S0*c2; J = J + c1^2; end end
function x = quad(Coeff) % Roots of the quadratic polynominal y=ax^2+bx+c % Input: Vector with the polynominal coefficient [a b c] % Output: Vector x=[x1, x2] with the two roots % Example call of the function: A=quad([1 3 5]) D = sqrt(Coeff(2)^2-4*Coeff(1)*Coeff(3)); % Discriminant x(1) = (-Coeff(2)+D)/(2*Coeff(1));...
function V = numint2(y); % NUMINT2 % MATLAB m-file for numerical integration using % Simpson's rule % Format: V = numint2(y) % input: y = an odd-length row vector % % Timo Laakso 16.03.1992 % Last revised 16.01.1996 % y must be an odd-length row vector % Npt=length(y); Npt2=(Npt-1)/2; cof=2*ones(1,Npt); ...
function mean_spiking() load('./result_data/result_data.mat') num_neurons = size(results.metadata.iso_qual, 1); percentiles = [80,85,90,95]; perc = 4; % Neuron channels and iso qual conditions PPC_region = results.metadata.channel_num <= 32; PFC_region = results.metadata.channel_num > 32; iso_qu...
function y = ustep(t, ad) %t: length of time %ad: advance (positive), delay (negative) factor y = []; for i = t i = i + ad; if i<0 y = [y 0]; else y = [y 1]; end end
function ColNames = colnames(This) % colnames Names of columns in namedmat object. % % Syntax % ======= % % ColNames = colnames(X) % % Input arguments % ================ % % * `X` [ namedmat ] - A namedmat object (array with named rows and % columns) returned as output argument from some model function...
%% Ex1 a) clc L = 2; %Linhas N = 1e5; %Colunas a = rand(L, N)>0.5; b = sum(a)>=1; respA = sum(b)/N %% Ex1 b) clc respB = 1 - 1/4 %% Ex1 c) clc L = 2; C = 1e5; a = rand(L,C)>0.5; b = sum(a) == 2; c = sum(a) >= 1; resp = sum(b)/sum(c) %% Ex1 d) clc L = 2; C = 1e5; a = rand(L,C)>0.5; b= sum(a) == 2; c = a(1,...
% - Get lists of clean fluorescence frames for each stimulus presentation period cvnFluorFrameInds = arrayfun(@clean_frames, stimSet.('start_frame'), stimSet.('end_frame'), vbDirtyStart, vbDirtyEnd,vnFluoresenceTimeIndices, 'UniformOutput', false); % - Helper function for computing the stimulus response metric over a...
clc;clear all; filePath = 'C:\Users\Cong\Desktop\t2\'; folderinfo = dir([filePath,'*.jpg']); for i = 1:length(folderinfo) fileName = [filePath,folderinfo(i).name]; fileName2 = strcat('gs2_',folderinfo(i).name); eval(['!rename' 32 fileName 32 fileName2]); end
function [x, y] = separa_label(base) % Separa a base em features e labels % input: % base: base de dados completa % output: % x: representa as features % y: representa as labels x = base(:, 1:end - 1); y = base(:, end); end
function [RX_measure_report, Beam_index_report,tr_oh] = training_period_xyz(client_spec,cb_id) %Loading Network Parameters load global_params_incr.mat N_u = size(client_spec,1); RX_measure_report = NaN(Nap_bw,N_u); Beam_index_report = -1*ones(Nap_bw,N_u); t_tr_o = 0; t_fb_o = 0; cb_...
%% audio recording and feature extraction % want to determine frequencies of taps and extract these TITLE = 'Glass-Tap1'; SAVE = true; Fs = 44100; Wsize = 4096; recObj = audiorecorder(Fs, 16, 1); disp('Start recording.') recordblocking(recObj, 10); disp('Done recoding'); % Store data in double-precision array. data ...
function writerObj_out=record_video(details,writerObj,action) % Code created by Jamie M Johns 2019 % Github repository: https://github.com/JamieMJohns/Record-videos-of-animated-ouputs-Matlab- %details={fps(double or single precis.),video_title,overwrite} (overwrite=1= overwrite if same name exist,overwrite=other = ...
function [ u, X_, T_ ] = solver_1_5_9( Fxt, a, b, f, M, dt, varargin ) if (nargin > 6) t = varargin{1}; else t = 2; end nu = 0.1; x = 1; dx = 1 / M; T = round(1 / dt); X = round(1 / dx); N = t * T; t_real = t * dt * T; r = nu * dt / dx / dx; s = nu * dt / dx; ...
%MODIFY_INPUT modifies the baseline input parameters according to % user-specifications. % % Syntax % ------ % ui.modify_input(); % % Details % ------- % This function obtains the modification to be made from the currently % entered value in the modify input box. % % Examples % -------- % % See als...
function [subject,properties] = get_activation_priors(subject,properties) disp('====================================================================='); disp('BC-V-->> Getting activation priors.'); disp('---------------------------------------------------------------------'); Lvj = subject.H...
function [Head_x,Head_y,Head_z] = head3dFS(VxW_x,VxW_y,VxW_z) % Subroutine for calculating the gradient of head of the flow %Head = -grad(PI) % Chiyu Jiang, Oct 15th, 2015. global M N P Lx Ly Lz sx = (2*pi)/Lx; sy = (2*pi)/Ly; sz = (2*pi)/Lz; A = (1i*M*sx.*VxW_x+1i*N*sy.*VxW_y+1i*P*sz.*VxW_z)./(-(M*sx).^2-(N*sy).^2-P...
clear; h_bar = 6.636e-34/2/pi; % [m^2*kg/s)] mass = 9.11e-31; % [kg] omega = 2*pi*7.5e8; param_a = mass*omega/(2*h_bar); alpha_0 = 1e12; % If alpha_0 < param_a, wavefunction is the narrowest when it is at the center of % potential well % If alpha_0 > param_a, wavefunction is the narrowest when at the extremal ...
function res = sig_trace4(dstr, xfile, pars) % Trace sliding fft signals. % Parameters: % f0 - starting frequency (default: auto, right of two highest peaks) % t1 t2 - time range (default: 0..end of signal) % df - tracing freq window (default: 50Hz) % dfs - tracing freq window (default: 10Hz) % window ...
%% Initial clear all; addpath('../../routines'); input_file_folder='input'; output_file_folder='output'; %% th ELKC input_file_name='gaussian_4D.es'; p=f_read_input(input_file_folder, input_file_name); th_elkc=@(j,hs) f_elkc(j, p.geometrical, p.rf_distribution, p.rf_correlation, hs); %% Plot p.hitting_set.thresholds...
function newTracklet = interpolateTracklet( tracklet, gpParams, tracklets ) % Uses Gaussian process propagation to fill in gaps in tracklet. trackletVelocities = getTrackletVelocities(tracklets); trackletData = [tracklets trackletVelocities]; newTracklet = tracklet; inds = find(newTracklet(:,1)); % diffs = diff(i...
%RF transmitter information global f; global Bw; global Lamda; global RFGain; global SensorGain; global IniPow; %Sensor transmitter information global Kappa; global Delta; global Psi; global Gamma; global PowTh; global IniNumST; global IniBS;
%% Read images according to train.csv and categorized images into different subfolders according to labels. % preconditions: % 1. downloaded the following file into one folder from kaggle(https://www.kaggle.com/c/noaa-right-whale-recognition/data) % train.csv, imgs.zip file and w_7489.jpg % % 2. put train.csv an...
function project4b clear all; img = load('project4/project4bimg.txt'); [H W] = size(img); inwavelet1 = zeros(H,W); for i=0:H/8-1 for j=0:W/4-1 inwavelet1(2*i+1,j+1) = (2*img(i+1,j+1)+img(floor(H/8)+i+1, j+1))/2; inwavelet1(2*i+2,j+1) = (2*img(i+1,j+1)-img(floor(H/8)+i+1, j+1))/2; end end img(1:f...
close all; %type xing.txt; %type ying.txt; %type zing.txt; %type timing.txt; xfileID= fopen('xing.txt','r'); yfileID= fopen('ying.txt','r'); zfileID= fopen('zing.txt','r'); %tfileID= fopen('timing.txt','r'); formatSpec='%f'; x= fscanf(xfileID,formatSpec); y= fscanf(yfileID,formatSpec); z= fscanf(zfileID,formatSpec); %t...
function f = MPEC_objective(x0, auxdata) %%%%%%%%%%%%%% % GMM Objective function for the random coefficients Logit esitmated via MPEC. %%%%%%%%%%%%%% W=auxdata{2}; K=auxdata{3}; prods=auxdata{4}; T=auxdata{5}; numProdsTotal=auxdata{6}; x=auxdata{7}; IV=auxdata{8}; v=auxdata{9}; nn=auxdata{10}; share=auxdata{11}; pr...
function [x1, y1] = linhas(x, y, c); x1=[];, y1=[y(1)]; for i = 1:1:length(x)-1; x1 = [x1, x(i), x(i), x(i)]; y1 = [y1, 0, y(i), y(i+1)]; end x1 = [x1, x(end), x(end)]; y1 = [y1, 0]; end
function [ lat ] = estimate_latent_features_eig( A, d) %estimate_latent_features_eig Returns estimated (undirected) latent features % A is an (or many) nxn (or nxnxk) adjacency matrix). d optionally % indicate the dimensions of the in and out feature vectors. % The default is n for each. The feature vectors are ...
%% we reproduce hte example from Thomas Most article % April 12th, 2016 % Gurkan Sin @DTU Chemical Engineering clear clc close all %% % In the first example a purely additive model is investigated % f(y,z) = a1y + a2z. % The input variables are normally distributed, have zero mean and the covariance mu=[0 0]; % mu d...
function [xdata,ydata,Wout,Weff,Wrdn,Win,Wirr] = ... make_train_data(parm,T,Wout,Wrdn,Win,Wirr) % Make training and test data set % [xdata,ydata,Wout,Weff,Wrdn,Win,Wirr] = ... % make_train_data(parm,T,Wout,Wrdn,Win,Wirr) % - Output % xdata : Xdim x Tsample x Ntrial % ydata : Ydim x Tsample x Ntrial % Wo...
clc, clear, close; set(0,'DefaultFigureWindowStyle','docked'); addpath(genpath(pwd)); % FILE FOR DEBUGGING ONLY. PLEASE USE THE mainACS.m file in the parent % directory % load field load hand % draw field field.drawField({1 1 1}); % pick information fitnessFn.start fitnessFn.goal fitnessFn.limitsA fitnessFn.limit...
function decision_boundary() load hw1boundary.mat data1 = zeros(10201,2); i=1; for a=0:0.01:1 for b=0:0.01:1 data1(i,:) = [a,b]; i = i+1; end end data = data1(1:10000,:); size(data) meanData = mean(data); stdData = std(data); normData_grid = size(data); for row=1:size(data,1) for col=1:s...
function plotderivation() [X, Y] = meshgrid(-2:0.2:2); plotfigure(X, Y, @f1, 'task3-f1'); plotfigure(X, Y, @f1derivatedx, 'task3-f1-derivatedX'); plotfigure(X, Y, @f1derivatedy, 'task3-f1-derivatedY'); plotwithquiver(X, Y, @f1, @f1derivatedx, @f1derivatedy, 'task3-f1-quiver'); plotfigure(X, Y, @f2, 'task3-...
function [ EPST ] = EPST( X, SC, HX ) %EPST STEP % % REAL FUNCTION EPST ( X, SC, HX ) % -------------------------------------------------------------- STEP % COMMON/ARGEXP/ARGMAX lim = SC*IRI2012.ARGMAX; if X < HX-lim || X > HX+lim if X > HX EPST = 1.; else EPST = 0.; end el...
function delta_u = Delta(u,type1,type2) %% Discrete Forward & Backward difference operator %% TGV method %% Input: u, matrix, image %% type1: integer, 1 = x direction, 2 = y direction %% type2: integer, 1 = forward difference, 2 = backward difference %% %% Output: delta_u, matrix, x/y direvative of...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Author: Alexander Gomez Villa - SUPSI % Compute spectrum % ------------------------------------------------------------------------- % dataMatrix: Two row matrix containing PPG and ECG respectevely %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
#Filtro Narrow Band # # Características: # - possui 5 coeficientes; # - são filtros tipo rejeita-faixa ou passa faixa com banda estreita # - a resposta em frequência pode ser melhorada se usar múlti-plos estágios em cascata function [y] = iir_single_pole_passa_faixa(sinal, fs, f_central, largura_banda) # Sin...
function grad = grad_logistic(x, W, Y) % Logistic Loss n = length(Y); grad = zeros(size(W,2), 1); for i=1:n w = W(i,:); y = Y(i); v = exp(-y* (w*x)); % grad = grad + (-y*v) /(1 + v) *(w'); grad = grad + (-y) /(1 + 1/v) *(w'); end
function output=circuit2exp(circuit,measure) % This function is to convert quantum circuit into experimental waveform % blocks. if nargin<1 S='S';H='H';CZ='CZ';I='I';Sd='Sd'; mX='X2m'; mY='Y2p'; mZ='I'; mI='I'; g1={mX,mZ,mZ,mX,mI}; g2={mI,mX,mZ,mZ,mX}; g3={mX,mI,mX,mZ,mZ}; g4={mZ,mX...
function [ OPEN_candidate, flag1] = do_search(rob_mat, tar_mat, hn, CLOSED, map) %UNTITLED5 Summary of this function goes here % Detailed explanation goes here count = 1; OPEN_candidate = []; flag1 = 0; % flag = 0 represents no feasible solution found % search the 8 blocks beside the successor for i = 1:-1:-1 f...
function rep=representation_specularpaths(eddatafile,reflpathsfile,order,fuente_imagen) [eddatafilepath,eddatafile,fileext] = fileparts(eddatafile); eddatafile = [eddatafile,fileext]; Filestem = EDB2strpend(eddatafile,'_eddata'); [reflpathsfilepath,reflpathsfile,fileext] = fileparts(reflpathsfile); reflpathsfile = [re...
nodes = [1, 5, 10, 15, 20]; througput = [0.999834, 4.99917 ,9.99629 ,14.9873, 19.9815 ]; %plot (nodes, througput); per_node_thput = [0, 0, 0, 0, 0]; total_thput_normalized = [0, 0, 0, 0, 0]; % hold on; for i = 1: 5 per_node_thput(i) = througput(i)/nodes(i); total_thput_normalized(i) = througput(i)/nodes(i); e...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 本函数用于计算年化跟踪误差 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function trackingError = annualizetrackingerror(R,Rm,Step) loc = isnan(R) | isnan(Rm); R (loc) = []; Rm (loc) = []; trackingError = (sum((R-Rm).^2)/...
noOfParam = 8; numCol = 1+noOfParam+((noOfParam-1)*noOfParam/2); if ~exist('dataPath','var') dataPath='../data'; end if isTraining == 1 load(fullfile(dataPath,'aesthetics',vidName),'colour','cont','quality'); load(fullfile(dataPath,'faceDetection',vidName),'face','person','frCount'); load(fullfile(dataP...
function out = H(sfIdx,cutoff) sfLateralSquared = sfIdx.^2 + (sfIdx').^2; % implicit expansion into 2 dims % Compute diffraction-limited CTF out = single(sfLateralSquared < cutoff.^2);
clear all % Lorenz's parameters (chaotic) sigma = 10; beta = 8/3; rho = 28; % Initial condition - large cube of points xvec = -20:2:20; yvec = -20:2:20; zvec = -20:2:20; [x0,y0,z0] = meshgrid(xvec,yvec,zvec); yIC(1,:,:,:) = x0; yIC(2,:,:,:) = y0; yIC(3,:,:,:) = z0; plot3(yIC(1,:),yIC(2,:),yIC(3,:),'r.','LineWidth',2...
function out = tcaForce(delta,temp) %alright this time I think the model should be correct %the last fix essentially assumed the diameter of the helix was %constant which is wrong and I think the initial one may have some %mistake in the terms %however no analytic solution for (F,temp) -> delta, hav...
function rgb = task_green rgb = [31, 119, 82] / 255; end
function[d, fs, l, r, c, b] = rd_audio(filename, filetype, fs) % RD_AUDIO - Program to read audio files % [d, fs, l, r, c, b] = rd_audio(filename, filetype) % reads SPHERE(NIST) or WAVE(Microsoft Wave Format-RIFF) files. % If the file is of type NIST then the function rdsphere is called. % [y, Fs, N, W, A, C, B...
function [train, train_label, test, test_label] = split_train_test(data, label, train_num) % 在data中随机取train_num作为训练集,剩余做测试集 % 输入: % data=[N X d],每行一个d维样本 % label=[N X 1] % train_num 随机取train_num个样本当做训练集 % 输出: % train = [train_num X d] % train_label = [train_num X 1] % test = [N-train_num X d] % test_label = [N-train_nu...
function y = get_r(data) y = linspace(-data.R, data.R, 2*data.Nr+1); end
%Adaboost %/////////////////read train image and integral %trainread; %////////////////compute all image's filter value Root = 'C:\Users\Pei-Chun\Desktop\STAT231\project2\'; load([Root 'error_h.mat']); load([Root 'threshold.mat']); load([Root 'face_values.mat']); load([Root 'nonface_values.mat']); load([Root 'D_face.m...
% EXAMPLEDETECTOR Example class implementing a generic detector % obj = affineDetectors.exampleDetector(); % obj.detectPoints(img); % % This is an example class that demonstrates how to create a trivial % interest point detector. Modify it to wrap around your own detector % implementation. This class implemen...
function ImOut = unifqtz(img, numPartition) img = double(img); ImOut = zeros(size(img)); [m, n] = size(img); tmin = min(img(:)); tmax = max(img(:)); stepsz = (tmax-tmin)/numPartition; t = tmin:stepsz:tmax; for i=1:m for j=1:n dists = abs(img(i,j)-t); [~,idx1] = min(dists); if i...
function vars = rat_data(validate_data, visualize_data) % % Cross-species primate brain data from Rilling & Insel (1999a), % largely complementary to callosal data in 1999b. % Includes: % * Brain volume % * Grey & white matter volumes if ~exist('validate_data', 'var'), validate_data = true; end; if ~exist('v...
function [bk lik_r]=NETFIT_glm(n,H,fr,x0,par) %Function fits GLM to spiking data. % [bk lik_r]=NETFIT_glm(n,H[,fr,x0,options]) fits GLM with parameters bk % to explain spike train n with spike histories H. n is 1xT vector and % H is NxT matrix; x0 may be passed as initial guess for bk; fr is 1xT % vector of freque...
function [reconStructIn, popAssignInds] = assignPopSpikes(popStruct, simSpikes, simSpikesInds, stimParms) numSignals = stimParms.numSignals; numStimStats = stimParms.numStimStats; % numSimRepeats = simSpikesInds.numSimRepeats; numSignalsPerStat = numSignals/numStimStats; numPops = length(popStruct); clear popAssignI...
function [points] = generate_coordinates(R,N) points =[]; for i = 1:N r = R * sqrt(rand()); theta = rand() * 2 * pi; pt.x = r * cos(theta); pt.y = r * sin(theta); points = [points,pt]; end
clear; for i = 1:43 d0 = (2.8 + (i-1)*0.1) * 0.1; AA(i) = VdwGaussian(d0, 0, 'gaussian'); AB(i) = VdwGaussian(d0, 3.1415926/2/90 * 60, 'gaussian'); HM(i) = VdwGaussian(d0, 0, 'homogenized'); end AA = AA./10000; AB = AB./10000; HM = HM./10000; plot(2.8 : 0.1 : 7, AA, 'r--o'); hold on plot(2.8 :...
%---------------------------------------------------------------------------- % make_icesst_norm.m % % This script opens files with historical sst data starting at 1860 and % a control run with forcing from 1860 % a simple linear regression to compute the change of temperature between % 1860 and 2010 is computed. %...
%Salvar como "sigmoide" function g = sigmoide(z) g = 1./(1+exp(-z)); end
clear all close all im = imread('imagenes\lily_gray.tif'); im2 = im2bw(im,100/255); im3 = imresize(im,0.5); x = size(1); y = size(2); c = [x/4, y/4, 3*x/4, 3*y/4]; im4=im(c(1):c(3),c(2):c(4)); subplot(2,2,1); imshow(im); title('Original image'); subplot(2,2,2); imshow(im2); title('Thresholdized image (t=100)'...
function fprintfM_Sci(s,A) % function fprintfM_Sci(s,A) % Displays the matrix A in "matrix scientific notation'' % according to print format specified by the string s, % For example, if % A = [ 45 1234; -34 0] % and % s = '%7.4f' % then the display would be % % 0.0450 1.2340 % ...
function [] = bq_demo() % A very simple Bayesian quadrature (BQ) implementation and test case in 1d. % % We first compute probabilistically the integral % % I_1 = int{f(x)pi(x)}dx, % % where pi is a known Gaussian density, f is an expensive black-box function and where the % integration is over the real numbers. GP...
%%%Clear console, variables and close all windows%%% clc; clear ; close all; %%% Carregar dados e inicializacao das variaveis %%% data= load('formantdata.mat'); x0 = data.D; y0 = data.L; x1 = []; x2 = []; mu1 = [randn randn]; mu2 = [randn randn]; epsilon = 0.001; max = 10; J_old = 100000; J = zeros(max,1); %%% Defini...
function Logical = IsDefined(String,StringSet) Logical = sum(strcmpi(String,StringSet)) > 0; end
function [G, Ae] = observer(A,B,C,Pe) % H. Saadat, 1998 clc % discr=[ %' This function is used for the computation of the estimator gain ' %' gain vector G based on the Ackermann`s formula. A is the system ' %' matrix, B is the input column vector & C is the output row vector. ' %' Pe is the row vec...
% ber generic ostbc tx1 % missing argument b % y=Hx+n % function ber = ber_ostbc_t1(a,b,SNR) load precision.mat % a and b must have the same dimensions, obviously sizea=size(a); k=sizea(3); t=sizea(1); n=sizea(2); x=zeros(1,BLOCK_SIZE); x_hold=zeros(1,t); s=zeros...
clear all; file_name_list = dir; count = size(file_name_list, 1); buf_er = 0; for i=1:count if strfind(file_name_list(i).name, 'jpg') > 0, name = sprintf('sushi_%03d.jpg',i-buf_er); movefile(file_name_list(i).name, name); else buf_er = buf_er+1; end; end;
function [gains, data] = collateStats(directory) folders = dir(directory); data = []; t = 1; for f = 1:length(folders) foldername = folders(f).name; if strncmp(foldername,'.',1) || ~strcmp(foldername((end-8):(end-4)),'stats') continue end statsname = sprintf('./%s/%s',directory, foldername)...
function [Ts,p] = genShortTimeParamVector( postSynNrn ,preSynNrns) synType = 10*preSynNrns + postSynNrn ; % RS = 1, LS = 2, FS=3, LTS = 4, TS= 5, TI= 6, TRN =7 state150_06 = (synType == 11) + (synType == 13) ... + (synType == 31) + (synType == 33); state150_07 = (synType == 51) ; sta...
function y = bisection(func, lower, upper, max_iteration, max_error) % Finds the root of a function using the bisection approach. % Inputs are the func- tion(anonymous), upper and lower limits, % maximum number of iterations, and maximum absolute relative error. % The outputs should be the root and a table of i...
clc;clear;close all load('m4.mat'); load('m5.mat'); device02=m4(1:600,:); device01=m5(1:1200,:); %% test data test_num=200; [device21] = mapminmax(device01(1:test_num,:)); [device22] = mapminmax(device02(1:test_num,:)); y1=[ones(test_num,1);2*ones(test_num,1)]; data_t = [device21;device22]'; data...
function evaluate_model(model, dataset) gt = dataset.OrientationFlags; predictions = model.predictFcn(dataset); cm = confmat(string(gt), string(predictions)); labels = strrep(cm.labels, '*', '_'); plabels = strcat('P', cellstr(labels)); tlabels = strcat('T', cellstr(labels)); ...
function element=getElementAtIndex(vector,index) element=vector(index); end
classdef KdeDist < MultivarDist & NonFiniteParamModel %#NotYetImplemented properties dof; ndimensions; params; prior; end methods function model = KdeDist(varargin) % end function cov(model,varargin) % notYetImplemented('KdeDist.cov()'); end function entropy(model,varargin) % ...
function [val,Fs,gain,description,ecg_idx,bp_idx] = mvqrs_loadrecord(recordName) % % [val,Fs,gain,description,ecg_idx,bp_idx] = mvqrs_loadrecord(recordName) % % Load physiological data using wfdb toolbox % % Required Parameters: % % recordName % String specifying the name of the record in the WFDB path or % ...
%% this function connects to Arduino function connectToArduino(arduinoSerial) % Preparing for connection with Arduino % Make sure all connections with the Arduino are cleared up for a clean connection fclose(arduinoSerial); disp('All connections with Arduino cleared.'); % Connecting with Ard...
classdef hartleyFF < handle % Hartley FF (Full Field) properties numTrials trial display design sessionTrialIdx=[] end methods function h = hartleyFF(PDS, varargin) stim = 'hartley'; ...
function [Hx,Hy,Hz]= spiral_coil_efficent_calc_matrix(I,x_points,y_points,z_points,Px,Py,Pz) %I=Filament current %a_start=x,y,z coor of start of filament %a_end=x,y,z coord ofned of filament %P=x,y,z,obseration point %Function to calculate the magnetic field due a straight currrent filament %at an arbitary orientatio...
function Impresion2(X,Y) acepta = find(Y==1); rechaza = find(Y==0); plot(X(acepta,1),X(acepta,2),"bx","MarkerSize",5); hold on; plot(X(rechaza,1),X(rechaza,2),"ro","MarkerSize",5) end
function [allResp, allTarg,sdRand]=Exp2_restruc(data,center) % Turn the data into responses and targets % 4.8.2015-Created allResp=nan(length(data),1,10,2); % subj x session x objects x dim allTarg=nan(length(data),1,10,2); numSubj=length(data); numSess=[3 4 5]; % identify testing sessions for is=1:numSubj for i...
function marker_str = parseMarker(d, CLim, colormap) %build marker struct marker_str = []; if isfield(d, 'Marker') isClosed = false; switch d.Marker case '.' marker_str.symbol = 'circle'; case 'o' marker_str.symbol = 'circle'; isClosed = true; case '...
%% %% Test % Test % clear; close all; % % % Creates a 2D Mesh to plot surface % x=linspace(0,1,100); % [X,Y] = meshgrid(x,x); % DELAY = 0.05; % N=100; % Number of frames % for i = 1:N % % Example of plot % Z = sin(2*pi*(X-i/N)).*sin(2*pi*(Y-i/N)); % % subplot(1,2,1) % surf(X,Y,Z);view(2); % % subplo...
function out = getStimulusTrace( obj, key ) if nargin<2 key = fetch(obj); key = key(1); end % Load times of the traces [times out.mouse_id out.scan_idx] = fetch1(VisStims(key).*StatsSites,'frame_timestamps','mouse_id','scan_idx'); out.fps = round(1/mean(diff(times))*1000); % calculate fps % stim times and ty...
function [ rho_sphere, rho_sphere_gradient] = rho_sphere( R, c, O) %UNTITLED6 Summary of this function goes here % Detailed explanation goes here Ox = O(1); Oy = O(2); Oz = O(3); Cx = c(1); Cy = c(2); Cz = c(3); %denominator of b b_den = sqrt((Ox-Cx)^2 + (Oy-Cy)^2 +(Oz-Cz)^2); b = [(Ox-Cx)/b_den*R +...
function [X,Y,XX,YY] = fevd(This,Time,varargin) % fevd Forecast error variance decomposition for SVAR variables. % % Syntax % ======= % % [X,Y,XX,YY] = fevd(V,NPer) % [X,Y,XX,YY] = fevd(V,Range) % % % Input arguments % ================ % % * `V` [ VAR ] - Structural VAR model. % % * `NPer` [ num...
function [s11,s21,s12,s22,frequency] = s2pToComplexSParam(filename,filelength) headerOffset = 9; frequency = dlmread(filename,' ',headerOffset,0,[headerOffset 0 filelength 0]); mag11 = dlmread(filename,' ',headerOffset,1,[headerOffset 1 filelength 1]); phase11 = dlmread(filename,' ',headerOffset,2,[headerOffset 2 filel...
% Position #1 rtp = [ 1 ; 0 ; 0 ]; Artp = [ 1 ; 0 ; 0 ]; [ Ax Ay Az ] = asph2rec(Artp(1), Artp(2), Artp(3), rtp(1), rtp(2), rtp(3)); assert(max(abs([ Ax ; Ay ; Az ] - [ 0 ; 0 ; 1 ])) < 1e-10) Artp = [ 1 ; 1 ; 0 ]; [ Ax Ay Az ] = asph2rec(Artp(1), Artp(2), Artp(3), rtp(1), rtp(2), rtp(3)); assert(max(abs([ Ax ; Ay ; ...
function [hits] = fileFinderAll(locn,type,omitFirst) % fileFinderAll - determine all of the files of a specific type in a folder % and subfolders if strcmp(locn(end),filesep) locn = locn(1:end-1); end % Can we do it purely iteratively and dynamically, rather than going % through all folders at the beginning... [h...
function R3 = R3 (k); R3 = [cos(k) -sin(k) 0; sin(k) cos(k) 0 ; 0 0 1]; end
function [Epr] = m1_Epr(t,Qm,a,b,c1,c2,n,w,grid) if Qm == 0 && c2 == c1+t; Epr = w^2*(n-(1-0.5^n))/(n*(n+1)*(n+2)); else th1s = mp(0,w,grid); th2s = mp(0,w,grid); Epr_sum = 0; for ii=1:grid; th1 = th1s(ii); % For each theta1, we find the expected value conditio...
function y = baseb_sub(u,v,b) % y = baseb_sub(u,v,b) %inputs = u, v = two vectors representing base b expansions of positive %integers, with u > v, b = a postive integer > 1, the base %output = y = a vector representing the base b expansion of the difference u - v %computed using Algorithm 6.3 %First pad one vector wi...
% This is the repository for the Matlab codes of the numerical simulations % of plasmid dynamics in complex communities. The scripts can be used to % generate Supplementary Figure 7 in % "Variability of plasmid fitness effects contributes to plasmid persistence in bacterial communities." % % December 16, 2020 % rpm@ccg...