text
stringlengths
8
6.12M
function getTrialtimes(obj) %GETTRIALTIMES Gets trial starts / ends from DAQ AI Ch2 or 3 % % Detection of trials is divided into two functions: % % getTrialtimes - parses inputs and outputs % - checks trialtimes before assigning to object % - can be customized or overloaded in subclass % ...
function [MMMSE] = mmmse(X,Y) muY = mean(Y); varY = var(Y); [N, N_obs] = size(X); varR = zeros(N, N_obs); for i = 1:N_obs varR(:, i) = X(:, i) - Y; end avgVarR = var(reshape(varR, [], 1)); MMMSE = (1 / (N_obs * varY + avgVarR)) * (avgVarR * muY + varY * sum(X, 2)); end
global MPI_COMM_WORLD; load 'MatMPI/MPI_COMM_WORLD.mat'; MPI_COMM_WORLD.rank = 64; Alluxio_Row_mv_version3;
function save_esn(esn, file_name, varargin) % SAVE_ESN save an Esn structure to disk. It's saved under the name % file_name. % % inputs: % esn - our Esn structure we want to save % file_name - a string containing the file we want % option - string containing further options that will be forwarded to % the matlab sa...
%--- coordinate plot with respect to time % you need to define model.C_posn in order to work properly [X_track,k_birth,k_death]= extract_tracks(X,track_list,total_tracks); figure(1); clf; subplot(211); figure(2); clf; subplot(211); %--- plot true tracks for i=1:total_tracks P= model.C_xy_posn*X_track(:,k_birth(i)...
clear all; clc; close all; load Data\S8_midPoints;% midpoint load Data\S5_glottis_struct;% a_lout A B c_point newx newy origin alpha; %%change for rotate %load data\glottis_lout;% a_lout u_lout A B c_point; %% random selection point l=size(midpoint,1); midshu=[]; midshu=[midshu;midpoint(1,:)]; for i=2:l-140 % change...
function V_q = PotentialEnergyVariation(q) % Calculates the Variation in Potential Energy term of Lagrange's Equation % Which is equal/opposite to the spring force, amiright? global Mooring lines = Mooring.lines; % Initialize Spring Force vector F_spring F_spring = zeros(size(q,1),1); for i = 1:Mooring.NumLine % Do...
%Eli Gonzalez %Dr. Qiao %Lab 02 %Note: I will use the built-in PCA to check my answer %Read the data from a CSV file x = csvread('F:\CSE 516\Eli_Gonzalez_Lab02\Task02\Bigger Data\source.csv'); %Find the mean and centralized matrix m = mean(x); y = bsxfun(@minus, x, m); % find covariance matrix c=cov...
function [ W ] = update_W( X, Y, C ) V = length(X); [k, c] = size(C{1}); W = cell(V, 1); for v=1:V YTXv = zeros(k, size(X{v},2)); for j=1:k YTXv(j,:) = sum(X{v}(find(Y==j),:), 1)+eps; end [U,~,V] = svds(C{v}'*YTXv, c); W{v} = U*V'; end end
function [meta] = load_meta(raw_dir,save_dir) %This function extracts useful meta info from many recordings so this can %be easily read and fed to suite2p for processing later %>>INPUT>> %raw_dir - Folder containing the data from a given animal. %The assumed folder tree structure is Animal--->Areaxx--->Stimx %save_dir...
function lfs = projectionontodipolefields(tfs,mask,vox,weight,z_prjs) if ~ exist('z_prjs','var') || isempty(z_prjs) z_prjs = [0, 0, 1]; % PURE axial slices end % add zero slices tfs = padarray(tfs,[0 0 20]); mask = padarray(mask,[0 0 20]); weight = padarray(weight,[0 0 20]); [Nx,Ny,Nz] = size(tfs); % creat...
function p=dam_hist_par(); % dam_hist_par % parameters (default values) for dam_hist & fly_hist: % hour (24): number of hours per day % skipDays (0): number of days to remove at the beginning % lightsOn (600): time (military) when lights go on % lightsOff (2400): time (military) when lights go off % firstHour (800): ho...
clear f0 = 80; dur = 0.4; sequence = [f0, f0* (2^(1/6)), f0, f0*(2^(5/12)), f0 * (2^(1/3))]; fs = 44100; [y,d] = lowpass(randn(1,fs*dur),5000,fs); stim_os = []; for s = 1:length(sequence) stim_s = OSCOR(dur,fs,sequence(s),d,1); stim_os = [stim_os stim_s]; end stim_am = []; t =0:1/fs:dur-1/fs; for s =1:len...
format rational; % assign format as rational in answer % type given vectors v1 = [1 -1 3 2 5]; v2 = [2 0 -1 -1 3]; v3 = [3 2 -4 -6 -4]; v4 = [-5 -4 12 12 8]; A= [v1;v2;v3;v4]; %making a matrix whose rows are v1,v2,v3,v4 B = rref(A) %compute RREF directly
copyB = B; air_time = copyB(:,7); air_time = str2double(air_time); for i = 2:size(air_time,1) if air_time(i) >= 300 air_time_group = 7; elseif air_time(i) >= 240 air_time_group = 6; elseif air_time(i) >= 180 air_time_group = 5; elseif air_time(i) >= 120 air_time_group...
# Red Hebbiana para simulacion de lenguajes artificiales. #function [Wf] = hebb_lenguaje(A)# Matriz de activaciones umbral es el umbral A = input('Introduce tu matriz >> '); ##Eliminar cuando este lista la función## b = input('Introduce un valor para beta >> '); # b es la tasa de aprendizaje umbral = input('Intro...
function figure_3 %% Display parameters for the plots font_size = 18; linewidth = 2; %% Scanning parameters M = 256; % samples per scan d = 10; % spin density, in arbitrary units sigma_N = 1; % noise standard deviation, in arbitrary units %% Simulation parameters simulations = 20; % how many simulations...
clc % This scripts need the x_i of p=1/2 , 1/10 and 1/100 N = length(x1); x1sum = zeros(N,1); x10sum = zeros(N,1); x50sum = zeros(N,1); x1sum(1) = 1; x10sum(1) = 1; x50sum(1) = 1; for t = 2:N x1sum(t) = x1sum(t-1) + x1(t); x10sum(t) = x10sum(t-1) + x10(t); x50sum(t) = x50sum(t-1) + x50(t); end plot(...
colors={'-ok','-^k','-or','-^g','--or','--^g','-sb','md','ob'} figure; hold on for i=1:9 plot(1,1,colors{i}) end legend('Gibbs Sampling (ensemble)','Gibbs Sampling (1st biggest cluster)','CentroidAlifold(new; al-mc)','CentroidAlifold (new; al-ct)','CentroidAlifold (old; mc)','CentroidAlifold (old; ct)','RNAalipfold−Cen...
Nc=max(max(L)); f=figure; imagesc(L); hold on; Features=[]; for i=1:Nc; [r,c]=find(L==i); maxr=max(r); minr=min(r); maxc=max(c); minc=min(c); rectangle('Position',[minc,minr,maxc-minc+1,maxr-minr+1],'EdgeColor','w'); height = maxr - minr; width = maxc - minc; threshold=7; if( h...
clear all close all load 'H:\ReconSim\LPW_REMUS_Run.txt' lpw = LPW_REMUS_Run; clear LPW_REMUS_Run easting = lpw(:,1); northing = lpw(:,2); plot(easting,northing) hold on plot(easting,northing,'o') axis equal hold on; grid on; %This sets the labels for the axes and title - these may not be relevant xlabel('Meters'); y...
function [c1,vc1] = C1Instant(im); %function [c1,vc1] = C1Instant(im); % %optionless version of c1 using the most common parameter values % returns both the cell array and vector versions of c1 % % for refererence the regions of the vector corresponding to the % different bands are: % % % 1 : 4096 % 4097 : ...
function [c,ceq,gradc,gradceq] = five_link_nonlcon(x,p) % x = gpuArray(x); [c1,gradc1]=yposCon(x,p); [c2,gradc2]=headPosCon(x,p); % [c3,gradc3]=ankPosCon(x,p); [c3,gradc3]=toe_heel(x,p); c = [c1;c2;c3]; gradc=[gradc1,gradc2,gradc3]; [ceq1,gradceq1]=dynConst(x,p); %[ceq2,gradceq2]=gaitLenCon(x,p); [ceq3,gradceq3]=in...
function ctime=ctimeForFile(createFileDateDir) if nargin < 1 createFileDateDir=true; end now=datetime('now') if createFileDateDir % keep data organized by date %datapath=getenv('SMURF_DATA'); datapath = '/home/common/data/cpu-b000-hp01/cryo_data/d...
% Rechnerunterstützte Mechanik I % Wintersemester 2017/18 % % Übung 4: % Differentialoperatoren % clc; % Konsole löschen close all; % Alle Figures löschen & schließen clear; % Speicher leeren disp('4. Übung im Fach Rechnerunterstützte Mechanik I (WS 2017/18)'); % %%%%%%%%%%%%%%%%% % %%% AUFGABE 1 %%% % %%%...
% Copyright (c) 2018 Gopalakrishnan, Krishnakumar <krishnak@vt.edu> % Author: Gopalakrishnan, Krishnakumar <krishnak@vt.edu> % clear;clc; format short g; format compact; close all; golden_ratio = 1.618; fig_width_factor = 1; ax_width_factor = 0.725; fig_ht_factor = 0.75; figW_cm = 15.74776*fig_width_factor; % te...
function plsig1 % close all % fig10 = figure; % set(fig10,'Position',[182 150 1131 813]); hold on; % load seq_MTS_adi_2000_298K.dat; % load eps_MTS_adi_2000_298K.dat; % seq1 = seq_MTS_adi_2000_298K; % eps1 = eps_MTS_adi_2000_298K; % e331 = eps1(:,4); % seqv1 = seq1(:,4)/1.0e6; % seqv1 = seqv1; % % plot(e33, seqv, 'k-',...
fid = fopen('out-bwareaopen-test--111.32SC1.raw', 'r'); d2 = fread(fid, [4096,4096], '*int32'); d2 = uint32(d2'); fclose(fid); fid = fopen('out-bwareaopen-test--151.32SC1.raw', 'r'); d3 = fread(fid, [4096,4096], '*int32'); d3 = uint32(d3'); fclose(fid); fid = fopen('out-bwareaopen-test--101.32SC1.raw', 'r'); d1 = fread...
function [i_knee, varargout] = segmented_linear(roc, knee_range, doplot) % % by Jeff Weiler, Paul Gribble, Andrew Pruzynski % % This function takes the area under an ROC curve as a function of time (roc), and a time % range to search for the knee point (knee_range = [start, stop]). The function % finds the knee poin...
function [Y,X] = Objfunction(x,lenchrom) %%目标函数 % 输入: % x 二进制编码 % lenchrom 各变量的二进制位数 % 输出: % Y 目标值 % X 十进制数 % 函数自变量的范围,每一行对应一个自变量 bound =[-3.0 12.1;4.1 5.8]; % 将binary数组转换成十进制数组 X = bin2decFun(x,lenchrom,bound); % 计算适应度-函数值 Y= sin(4*pi* X(1))* X(1) + sin(20 * pi * X(2)) * X(2);
classdef ClusterBasedPredictors methods(Static=true) function [precisionClRand, completenessClRand ] = getClusterRandomPrediction(A, partition, numPredictions, numTargetEdges) % How helpful is a clustering in link prediction? One way to find out is to randomly predict links by picking endpoints randomly, while ensurin...
function [str] = azWASBRoot(varargin) % AZWASBROOT Helper function to locate the Azure WASB interface % % Locate the installation of the Azure interface package to allow easier construction % of absolute paths to the required dependencies. % Copyright 2016 The MathWorks, Inc. str = fileparts(fileparts(fileparts(mfile...
function topoplotNode(nch, ijw, w_scal,brainNum) if (brainNum == 2) w_atribut = ijw(:,2); %taking the weights' attributes w_scaling = w_scal; %taking the scaling of weigths n_atribut = ijw(:,2); %fixing nodes' attributes n_scaling = 'n_nn2nx'; %fixing ...
function [] = plot_particles_vs_threshold() % reads 'data.txt' and plots first two columns. % in this case, we expect these columns to correspond to % number of particles found vs threshold value x = []; % threshold value y1 = []; % number of particles found y2 = []; % mean particle diameter % read file an...
clc; clear all; w=[0,1414,0,1414,0,-1414,0,-1414,0,1414,0,1414,0,-1414,0,-1414,0,1414,0,1414,0,-1414,0,-1414,0,1414,0,1414,0,-1414,0,-1414]; figure(1) hold on; grid on; xlabel('sample') ylabel('w[n]') stem(1:32,w); % fs=8000; ts=1/fs; figure(2) dft=fft(w); dft_abs=abs(dft); theta=(2*pi)/32; omega_badid=0:theta:(2*pi)-(...
classdef MixModelEmFitEng < EmFitEng methods(Access = 'protected') function model = initEm(eng,model,data) %#ok % override to do something more intelligent, i.e. kmeans for a GMM etc. % Here we just fit each mixture component on a random partition of % the data. ...
%% Exploit PPG signal to get heart rate and SpO2 level % Friendly to embedded % Thinh Nguyen % mecheng.hn@gmail.com % THIS ONE IS NOT OPTIMIZED. DO NOT USE FOR COMMERCIAL %% Start clear all %% Load sample data clear all [X1,X2]=textread('PPG.dat','%s %s'); data_st = 150; % Data start data_length =...
function [regMovie, pixelShifts] = motionCorrectCaImagingFile(tifName, regImage, framesToUse, trimBorders) % [regMovie, pixelShifts] = ... % motionCorrectCaImagingFile(tifName, regImage [, framesToUse] [, trimBorders]) % % Use the efficient subpixel registration algorithm to motion correct a % calcium imagin...
% %clc; % %clear all; % % %Serial = serial('COM4'); % Serial = serial('/dev/ttyUSB0'); % set(Serial,'Terminator','CR/LF'); % set(Serial,'BaudRate',115200); % set(Serial,'DataBits',8); % % set(Serial,'Parity','none'); % set(Serial,'StopBits',1); % % set(Serial,'FlowControl','none'); % fopen(Serial); % blocking = 0; %% ...
function [xsim, ysim] = getML_simLIPslopeMvsV(Monk, N, recompute) savepath = ['/work/mirror_jeff/code/matlab/tmp-mat/getML_simLIPslopeMvsV_' Monk '.mat']; if recompute [R m v] = getML_LIPSlopeDist(Monk, 0); % get simulated m/v for the mixture model coh = [0 3.2 6.4 12.8 25.6 51.2 99.9]; xsim = nans(...
function distance = Mah( x, y ,SIGMA ) % calulate two point's Mahalanobis distances. % formula: Dist(x, y, SIGMA) = (x - y)T*SIGMA*(x - y) % x, y: two n-dimensioanl points (column vector). % SIGMA: n * n matrix. % distance: Mahalanobis distances. distance = (x - y)' * SIGMA * (x - y); end
function [flash_map_response,time_window, y, cp, cp_time_windows] = calculate_flash_map_response(session, get_single_flash_responses, calculate_choice_probabilities, green_or_cyan,time_window) sorted_window = get_sorted_window(session.x); response_window = [100 400]; if ~exist('time_window','var') || isempty(time...
function [ blob_ellipse_manhattan ] = Bsxfun( pixels,ellipse_centres ) for i=1:1:size(ellipse_centres,1) BLOB(:,:,i) = pixels; ELLIPSE(:,:,i) = ellipse_centres(i,:); end blob_ellipse_manhattan = bsxfun(@minus,BLOB,ELLIPSE); %squeeze command then transpose;
function [v0,v1]=like1(dw,t,stretch) % [v0,v1]=like1(dw,t,stretch) % dw > 0 if fire detected, <0 if not, 0 if cloud % t = time since fire arrival (days) Tmin=stretch(1);Tmax=stretch(2);Tneg=stretch(3);Tpos=stretch(4); tneg = (t-Tmin)./Tneg; tpos = (t-Tmax)./Tpos; v0y = -tneg.*tneg.*(t<Tmin)-tpos.*tpos.*(t>Tmax); g0 ...
function X=regular_mesh(n,h,v) % X=regular_mesh(n,h) % Creates a regular mesh that is stretched in the vertical direction but % uniform horizationally % in: % n number of cells in each direction % h step size in each direction % v vertical stretch factor % out: % Mmat ...
function [E,gradE,normgrad] = Energy_KarcherMean(betamean,Data,mu,basis,register) % Compute the objective function to be minimized, and its gradient, in the % gradient descent Karcher mean algorithm implemented in findKarcherMean.m. % The objective function is E(q) = \sum_{i=1}^N d(q,q_i)^2, where q_i is % the...
function [p,w] = int3d_centroid1() % function [p,w] = int3d_centroid1() % % This is the simplest triangle integration method. p = [1/4, 1/4, 1/4]; w = 1/6;
%% Robotic Vision %% Lecture 2 - Getting an image into MATLAB – MATLAB transcript %% clear all; close all; clc; %% % Read in the 'street.png' image using imread() and display using idisp(). im = imread('street.png'); idisp(im); %%
function [ Torque_dash, Torque, correction] = fuzzy_controller( B_q, C_q_qdot, F_ext, err, err_dot, thetaD_ddot, theta_dot) % fis = readfis('Triangular.fis'); fis = readfis('Gaussian.fis'); for j= 1:1:4 correction(j)= evalfis(fis,[err(j) err_dot(j)]); % correction(j) = 0.0; end Torque_dash = thetaD_ddot + ...
function error_code=vdoc_cs_opt_post(name) % scan the optimization output files for new values and update the workspace % make vinf global and define drivetrain switch global vinf drivetrain=vinf.drivetrain.name; % print parameter for debugging debug=0; % 1==> writes additional output to command window, 0==> no debug...
%% Stelling 10 % % Matlab kan headers van databestanden altijd probleemloos % inlezen. % Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
clear; micro = 1e-6; voltage_points = -0.9:0.1:0.9; T_PULSE_x1_theoretical = zeros(size(voltage_points)); for i = 1:1:19 if(voltage_points(i) < 0) T_PULSE_x1_theoretical(i) = 0; else T_PULSE_x1_theoretical(i) = 1*micro*(voltage_points(i)); end end t_pulse_x1_experimental = extract_td_da...
clear all % Load TS [FileName,PathName] = uigetfile('*.mat','Select the region time series'); file2=strcat(PathName,FileName) load(file2) load('87to75.mat') % Open Data %[FileName,PathName] = uigetfile('*.nii','Select the Nifti file'); %file=strcat(PathName,FileName) file='/media/test15/ControlCombo/100682series/100682...
function plot_sensor_data(ftdate); close all; clc loadpath = '/data/sba_data/ft'; eval(['load ',loadpath,ftdate,'99/sensor_data.mat']); %load sensor_data.mat figure(1) plot(DMU_Out(:,1),DMU_Out(:,2),'r-'); hold on; plot(INS_Omega_Acc(:,1),INS_Omega_Acc(:,2),'b-'); grid; legend('X-Bow DMU','INS'); xlabel('GPS Time...
%% test_oct1.m parents{1} = PACK_fix(randi(5,[1 10]));parents{1} = [1 2 3 4 2 2 4 3 1 1]; parents{2} = PACK_fix(randi(5,[1 10]));parents{2} = [1 1 1 1 1 1 2 2 2 3]; options.LinearConstr.type = 'unconstrained'; % xoverKids = PACK_crossover2(parents,options,10,[],[],[]); mutationChildren = PACK_mutation2(2,options,10,[...
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR % Autores: Gonzalo Pajares y Jesús Manuel de la Cruz % Copyright RA-MA, 2007 % Ejercicio 9.10: Clasificación: redes neuronales y máquinas de vectores % soporte %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 9.9.4 Cuantización vectori...
% MACIERZ = zmienna przechowująca informację o wybranej do dalszych działań macierzy % 1 - macierz 2x2 z punktu a) % 2 - macierz Vandermonde'a o rozmiarze 20x20 % 3 - macierz trójprzekątniowa z przekątną dominującą % 4 - macierz trójprzekątniowa bez przekątnej dominującej % 5 - dowolna wprowadzona macierz cl...
function [X1,u1,v1,w1]=wc2rc(X,Xref,azi_surf,tilt_surf) % Use to transform world coordinate to relative coordinate % Date create: 8/16/2013 by Saran Salakij % See Kenneth Joy UC Davis COORDINATE CONVERSION BETWEEN THE CARTESIAN FRAME AND AN ARBITRARY FRAME (Cartesian-Frame-to-Frame.pdf) % Input: X == vector ...
%% This script contains all T2 q2 WGT2 calculation clear all close all clc addpath('./MatlabFunctions') addpath('./MatlabFunctions/TRM') addpath('./MatlabFunctions/HW') data_path = './Generate Data/esm2mb-urban-continue-sheffield-8xdaily-20years/'; land_type_all = {'urbn','rural'}; %% load variables disp('load...'...
% mlepAwsInit % This initializes MLE+/AWS environment global MLEPAWSSETTINGS % Credentials Path credPath = 'YOUR CREDENTIALS PATH'; credPath = 'TaoAwsCredentials.properties' % Private Key Path keyPath = 'YOUR PRIVATE KEY PATH'; keyPath = 'initial.pem' noOfInstance = 2; %% DO NOT MODIFY % AWS Home Path fullname = mf...
dataset_name = 'feature_dataset_6.mat'; dataset = load(dataset_name); svmStruct = svmtrain(dataset.train_features,dataset.train_labels,'showplot',true);
function plotBars(data,texts) M = mean(data); S = std(data); figure; hold on; bar(1:3,M); errorbar(1:3,M,S,'.'); smartStuff = title(texts); smartStuff.FontSize = 20; xticks([1 2 3]); xticklabels({'Novice', 'Intermediate', 'Master'});
%solution to SS RDE for GDL with area source %c needs to be integrated over all space for xi eta and zeta %const mu, non const s const1=1 const2=2 u=@(phi,theta,phip,thetap,rp) Const1*exp(const2*rp*sin(theta)*sin(thetap)*cos(phi-phip))*exp(const2*cos(theta)*cos(thetap)) integral(@(u,)
mT = 590 + 70 + 58; %% Fx2Vel = tf([1/mT], [1 0]) figure(1) optsFx2Vel = bodeoptions('cstprefs'); optsFx2Vel.FreqUnits = 'Hz'; optsFx2Vel.Title.String = 'Fx to Vel transfer function - Bode diagram'; optsFx2Vel.Grid = 'on'; bode(Fx2Vel, optsFx2Vel) %% Reg = tf([6500], [1 0]) * tf([1 0.8 0.16], [1 0.2]) OpenLoopTF = Reg ...
function [ProjectMatrix Mean_Vector]= DiscriminantAnalysis(X,PCAN,IN,BN) % X is the data matrix for training ; % N is the number of samples for each individual; % PCAN is the dimensionality of the first reduced space ; % IN is the number of the second reduced space; % BN is the number of the final...
function [H, F, Sx, Su, Sdu, T_du, Qlinha, Rulinha, Rdulinha, Clinha] = setpoint_deltaU_matrices_cost_function(A, B, C, Q, Ru, Rdu, Nstate, Ncontrol, Nout, Ny, Nu) %[H, F, Sx, Su, Sdu, T_du, Qlinha, Rulinha, Rdulinha, Clinha] = setpoint_deltaU_matrices_cost_function(A, B, C, Q, Ru, Rdu, Nstate, Ncontrol, Nout, Ny, Nu)...
function postCx(varargin) %% INPUT % Handle different cases [~, ~, ~, ~, opts] = util.pre('', varargin{:}); % Analysis variables name = util.constructname(extractAfter(mfilename, 'post'), {opts.case, opts.analysis}); lim = opts.maxevery; NT = opts.steps; p = opts.polynomialorder; % Load data files = util.l...
pos = find (y == 1); neg = find (y == 0); plot(x(pos,2),x(pos,3),'+'); hold on; plot(x(neg,2),x(neg,3),'o'); xlabel('Exam 1 score'); ylabel('Exam 2 score');
function multiplexedReadout_4() import qes.* import sqc.* import sqc.op.physical.* qubits = {'q6','q7','q8','q9'}; legends = {'|0000>','|0001>','|0010>','|0011>','|0100>','|0101>','|0110>','|0111>',... '|1000>','|1001>','|1010>','|1011>','|1100>','|1101>','|1110>','|1111>'}; numSamples...
%{ example.Ephys (manual) # electrophysiology recordings -> example.Sessions ephys_start : time # time when recording was started --- sampling_rate : double # sampling rate of recording gain : double # multiplier to convert to muV %} classdef Ephys < dj.Relvar properties(Constant)...
% given a generic planar graph, computes the % ray-graph intersection. Graph is a curvegraph data structure % % WRITTEN 5 March 2010 function ray_t = ray_graph_intersection2( ray_p, ray_n, CG ) DEBUG_MODE = 0; if DEBUG_MODE warning('debug mode enabled'); %#ok<UNRCH> clc, close all; load ray_graph_intersect...
givenFun = @(x) x*x*x - 2*x - 5; a = input('enter a: '); b = input('enter b: '); x = 0; for i = 1:1:100 x = a - (givenFun(a)*(b - a))/((givenFun(b) - givenFun(a))); if givenFun(x) > 0.00001 b = x; else a = x; end if abs(givenFun(x)) <= 0.00001 break; end end...
function [vecpow]=ps_rip(p,w) [ran]=rip_select(p); p=p(ran); for j=1:length(p) F = fft(p{j}(w,:)); pow = F.*conj(F); vecpow(1,j)=sum(pow); end end
function [ClassificationEin, ClassificationEout, likehoodEout, likehoodEin] = CalError(G, Xtrain, Ytrain, Xtest, Ytest) %Likelihood error out of the sample AlikelihoodEout = 0 ; for j = 1:1000 tempA = Ytest(j)*(dot(G,Xtest(j,:))); AlikelihoodEout = AlikelihoodEout + log(1+exp(-tempA)); end likehoo...
%% zero the world clear,clc %% Exp 01 %% parameter ramp = [30 30]; % in ms % key parameter fs = 44100; % in hz/s amp = 1; % parameters of linear up/down-sweep freq1 = 200; freq2 = 1000; % length of a sweep in one direction endTime = 0.5; %% gen original sin tone outputFile{1} = [pwd filesep 'ramp_sin_increase.wav']; ou...
function SIG = setSignalParams(varargin) % Last Update: 08/01/2019 %% Input Parameters if nargin <= 3 SIG = varargin{1}; symRate = SIG.symRate; if isfield(SIG,'nBpS') nBpS = SIG.nBpS; end if isfield(SIG,'nPol') nPol = SIG.nPol; end if isfield(SIG,'rollOff') rollOff...
function [cells,stim,files,chandef] = ImportCellsStim(shapefilename,stimfilename) % ImportCellsStim: read in results of shape-based spike sorting & stimulus information % [cells,stim,files,chandef] = ImportCellsStim(shapefilename,stimfilename) % Outputs: % cells{filenumber,cellnumber} is the time (in secs) of the spike...
function rho = rho_snow(D, model) switch model case 'Brandes' % Brandes et al. 2007 "A Statistical and Physical Description of % Hydrometeor Distributions in Colorado Snowstorms Using a Video % Disdrometer" D = D*1e3; rho = 0.178 * D.^(-0.922); rho = rho*1e3; otherwise err...
classdef Camera < matlab.mixin.Heterogeneous & handle % Protected C++ pointer properties (SetAccess = protected) % This is the actual integer pointer to C++ object in mem c_ptr = 0; sensor; observation = []; projection = []; ...
function weights = retrieve_weights(net) % Funktion wird benötigt im Training von FFN mit aktivierten Bais Knoten. % Funktion kürzt die Gewichtsmatrizen um die jeweilige Spalte, welche die % Biasinformationen enthält, da die Bias keine Fehler in das Netz % rückpropagieren. if strcmp(net.Bias,'inactive') == 1 ...
clear all; setpaths disp('Warning, the autotuning demonstrated in this demo is still experimental. Updates will follow soon...'); %% load data try load bal.mat catch % if it fails, download it from the web disp('Downloading data ...'); urlwrite('https://dl.dropboxusercontent.com/u/4284723/DATA/bal.mat'...
function mfcc = mymfcc(speech, fs, frame_start, frame_end, nceps) %MFCC %%この関数は、サンプリング周波数fsの音声サンプルデータspeechの %%frame_startからframe_endまでの区間の次数ncepsのMFCCを求める %メルフィルタバンクの設計を行う m=40; %バンド数 n=512; %fftの点数 maxmel=hz2mel(fs/2); mstep=maxmel/(m+1); h=round(mel2hz(0:mstep:maxmel)/(fs/2)*(n/2))+1; H=zeros(m,n/2+1);...
% After commit, create a report and the benchmark inside the output folder. DESTINATION = fullfile(pwd, 'outputs'); % Retrieving git hash [status, commitHash] = system('git rev-parse HEAD'); commitHash = strtrim(commitHash); if status ~= 0 error('Failed to retrieve git hash: %d', status) end cprintf('blue', 'Cur...
[samples, nmb ]= mcmc(1000,data,ctrl,(@(p) uniformprior(p',bounds)))
function [assignedStores assignedEmployee assignedMixedEmployee daysWorkedEmployee] = assign_employee(index,allele,assignedEmployee,assignedMixedEmployee,assignedStores,genderEmployee,daysWorkedEmployee) %% ASSIGN_EMPLOYEE % % Function responsible for mapping genotype to phenotype % % Copyright (C) 2020 % % This progr...
function X=poisson_1d_eig(n,h); % X=poisson_1d_eig(n,h) % eigenvalues of d^2/dx^2 with zero b.c. mesh 1:n stepsize h X=4*(sin([1:n]*pi/(2*(n+1)))/h).^2; end
function rho = get_rho_sat(a, T) %rho = exp(a(1) - a(2) ./ (T + a(3))) ./ T; rho = exp(a(1) - a(2) ./ T) ./ T.^a(3); end
function [Mtrl,Field] = GetECouplFFT(Mtrl, Field) %% F(1:2:2*(Mtrl.nHarms),:) = Field.Sin; F(2:2:2*(Mtrl.nHarms),:) = Field.Cos; nlFFT = fft(Mtrl.func(abs(Field.E).'*F))/Mtrl.N; couplFFT = fft( ones(2*Mtrl.nHarms,1)*((nlFFT)*(Mtrl.Cos - 1i*Mtrl.Sin)) .* ... (F/Mtrl.N),[],2); Mtrl.Dsin = 1i*(couplFFT(:,Mtrl....
clc; close all; clear all; %this code is to generate h for product code of different message bits %eg(4,9),(9,16),(16,25); m=9;%message bits ib=[1 0 1 1 1 0 1 0 0];%place the info bits here which yoy want to send to reciver. r=sqrt(m)+1; h=zeros(r*r-(m),r*r); r=r-1; for i=1:r for j=1:r+1 k=i-1; ...
function dist = DTW(t,r) %Dynamic Time Warping 动态时间规整DTW是一个典型的优化问题 %它的本质是一种衡量两个长度不同的时间序列的相似度的方法 n = size(t,1); m = size(r,1); % 帧匹配距离矩阵 d = zeros(n,m); for i = 1:n for j = 1:m d(i,j) = sum((t(i,:)-r(j,:)).^2); end end % 累积距离矩阵 D = ones(n,m) * realmax; D(1,1) = d(1,1); % 动态规划 for i = 2:n for j = 1:m ...
% reads the file polyfile line by line and constructs a cell array of % strings representing each polynomial function polyarray = readPolysFromFile(filename) file = fopen( filename ); polyarray = textscan(file, '%s'); fclose(file); end
function [Q_val_opt,action] = Q_greedy_act_test(theta,s,params,gpr) N_act = params.N_act; act_val = zeros(1,N_act); act_val_var = zeros(1,N_act); for l=1:N_act a = l; [act_val(l),act_val_var(l)] = Q_value(theta,s,a,params,gpr); end if sum(act_val==max(act_val))>1 pos = find(...
function course_ch6(n) % 第六章 图像压缩 if(n == 1) % 压缩比 Cr = imratio(f1, f2); % 相对数据冗余度 R = 1 - 1/Cr; % 均方根误差 rmse = compare(f1, f2, scale); [scale: 伸缩比例] end end
%% Wavelet Coherence % The continuous wavelet transform (CWT) allows you to analyze the temporal % evolution of the frequency content of a given signal or time series. The % application of the CWT to two time series and the cross examination of % the two decompositions can reveal localized similarities in time and % sc...
sessionList = {'Ellie_2017-06-27_15-30-22', ... 'Ellie_2017-07-19_15-49-43_Shnk2', ... 'Ellie_2017-07-20_09-41-04_Shank2D2', ... 'Ellie_2017-07-24_15-59-49_shank2D3', ... 'Ellie_2017-07-25_13-29-24_Shank2D4', ... 'Ellie_2017-07-26_13-51-39_Shank2D5', ... 'Ellie_2017-07-27_14-17-50_Shan...
function data = fft_clean(imec, data, varargin) % from Will Allen % data is passed in as nChannels x nSamples, and is processed internally as % this transposed and then transposed on the way out p = inputParser(); p.addParameter('thresh', 10, @isscalar); p.addParameter('nbins', 20, @isscalar); p.addParameter('showFigu...
function fig = plot_pos(base_avg,eff_hip_avg,eff_kne_avg,eff_ank_avg,eff_hk_avg,eff_ha_avg,eff_ka_avg,time,batchName,savefig) fig=figure('visible','off'); set(gcf,'Position',[233 499 1303 200]); subplot(1,3,3); hold on; plot(time,base_avg(1,:)*180/pi); plot(time,eff_hip_avg(1,:)*180/pi); plot(time,eff_kne_avg(1,:)*180/...
%% GLUECK: Growth pattern Learning for Unsupervised Extraction of Cancer Kinetics %% PREPARE ENVIRONMENT clear all; clc; close all; format long; pause(2); %% INIT SIMULATION % enables dynamic visualization on network runtime DYN_VISUAL = 1; % number of populations in the network N_SOM = 2; % number of neurons in e...
%-------------------------------------------------------------------------- %-------------------------------------------------------------------------- %This function computes the distance based upon the acqusition number in %the .mat files % Function: main_METADATA_postprocessing % Author: Jeanne Quimby - 03/21/2016 %...
close all; global pets pets = {'Coptodon_rendalli'}; check_my_pet(pets); estim_options('default'); estim_options('max_step_number',2e3); estim_options('max_fun_evals',5e3); estim_options('pars_init_method', 1); estim_options('results_output', 5); estim_options('method', 'nm'); for ijk = 1:1 ...