text
stringlengths
8
6.12M
function [vmean, vstd] = procAB_driftVel(par) %parameters T = par{1}; v0 = par{3}; gamma = par{4}; N = par{5}; folder = par{6}; deter = par{7}; Nprof = par{8}; nbins = 200; if deter == 0 mu = par{9}; end %% empirical drift velocity if deter == 1; range = 1; elseif deter == 0; range = 1:Nprof; end counts = zeros(l...
classdef TPA_MultiTrialTwoPhotonManager % TPA_MultiTrialTwoPhotonManager - loads raw data from all trials. % Computes transformations and extracts relevant info without ROIs %----------------------------- % Ver Date Who Descr %----------------------------- % 28.04 15.01.18 UD Pixel cor...
classdef awgZeroCalibrator < qes.measurement.measurement % measure awg zero offset % Copyright 2017 Yulin Wu, University of Science and Technology of China % mail4ywu@gmail.com/mail4ywu@icloud.com properties fine@logical scalar = false; showProcess@logical scalar = false end propertie...
function linescanImageViewer cellDirs = uipickfiles; for i =1:length(cellDirs) if isdir(cellDirs{i}) %Check if directory parseLineScans(cellDirs{i}) %pass to linescan parser end end % -----Local Function----- function parseLineScans(cellDir) lsContents = dir('LineScan*'); for i=1:length(lsCo...
function [X, y] = normalize (X, y) n = size(X, 2); m = size(X,1); minX = min(X); maxX = max(X); for i = 1:m, X(i,:) = ( X(i,:) - minX ) ./( maxX - minX ); end y = ( y - min(y) ) ./ ( max(y) - min(y) ); end
% rd_runNMOA.m %% Set up the opts structure op.stimCenters = [0 50 100]; op.stimWidth = 30; %% Run model R = attentionModel1D(op); % opts.attnGainX = R; opts = op;
function matInitEddyViscositySolver( obj ) %> @brief Function to initialize the vertical eddy viscosity sover for both the three dimensional barotropic and baroclinic shallow water model %> @details Function to initialize the vertical eddy viscosity sover for both the three dimensional barotropic and baroclinic shallo...
% Op Pose class. Uses EulerXYZ coordinates % % Author : Jonathan EDEN % Created : 2016 % Description : classdef OperationalPoseEulerXYZ < OperationalSpaceBase methods % Constructor function o = OperationalPoseEulerXYZ(id,name,link,offset,selection_matrix) o.id ...
function idxfl = nearfl(x, x0) % Get the lowest index of the two points in % vector x that bound the number x0. dx = abs(x - x0); flr = mink(dx, 2); il = find(dx==flr(1)); il = il(1); ir = find(dx==flr(2)); ir = ir(1); idxfl = min([il ir]); end
clear close all clc lmbda = 0.5; thetaF=[60;240]; delta_t = 0.001; k=71000; l1=1; l2=1; [Oe0,Ri0] = practical9_forkin(thetaF); [pc,u,v,sd] = practical9_perspective(Ri0,Oe0); % sd=s; t = 0; theta = [0;0]; e=1; i=1; while norm(e)>=0.003 [Oe0,Ri0] = practical9_forkin(theta); [pc,u,v,s] = prac...
cellSize = 50; originalImage = imread('Images/autoSegments/train/MGF1-Cross-0009.tif'); [width, height, dim] = size(originalImage); imshow(originalImage); hold on; Xboxes = fix(width / cellSize); Yboxes = fix(height / cellSize); row = 1; for i = 1 : Xboxes line([1, height], [row, row]); row = row + cellSize; end c...
function plot = draw_bar_plot(output, num_machines) [common, freq] = mode(output(:,2)); % Get machine with highest number of jobs new_data = zeros(num_machines,freq); % Create an array with machines x max jobs for i = 1:num_machines % Assign machine-wise machine_jobs = output(output(:,2) == i,1)'; ...
% function cond = cond_gaas(w) % Changelog 4/28/2017 % Changes made to make conductivity ans epsilon signs consistent with % electrical engineering notation of j = sqrt(-1); % % From Burke's paper % High frequency conductivity of the high-mobility two-dimensional % electron gas %% Parameters close all ; clc ; clear ...
# pacote necessario pkg load image; # abrir a imagem einstein = imread("imagem.jpg"); # função imhist retorna o histograma e os niveisIntensidade [histograma, niveisIntensidade] = imhist(einstein); # função size retorna as linhas e colunas de uma imagem [linhas, colunas] = size(einstein); # crio uma nova imagem pre...
t = -1:0.01:1; syms n w1 = symsum(sin(n*t)/n,n,1,50); w2 = symsum(sin(n*t)/n,n,1,100); w3 = symsum(sin(n*t)/n,n,1,200); % consider 9999 as infinite S = symsum(sin(n*t) / n,n,1,9999); plot(t,S); hold on plot(t,w1,'r'); hold on plot(t,w2,'g'); hold on plot(t,w3,'b');
function cv_result = CrossValidation(features_train, label_train, headers, max_depth, classification) k = 10; if classification cv_result = zeros(2, k); else cv_result = zeros(1, k); end cv_result = zeros(1,k); k_tree = cell(1,k); rowsize = size(features_train,1); rand = randperm(rowsize); shuffled_features = f...
function al_instructions(taskParam, whichPractice, subject) %AL_INSTRUCTIONS This function runs the instructions for the cannon task. % As we recently re-organized the instructions scripts, % instructions are currently only working for the "chinese" and % the "ARC" version. In particular, we divided the instructi...
function y = nanmsem(x,varargin) % Estimated standard error of the mean, based on median absolute % deviation to increase outlier robustness (ignoring NANs) m = nanmedian(x,varargin{:}); l = sum(~isnan(x),varargin{:}); s = nanmedian(abs(x - repmat(m,size(x)./size(m))),varargin{:}); % * 1.4826 % Factor of 1.4826 convert...
%Full Body LG EKF and EUL EKF for the boxing CMU data %Load up the generated model addpath('..\..\'); %This is reading TRC files and stuff addpath('C:\aslab\projects\AutoRehabSystem\Common'); addpath('C:\aslab\projects\AutoRehabSystem\Common\Classes'); %ADD MAGIC EKF STUFF EKFCodePath = 'C:\aslab\projects\vjoukov\Gen...
function [ x, w ] = ccn_compute_np ( n, np, x ) %*****************************************************************************80 % %% CCN_COMPUTE_NP computes a nested Clenshaw Curtis quadrature rule. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 07 March 2011 % % Au...
function writeExtConductanceSettingsHDF5(FID, pop_ind, mean, std, modify) % write external Conductance settings % FID: file id for writing data % pop_ind: neuron population index % mean: mean value for Gaussian conductance (uS) for each neuron % std: std for Gaussian conductance (uS) for each neuron if leng...
function[cities]=city_size(cities) %Code to determine the size of the cities %Input parameters: %cities: city matrix of format mx3, where the first column is filled with %the degree of the city in the Network %Output: %cities: modified version of the input matrix. The city population %(cities(:,2)) has been added %A...
n=0:250:6000; vpm=zeros(25,1); s=zeros(25,1); l=zeros(25,1); for i=1:25 [vpm(i),n(i)]=FHN2d_breaks100(n(i)); end %subplot(2,1,1);errorbar(rho,Vp4,Vp4err,'.') %subplot(2,1,2);plot(rho,lVp4,'*') %subplot(2,1,3);plot(rho,Vp4err,'--') %hist(Vp4) %hold on %plot(n/(200*0.02)^2,Vp2,'b') %hold on %plot(n/(200*0.02)^2,Vp3...
function compile_cpp_files % compile_cpp_files compiles the Kin2 toolbox. % The C++ code is located in 6 files: % Kin2.h: Kin2 class definition. % Kin2_base.cpp: Kin2 class implementation of the base functionality including body data. % Kin2_mapping.cpp: Kin2 class implementation of the mapping functionality % ...
L = 100; %Overall simulation interval N = 2000; %Number of space subdivisions h = L/N; %Size of mesh spacing x = [0:h:(L-h)]; %Space mesh tau = h^2/3; %Time step u0 = A*H(1/2 - abs(x),L) u = u0; time = 10000 for ti=1:time u(3:N-2)= -2*tau*(u(2:N).^2)./(h^2).*(u(1:N-1) -2*u(2:N) + u(3:N+1))... -(tau/(h^3))...
%%%% MULTI ENERGY MATERIAL DECOMPOSITION CODE BARZILAI BORWEIN WITH NEW REGULARIZATION TERM %%%% % Here I replace the matrix multiplications by matrix free functions % Reconstruct two material phantom, imaged with two different energies, using Barzilai-Borwain % optimization method. Second regularization term added! cl...
clear all; close all; clc; %% Import the data [~, ~, raw1] = xlsread('Tomo.xlsx','Tomography','H4:H19'); [~, ~, raw2] = xlsread('Tomo.xlsx','Tomography','J4:J19'); [~, ~, raw3] = xlsread('Tomo.xlsx','Tomography','D25:G40'); % Create output variable n_phi_minus = cell2mat(raw1); %counts corresponding to the pr...
function [total_centrality] = pseudo_inverse_RWBC(A); [~,n] = size(A); D = A*ones(n,1); D = spdiags([D], 0, n, n); L = D - A; L_plus = pinv(L); total_centrality = zeros(n,1); for s=1:n for t= 1:n if s ~= t s_index = zeros(n,1); s_index(s) = 1; s_index(t) = -1; ...
load HistogramsAssignment3; figure(1); histogram(finalQueueLength0,'Normalization', 'Probability'); set(gca, 'FontName', 'Times New Roman') set(gca,'xtick',0:10) set(gca,'fontsize', 12) title('Final Queue Length lambda=0.3') xlabel('Final Queue Length'); ylabel('Probability'); figure(2); histogram(finalQueueLength1,'...
% Set random number generator rng default; mkdir('../working'); mkdir('../working/sim_geno_sim_pheno'); n_samples = 100; %% Set up models cutoffs = [10, 30, 100, 300, 1000, 3000, 10000]; models = cell(1, 1); models{1}.name = 'Linear'; models{1}.m = Lin_model(false); models{2}.name = 'Linear w/ PCs'; models{2}.m ...
function ara_corrGB(fileStruct, paramStruct) %% Initialize % Initialize function-specific parameters assignInputs(fileStruct.analysis.xcorr.globSig_BOLD, 'createOnly') assignInputs(paramStruct.xcorr.globSig_BOLD, 'createOnly') totalScans = length(cat(2, scans{:})); %% Average Cross-Correlation Data Across All Subjec...
function [Y_in_train,train_prediction,Y_in_test,test_prediction] = ModelInfer_I_O_HMM_one_input(modelFile,train_Data,test_Data,nT,nB) %%% modelFile: DBN model file path %%% input: %%% train_Data: path for training data %%% test_Data: path for test data %%% nT: number of look back step %%% nB: number of discrete nod...
function [centres] = find_circle_centres(BW_image) %This function finds the centres of each circle and retursn a matrix %containing them. %Identify objects in the image CC = bwconncomp(BW_image); %Holder matrix BW2=zeros(CC.ImageSize); %Identify information of objects s = regionprops(CC, 'all'); %Holder Matr...
%% mds4mmea % classical multidimensional scaling applied to solutions of the mmea method %% function [y, e, parNm, dist] = mds4mmea(results) % created at 2022/03/30 by Bas Kooijman %% Syntax % [y, e, parNms, dist] = <../mds4mmea.m *mds4mmea*> (results) %% Description % classical multidimensional scali...
function Rho = GetRho (E, h, a) dRho = 0.05; r_max = 1; r = 0; Rho(1) = r; while ((r+dRho) <= r_max) r = r+dRho; if sqrVr(E, h, r, a) >= 0 Rho = [Rho r]; end end %Удаляем 0 Rho(1) = []; function result = sqrVr(...
%%-------------------------%% %% Parameter delta = 0.5; m = 5; h = delta/m; n = 1/h; %% basis 1 continuous P1- P0 %% P1 Alpha = zeros(n-1, 2*n); for i = 2:n-1 Alpha(i,2*(i-1)) = 1; Alpha(i,2*i-1) = 1; Alpha(i,2*i) = -1; Alpha(i,2*i+1) = -1; end Alpha(1...
% Align two images by affine transformation and homography %% Load images clear all; close all; clc; datapath = '../../data/AlignmentTwoViews'; imname1 = fullfile(datapath, 'uttower_left.jpg'); imname2 = fullfile(datapath, 'uttower_right.jpg'); im1 = imread(imname1); im2 = imread(imname2); im1 = im2double(im1); im2 =...
function [h,m] = getUIData(FigHand) % Get UI Handles h.animal_id = findobj(FigHand,'tag','animalIDField'); h.other_id = findobj(FigHand,'tag','otherIDField'); h.dob = findobj(FigHand,'tag','dobField'); h.dow = findobj(FigHand,'tag','dowField'); h.parent1 = findobj(FigHand,'tag','parent1Field'); h.parent2 = findobj(Fi...
function [mu,pc,ev] = Compute(data) %Compute Summary of this function goes here % Detailed explanation goes here n_data = size(data,2); mu = mean(data,2); cent_data = data - repmat(mu,[1,n_data]); [pc,ev] = myGPCA(cent_data,n_data,0,0); end
function [indCluster,numIter,tElapsed,finalResidual]=NMFCluster(X,k,option) % NMF based clustering % Usage: % [indCluster,numIter,tElapsed,finalResidual]=NMFCluster(X) % in this case, X is coefficient matrix obtained by a NMF outside this function % [indCluster,numIter,tElapsed,finalResidual]=NMFCluster(X,k) % [in...
function RUN_4_CellStateCompare_Path(basefolder, folders, dates,marker_name, antibody_rounds, marker_cycle, HSF1round, canceround, antibody_type, max_rows, well_nums, sol_thresh) %This program chooses the fields with good staining then plots the %frequency of HSF1 foci per core using the good fields % PLOT THE FRE...
function [hitted,missed,totalGT] = calculateHitMissACPR(realGT,prunnedSet) totalGT = length(realGT); matchedCnt = 0; for ii = 1:1:size(realGT,1) % tempGT = realGT{1,ii}; tempGT = realGT{ii,1}; flag = 0; for jj = 1:1:size(prunnedSet,1) testGT = prunnedSet{jj,1}; [~, name, ~] ...
clear;clc; %% generate random synthetic data n = 1000; p = 1000; sparse_ratio = 0.01; A = randn(n,p); beta = randn(p,1); beta(randperm(p,round((1-sparse_ratio)*p)))=0;beta0 = randn; b = beta0 + A*beta + randn(n,1); lambda = 0.1; %% straightforward method with cvx % cvx_begin % variable x_bi(p,1) % minimize(0.5*norm(...
clear; clc; h = 1; sum1 = (1+cos(1))/2; n = 1; int_exact = quad(@mycos,0,1,1.e-12,1.e-12); for i = 1:10 t = h/2; for j = 1:n sum1 = sum1 + cos(t^2); t = t+h; end n = 2*n; h = h/2; integ = h*sum1; h err_abs = abs(integ-int_exact) end
function assert_numeric_scalar_nonnegative(x) assert(isnumeric(x) && isscalar(x) && (x >= 0), 'Value must be nonnegative, scalar, and numeric.'); end
clf;clear all; close all; N = 10; sig = randi([0,1],1,N); sig((sig==0)) = -1; load('./filter/IIR_filter') symbol_rate = 1e6; carrier_frequency = 8e6/symbol_rate; freq_DAC = 16e6/symbol_rate; freq_DMA = 32e6/symbol_rate; group_delay = 1; srrc_16 = srrc_pulse(16, 5, 0.3); srrc_2 = srrc_pulse(2,5,0.3); srrc_16_delay ...
function plotScan(scan,cmap,dosaturation,withlights) %% https://github.com/psapirstein/mesh-comparing % This code is distributed under an Apache License 2.0 % Author: Philip Sapirstein, UNL % % The subroutine supports the collection of tools for processing 3D meshes % and assessing their repeatability accompanying the ...
tol = 1e-10; %% Tri: N = 3 N = 3; tri = StdRegions.Triangle(N); facelist = [1,2,3,4; 4, 7, 9, 10; 10, 8, 5, 1]'; for i = 1:tri.nFaceNode assert( abs(tri.Fmask(i) - facelist(i)) <= tol); end% for %% Tri: N = 4 N = 4; tri = StdRegions.Triangle(N); facelist = [1,2,3,4,5; 5,9,12,14,15;15,13,10,6,1]'; for i = 1:tri.nF...
function void = assignmentTwo() % Second assignment of Offline-2 % collection of data from given data file and processing data for further operations are done first % then, main operations are accomplished using processed data % % Input: % this function has no input % Output: % this function returns...
function trialVec = vecTrials(stimExpt,frameRate) if ~exist('frameRate','var') || isempty(frameRate) frameRate = 29.55; end nTrials = numel(stimExpt.trialOrder); % trialVec.stimFrames = stimExpt.ITI:stimExpt.ITI:stimExpt.ITI*nTrials; vecOrder = stimExpt.trialOrder'; trialVec.vecOrder = vecOrder(:); trialVec.nRep...
function doneOr = checkStatus_local(jobID) %-------------------------------------------------------------------- %This routine is to check if the submitted job is done or not %One needs to do a little edit based on your own case. %1 : whichCluster (0: no-job-script, 1: local submission, 2: remote submission) %-------...
function [images, labels, num_row, num_col] = loadModelImages(filename, sampling, balance) if nargin<2 sampling =0; end fp = fopen(filename, 'rb'); assert(fp ~= -1, ['Could not open ', filename, '']); line1=fgetl(fp); %unused line2=fgetl(fp); %unused numberOfImages = fscanf(fp,'%d',1); if sampling == 0 s...
function [grad]= network_gradient_wu(W,metric_type,varargin) n=size(W,1); O=ones(n); H=O-eye(n); if any(strcmp(metric_type,{'trans' 'transitivity'})) alfa=trace(W^3); beta=trace(W*H*W'); grad=((3*beta*W^2-alfa*(W*H+H*W))/beta^2 ).*H; elseif any(strcmp(metric_type,{'clust' 'clustering'})) ...
function [a, b, c, e_train] = model_training(xi, xk, with_bias, ... model, max_iter, b_init) % [a, b, c, e_train] = model_training(xi, xk, with_bias, max_iter, model, b_init) % Train model parameters, and calculate training error. % The details of the model can be seen at % https://github.com/ronghanghu/compbio...
../../src/process/user_camera.m
function [nv, nf, tris, sibhes, v2he] = split_edge_surf(heid, nv, nf, ... tris, sibhes, v2he) %#codegen %SPLIT_EDGE_SURF Split an edge and insert a new vertex. % % [NV, NF, TRIS, SIBHES] = SPLIT_EDGE_SURF(HEID, NV, NF, TRIS, SIBHES) % [NV, NF, TRIS, SIBHES, V2HE] = SPLIT_EDGE_SURF(HEID, NV, NF, TRIS, SIBHE...
function [ v,h,dispmap ] = disparitymap( imageA, imageB ) %DISPARITYMAP Summary of this function goes here % Detailed explanation goes here sampleSize = 4; windowSize = 8; %imageA = imread('C:\Users\Fraser\Desktop\leftsmall.bmp'); imageA = padarray(imageA, [round(sampleSize/2),round(sampleSize/2)]); %imageB = imre...
% this scripts evaluate the performance of VDB-SE on real cluster of % batteries. Data are provided by RSE. close all; clear; clc; load('lookup_fieldexperiments.mat'); load('data_fieldexperiments.mat'); dt = 1; time = 9599; timewindow = 0.4; % interval of soc to consider in each estimation batch moving_step = 0.2; n...
function rhs = rhs_bvp_2(x,y) global c0 a0 g delta p pw wd r0 z0 f0 aF % spontaneous curvature %c = -0.5*c0*(1 - tanh(g*(flip(x) - a0))); %c = -0.5*c0*(1 - tanh(g*(x - a0))); %c = -0.5*c0*(tanh(g*(x - z0/r0*0.5 + a0)))+0.5*c0*(tanh(g*(x - z0/r0*0.5- a0))) ; c = -c0/2 * ( 1./(1+exp((x-a0)/0.005))); % derivative of ...
function [worldZ,Zica,W,T,mu] = getKinICs(worldPoints,varargin) %% GETKINICS Get Kinematic independent components %% DEFAULTS VAR_IDX = [1,3,4,6]; R = 3; DO_ICA = true; %% PARSE VARARGIN for iV = 1:2:numel(varargin) eval([upper(varargin{iV}) '=varargin{iV+1};']); end %% nTrials = numel(worldPoints); nSamples = ...
% 315CA Dinu Ion-Irinel function r = fy (f, x, y) % =============================================== ======================= % Approximation of the derivative to y of f at point (x, y). % =============================================== ======================= % if y is on the edge of the derived ima...
function notes = findNote(cent,lines,dividedImage, median) notes = ""; for i = 1:length(cent) for j = 1:length(cent{i}) % Index the note indexOfNote = nearestPoint(cent{1,i}(j,2),cell2mat(lines{1,i}(:,1))); % Check if sixteen or eight ...
%-------------------------------------------------------------------------- % % Example script for sinf_1D.m and sinf_3D.m % % Author : dr.ir. Emanuel A.P. Habets % Date : 16-09-2010 % % Related paper : E.A.P. Habets and S. Gannot, 'Generating sensor signals % in isotropic noise fields',...
%% RELIABILITY: TIME VARIANCE % In this example, UQLab is used to compute the outcrossing rate $\nu^+$ in a non-stationary time-variant % reliability problem using the so-called PHI2 method. % % See also: B. Sudret (2008), Analytical derivation of the outcrossing rate % in time-variant reliability problems. Structure ...
function batch_master(LFP_or_neur, which_units, varargin) % 1) batch_master(LFP_or_neur, which_units, func) % 2) batch_master(LFP_or_neur, which_units, func1, func2) % % This is the master function used to call a specified function on individual % electrodes or neurons, all of them, just the significant encoders, or a...
%ADD_PLOT adds a measure and plot type to the list of measures to be % plotted. % % Syntax % ------ % ui.add_plot(); % % Details % ------- % This function combines the currently selected measure and plot type into % a single measure/plot combination, adding it to the list of measures to % plot. % % Examp...
function [eigenvectors, meanvector, eigenvalues] = prmi_pca(varargin) % PRMI_PCA Principal Components Analysis. % [eigenvectors, meanvector, eigenvalues]=prmi_pca(X) performs PCA on data % matrix X whose columns consist of observations. The columns of eigenvectors % are sorted in descending order of the correspondi...
function result = histogram(I,r,c) histo = zeros(1,256); for i = 1 : r for j = 1 : c pval = I(i,j); histo(pval + 1) = histo (pval + 1) + 1; end end result = histo; end
function [ alpha,details_LS ] = WolfCndVersion3( obj,Grad,Z,Y,d,ops) % % This function is the line search algorithm statisfying the decrease % condition in the Wolfe conditions. The cost fuction at f(x+alpha d)<=f(x) % and the gradient condition. Check it because it does not has the % zoom-step % % Syntax : [ alpha ]...
function code = dark_freerews_progratio % MB: 8/6/18 %deliver small size rewards automatically every X # of seconds for %habituation. however, offer pseudorandom rew sizes (sm/md/lg) for prog %ratio running to train to run % Begin header code - DO NOT EDIT code.initialization = @initializationCodeFun; code.runtime =...
function viewVennDiagram(circleAreas,overlapAreas,totalArea,varargin) % Makes Venn diagram plot. % Biafra Ahanonu % originally started: 2017.03.08 [22:29:33] % branched 2018.04.28 [15:50:00], taken from older calciumImagingAnalysis method. % inputs % circleAreas % A [c1 c2 c3] integer or float vector contain...
% HISTFEATURES First order statistics from gray-level histogram. % [X,FEATS] = HISTFEATURES(I,BW) computes 13 histogram features from the % gray-level image I masked by the binary image BW: average histogram (AHg), % average gray level (AG), modified energy (MEgy), modified entropy (Metp), % modified standar...
function [result, ambient, diffuse, specular, fnc] = evc_phong( V, L, N, ia, id, is, ka, kd, ks, alpha ) fnc.compute_reflection = @( L, N ) evc_compute_reflection( L, N ); fnc.compute_lighting = @( V, L, N, R, ia, id, is, ka, kd, ks, alpha ...
function dy = ecuacion(x, y) dy = -2*x^3 + 12*x^2- 20*x + 8.5; end
% addpath('/home/xyy/code/point-neuron-network-simulator/mfile'); data_sw = load('sw_3dim.mat'); W = data_sw.W; n1 = data_sw.n1; n2 = data_sw.n2; n3 = data_sw.n3; pm = []; pm.neuron_model = 'IF-jump'; pm.simu_method = 'auto'; pm.net = W; pm.nI = length(W); pm.scee_mV = 0.0; pm.scie_mV = 0.0; pm.scei_mV = 1.0; pm...
% The input must be a function in the coefficient space function plotSolution(usr_par,u) figure; clf trisurf(usr_par.mesh.t,usr_par.mesh.p(:,1), ... usr_par.mesh.p(:,2),u,'facecolor','interp') title(' u_{exp} (target / experimental / observed states) '); xlabel('x'); ylabel('y'); %axis([-1 1 -1 1 -...
function [val] = meanAbsDiff(inMat) % each column of inMat is a distinct vector distance = 'minkowski'; minkVal = 1; % first compute mean vector meanVec = mean(inMat,2); dists = zeros(1, size(inMat,2)); for i = 1:size(inMat,2) dists(i) = pdist([inMat(:,i) meanVec]', distance, minkVal); end val = mean(dists);
function theta = normalEquations(x, y) theta = pinv(X' * X) * X' * y; endfunction
function histogram = getHistogram(C, I), % threshold = 250; C = C'; histogram = zeros(size(C, 2),1); I = single(rgb2gray(I)); [f,d] = vl_sift(I) ; %C : 128xsomething d = double(d); % fprintf('d then C \n'); % size(d) % size(C) for i = 1:size(d,2), %d : 128xsomething idx = 1; min_distance = norm(d(:,i) - C...
function img_blue = seleciona_cor(path_img_original) %{ * Script que troca a escala de uma imagem de RBG para Gray. path_img_original: string - caminho para a imagem a ser transformada img_cinza: uint8 - versao, em escala de cinza da imagem %} % leitura da imagem img_original = imread(path_img_original); % con...
%% TestNUFTaccuracy.m % % Testing the accuracy of several implementations of the matrix-vector % multiplications m = E*x, y = EH*m, and z = M*x, where E is a particular % non uniform discrete Fourier transform matrix, EH is its Hermitian transpose % and M = EH*E (with a specific implementation). % The reference impleme...
function identify_SU_allcells animalid = '150910'; block = 11; lcol = 'r'; %lasercolor onlymod = 0; printyn = 0; sfc = 0; supath = ['C:\Users\Julia\work\data\' animalid '\singleunits\']; % supath = ['C:\Users\Julia\work\data\' animalid '\multiunits\']; basename = [animalid '_block' int2str(block) '_tet']; files = d...
function [out] = d(x, y) % Simple function to calculate the sum of a roll of a Y sided die X times out = 0; for i = 1:x out = out + randi(y); end end
function [HtMat] = ifft_3dmat(Data, N_line, N_bins) HtMat = zeros(N_line,N_line,N_line,N_bins); for ir = 1 : N_line for icol = 1:N_line for iz = 1:N_line curBin = Data{ir}{icol}{iz}; % reverse FFT for each space location i curHt = ifft(curBin);...
%fft of gyroscopes function [result,Y] = doGyroFFT(data,doPlot) % data(1) = data1; % data(2) = data2; % data(3) = data3; [L,S] = size(data); Fs = 100; T = 1/Fs; t = (0:L-1)*T; for i = 1:S Y(:,i) = fft(data(:,i)); P2 = abs(Y(:,i)/L); P1(:,i) = P2(1:floor(L/2+1)); P1(2:end-1,i) = 2*P1(2:end-1,i); ...
function [p_argmax,sigma_argmax]=distributionOfArgMax(mu,sigma) nr_samples=1000; samples=mvnrnd(mu(:),diag(sigma),nr_samples); p_argmax=histc(argmax(samples'),1:numel(mu))/nr_samples; for i=1:numel(p_argmax); sigma_argmax(i)=sqrt(p_argmax(i)*(1-p_argmax(i))); end end
reg_results = load(fullfile(files_path, 'postprocessed_data', 'ephys_regression_results.mat')); nCells = length(reg_results.bad_glm); nRegs = 10; window_size = 1; %% Compute port-entry CPDs for each regressor for cell_i = 1:nCells for lock_i = 1:4 entry_bins = abs(reg_results.bin_mids...
rib_data; close all %% Convert weights to volumes wts = [1350 420 500 370 92 22]'; % http://faculty.washington.edu/chudler/facts.html vols = [1298 337 383 407 79 23]'; %rilling & insel, 1999 figure; subplot(1,2,1); pwt = allometric_regression(vols, wts); hold on; title('vol vs wt'); subplot(1,2,2); pvol = allom...
function [ V, theta, eps_all, time, convergence ] = f_SE_NR_algorithm_v2017 ( V, theta, topo, Y_bus, z, W, Wsqrt, ... ind_meas, N_meas, eps_tol, Max_iter, H_decoupled, H_sparse, linsolver ) %************************************************************************** %DESCRIPTION OF FUNCTION (VERSION 2017) %*****...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Author : Sandeep Manandhar % University of Burgundym France % MSCV6 % Radon Transform %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % inputs: % image % minimum value for angle % maximum value for angle % toggle guides and axis ...
v1 = input('a aracın hızı kaç:'); v2 = input('b aracaın hızı kaç:'); uzunluk = input('A ile B şehirleri arasındaki mesafe ne kadar:'); %%maximum süre şimdilik 10 olsun for t=0 : 10 if v1*t < uzunluk fprintf ('saat %d :',t); fprintf('a aracının konumu %d \n' ,v1*t); elseif v1*t == uzunluk ...
function [ model ] = randomSampling( X, y) [~,k] = size(y); [n,d] = size(X); %Find the cumulative distribution function. p(1) = (sum(X(1,:) == 1) + sum(X(2:n,d) == 1))/(n+d); for i = 2:k-1 p(i) = p(i-1) + (sum(X(1,:) == i) + sum(X(2:n,d) == i))/(n+d-1); end p(k) = 1; model.p = p; model.k = k; model.predict = @(mo...
function y = clasifi1(net) if (net >= 0) y = 1; else y = -1; end return
close all; clearvars; clc; % m is unique for everyone % find addend such that specs are met by looking at plot % remove semicolon to see the value printed % Specs m = 74; q_m = floor(0.1*m); r_m = m - 10*q_m; BL = 25+1.7*q_m + 6.1*r_m; BH = BL + 20; trans_bw = 4*10^3; % Band Edge specifications fs1 = BL*10^3-trans_b...
b0 = 1.70710; b1 = [1 -1*exp(1i*(pi/4))]; b2 = [1 -1*exp(-1i*(pi/4))]; a1 = [1 0]; a2 = [1 0]; b = b0*conv(b1,b2); a = conv(a1,a2); fvtool(b,a) [h,w] = freqz(b,a,'whole',2001); disp(w); figure; subplot(2,1,1); plot(1:2001,20*log10(abs(h))) title('FIR') xlabel('Frequency') ylabel('Magnitude (dB)') subplot(2,1,2); plot...
function oo = study(o,varargin) % Do Some Studies % % STUDY Several studies % % oo = study(o,'Menu') % setup study menu % % oo = study(o,'Study1') % raw signal % oo = study(o,'Study2') % raw & filtered signal % oo = study(o,'Study3') % filtered % oo = study(o,'Stud...
%This file was created as a templete for MSE 429 Advanced Kinematics of %Robotics Systems at SFU % %Created by Flavio Firmani, Fall 2020 %1. INITIALIZATION (NO CHANGES ARE NECESSARY except for section 1.3) %clear variables and close figures clc; clear all; close all; %1.1. Define size of figure and create ...
noOfFlights = 9; noOfDimentions = 3; goal = zeros(noOfFlights,noOfDimentions); for i = 1:noOfFlights goal(i,:) = floor(rand(1,3)*10)*100; end goalOrigin = goal; goalSortedByX = sortrows(goal,1); plot3(goalSortedByX(:,1),goalSortedByX(:,2),goalSortedByX(:,3),'o') hold on plot3(goalSortedByX(:,1),goalSortedByX(:,2)...
% IndividualDifferences.m % % Runs a battery of measures of individual differences in cognitive & % psycholinguistic abilities. % % How to use the battery: % 1) First, use File->Save As... to save a COPY of this file and call it % something like YourProjectName.m . Then, just edit this COPY so you % can leav...
function [ F10 ] = function_F10( alpha ) %FUNCTION_F10 Summary of this function goes here % Detailed explanation goes here j = sqrt(-1); J0 = besselj(0,alpha*(j)^(3/2)); J1 = besselj(1,alpha*(j)^(3/2)); F10 = (2*J1)/((alpha*(j)^(3/2))*J0); end