text
stringlengths
8
6.12M
function finResults = tempvshomophily(numSim, tspan, homophilyValues) % Yellow Jacket Model version % Script created 2020-05-27 by jmenard % previous version sampled new parameters for each different homophily value, while we want to sample % different params each simulation, not each homophily value....
% % Ingrese el intervalo inferior: 0 % Ingrese el intervalo superior: 2 % Ingrese el porcentaje de error: 0.0001 % Ingrese la funciòn: x+1 % i xf(i) Error aprox (i) % 1 2.0000000 100.000 % 2 -1.0000000 300.000 % 3 -1.0000000 -0.000 xf(1)=input('Ingrese el intervalo inferior: '); xf(2)...
function writetoPAJ(a, fname, arcs) %WRITETOPAJ Write to Pajek % % writetoPAJ(a, fname, arcs); % % This function writes a Pajek .net file from a MATLAB matrix % % Inputs: a, I/O object handler % fname, filename minus .net extension % arcs, 1 for directed...
classdef Point properties x = 0; y = 0; end methods function p = Point(xx, yy) p.x = xx; p.y = yy; end function p = PointObj(dot) p.x = dot.x; p.y = dot.y; end end end
function s = delimlist(c, varargin) % cslist Convert cellstr to delimited list. % % Syntax % ======= % % S = textfun.delimlist(C,...) % % % Input arguments % ================ % % * `C` [ cellstr ] - Cell array of strings that will be converted to a % comma-separated list. % % % Output arguments % ...
%% check_all.m % Usage: check_all(ROOT_DIR) % Purpose: Checks the velocity and gtemperature of simulations in pullSimTime % to determine statSimeTime % % User Inputs: % ROOT_DIR - Directory where pullSimTime resides % % Function Requirements: % pullSimTime created from simtime.sh function chec...
Fs=8192; y1=gen_wave(1,0.5); y2=gen_wave(1,0.5); y3=gen_wave(5,0.5); y4=gen_wave(5,0.5); y5=gen_wave(6,0.5); y6=gen_wave(6,0.5); y7=gen_wave(5,1); y=[y1 y2 y3 y4 y5 y6 y7]; y1=gen_wave(4,0.5); y2=gen_wave(4,0.5); y3=gen_wave(3,0.5); y4=gen_wave(3,0.5); y5=gen_wave(2,0.5); y6=gen_wave(2,0.5); y7=gen_wave(...
function Xinter = findfoot(a,b,c) % a = [1 1 2]; %line - x1 % b = [20 28 90]; % line - x2 % % c = [50 30 67]; %point - x0 a= transp(a); b= transp(b); c= transp(c); ab = b - a; %// Find x2 - x1 %// -(x1 - x0).(x2 - x1) / (|x2 - x1|^2) t = -(a - c)*(ab.') / (ab*ab.'); %// ...
function [Coarse, F] = CoarseToFineRF(PDS, spikes) % checks if spatial RF mapping was run, uses a coarse initialization of the % RF to measure %% spatialMap = session.squareFlash(PDS); %% SPATIAL_MAPPING_WINDOW = [-15 -10 15 10]; % SPATIAL_MAPPING_BIN_SIZE = 1; % SPATIAL_MAPPING_WINDOW = ...
%% uses matlab pointcloud downsampling function to downsample an organised point cloud function output_OPC = downsample_OPC( input_OPC, gridStep ) input_OPC = cast(input_OPC, 'double'); %convert to double (required) cloud_object = pointCloud(input_OPC); ds_cloud_object = pcdownsample(cloud_object,'gridAverage',g...
function net = cnnapplygrads_new(net, opts) %update weights and biases for l = 2 : numel(net.layers) if strcmp(net.layers{l}.type, 'conv') for j = 1 : numel(net.layers{l}.a) for ii = 1 : numel(net.layers{l - 1}.a) %update history including gradient, weight dec...
% % DIAGNOSIS OF SMALL CELL LUNG CANCER THROUGH ARTIFICIAL NEURAL NETWORKS % In the code below, we perform the following tasks: % ------------ % % 1- Load X-ray image data of diganosed small cell lung cancer patients. % 2- A sample image (obtained from cancer image archive has 1951*2000 % samples. So, samp...
function [locs,sifts] = calculate_sift_for_image_set(image_name_set) locs = cell(numel(image_name_set),1); sifts = cell(numel(image_name_set),1); for i = 1:numel(image_name_set) try [f,d] = im2sift(image_name_set{i}); locs{i} = f; sifts{i} = d; catch exception locs{i} = -1; sifts{i} = -1; conti...
function [xnew, ynew] = plotcone(y, x) % Useful when all elements in y have the same x, and you want to plot y vs % x. This function gives x_new and y_new that make the y vs x plot look % like a nice gaussian cone (by adding small random values to the x of each % element to separate the points). %% y = reshape(...
fid = fopen('trip_data_2.csv'); %第一行 第六列开始读 title = textscan(fid, '%s %s %s %s %s %s %s %s %s %s %s %s %s %s',1,'delimiter', ','); data = textscan(fid, '%s %s %s %s %s %s %s %d32 %d32 %d32 %d32 %d32 %d32 %d32','delimiter', ','); fclose(fid); disp(title{1}); %--------------------纽约------------------------ % [m,n] = size...
mpath = which('sketching'); mpath(end-11:end) = [] cd(mpath) pwd fileFolder=fullfile('SmoothImage'); dirOutput=dir(fullfile(fileFolder,'*')); fileNames={dirOutput.name}'; length = size(fileNames); filesize = length(1, 1); for i = 1 : 1 : filesize if strcmp(fileNames{i, 1},'.') || strcmp(fileNames{i, 1},'..') ||...
function [runs,miss]=plot_radscanmultisp(directory) if directory(end-3:end)=='.dat' dirlist={}; if not(exist(directory,'file')) if directory(1)=='/' directory=[getenv('SFINCS_HOME'),'/fortran/version3',directory]; else directory=[getenv('SFINCS_HOME'),'/fortran/version3/',directory]; en...
function [ Eff_M,x,y,y_fit ] = Effective_Mass( H,P,band,shift ) %EFFECTIVE_MASS Given a Path, P and SINGLE band Omega, fit parabola to get %effective mass. hbar=1.05457e-34; %m^2kg/s a=4.3596e-10; %m me=9.109e-31; %kg N=200; [k_line,k,~]=K_path(P,N); %Compute Eigen values for n = 1:length(k_line) Omega(n,:) = sort(e...
function IbuprofenTimeSeries(); clf; fasted = csvread('FastedDigital.csv',6,0); light = csvread('LightBreakfastDigital.csv',6,0); heavy = csvread('HeavyBreakfastDigital.csv',6,0); fasteds = csvread('FastedStomach.csv',6,0); lights = csvread('LightStomach.csv',6,0); heavys = csvread(...
function [pvx, pvy] = GetNewPolygon(color) % % Return vertices of a user-defined polygon, drawn onto the current plot. % % This is intended to be an implementation of the GetSelPolygon function, % using Matlab's new handle-graphics interface, particularly the impoly % function. % % (C) 2015 Benjamin Naecker bnaecker@st...
function h = errorbar_group(model_series,model_error) % Plots errorbar on group bars % Usage: errorbar_group(bar value,errorbar value) % %model_series = [10 40 50 60; 20 50 60 70; 30 60 80 90]; %model_error = [1 4 8 6; 2 5 9 12; 3 6 10 13]; h = bar(model_series,'BarWidth',1); clr = [0.5 1 0.5;0.5 0.5 1;1 0 0...
%Displaying the Frechet mean and an element of the sample set of graphs A = sampleAdjSet{1}; A = A-1; A = -1*A; deg = sum(A); [sorted,I] = sort(deg); sortedA = A(I,I); p_i = sort(p_i, 'descend'); frechetMean = rand_adj(p_i,q_i,n); frechetMean = frechetMean-1; frechetMean = -1*(frechetMean); degMean = sum...
1; function k = gauss(beta, x1, x2) x = x1 - x2; k = exp(-beta * x^2); endfunction function mat_k = kernel_matrix(beta, vec_x) mat_k = []; for x1 = vec_x' line = []; for x2 = vec_x' line = [line gauss(beta, x1, x2)]; end mat_k = [mat_k; line]; end endfunction function r = square_error...
fol_name = 'data/behav_analyzed_hgf_concat'; all = dir(strcat(fol_name,'/*.mat')); for k = 1:length(all) load(strcat(fol_name,'/',all(k).name)); plot(subject.hgf.sim_concat.traj.mu(:,2)); hold on; end
%HVISEMPTY % [flag] = HVISEMPTY(iChnl, dasIn_1, dasIn_2, ... dasIn_N) % where flag == TRUE if one or more of workspace data structures 'dasIn_n' are empty. % If iChnl > 0, iChnl is used to identify the channel currently being processed. % Written by Chris Lewis, August 2002 % function [iFlag] = HVISEMPTY(iChnl, v...
function [G pred g] = psymodfun(b,Y,X,ML,nk,f,gnorm) %% logfunX_ml_power % psychometric model for sequential comparison tasks % (c)Bernhard Spitzer, 2016 % weighting function pownum=abs((b(2)+X(:,1:nk)).^b(3)).*sign(b(2)+X(:,1:nk)); % b(2): bias; b(3): kappa % g normalization g=sum...
function[H]=emdprog(g) g=load('S001.txt'); g=emd(g); figure; subplot(911) plot(g(1,:)) title('IMF1') subplot(912) plot(g(2,:)) title('IMF2') subplot(913) plot(g(3,:)) title('IMF3') subplot(914) plot(g(4,:)) title('IMF4') subplot(915) plot(g(5,:)) title('IMF5') subplot(916) plot(g(6,:)) title('IMF6') subplo...
function [omega1,S_omega1,dRf1_0] = ang_vel(Rf_1_0, dRf1_0, q, dq) % Derivative of rotation matrix dRf1_0(:) = [jacobian(Rf_1_0(:,1), q)*dq, jacobian(Rf_1_0(:,2), q)*dq, jacobian(Rf_1_0(:,3), q)*dq]; dRf1_0 = simplify(dRf1_0,'IgnoreAnalyticConstraints',true); % S(omega) = (transpose(R))*dR/dt ...
% To create 2 Matricies and multiply them % Condition : Inner dimenssions of Matricies must be same % A(mxn) * B(n*p) = C(mxp) % Define variables: % n - row of first Matrix % p - column of first Matrix and row of second Matrix % A - first matrix % B - second matrix % C - product of A and B n = in...
%dividing the fourier transforms to deblur% de_blurred = deblur(yj,h); function X = deblur(y,H) X = y./H; end
function [v,m,x,er] = llyod_max(levels,max_l,min_l,mu,sigma) digits(50); variance = sigma*sigma; v = zeros(levels,1); for i = 1:levels v(i) = i/10; %Can be any initialization end m = zeros(levels+1,1); m(1) = min_l; m(levels+1) = max_l; %generating pdfs for finding the expectation of the variable pdf_gaus...
function mapping = combineKeysAndValues(type, keys, values) %COMBINEKEYSANDVALUES Combine keys and values into mapping. % TODO: Do we need to check for invalid keys? % Check inputs checkForDuplicateNames(keys) % Build output typeMap.map = @createMap; typeMap.struct = @createStruct; typeMap.cell = @createCell; if is...
function x_rect=rectify(x,x_min,x_max) x_rect=min(x_max,max(x_min,x)); end
fontsize = 16; linewidth = 2; output_offset_ada{j} = importdata([fileSave filesep 'output_offset_ADA.mat']); prob_offset_session_offline_ada{j} = importdata([fileSave filesep 'prob_offset_ADA.mat']); if iFolder == nFolder %% nSubject = length(output_offset_ada); accuracy_mean = nan(nSubje...
function [ ] = GetSpikeStats( SimValues,PopParams,timewin ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here % % timewin window to show raster (ms) %% Calcualte each cell's spike rate and rate sortings cellrates = cellfun(@length,SimValues.spikesbycell)./(SimValues.t(end)./1000); [~,...
function findSSD(Meta_savename) %find the stable size distribution for Central California Coast blue %rockfish, uses recruitment magnitude from IPM fits from White et al. 2016 load(Meta_savename) load(Meta.Ffit_savename) F=Post.F_mean; fixparm = Meta.fixparm; meshsize = Meta.IPM.meshsize; meshmin = Meta.IPM.meshmin...
function residuals = rodriguesResidual(P_init,p1,p2,K1,K2,M_diff,R1,t1,x) % rodriguesResidual: % Inputs: % P - Nx3 matrix of 3D coordinates % p1 - Nx2 set of points in left camera % p2 - Nx2 set of points in right camera % K1 - 3x3 camera calibration matrix 1 of left camera % K2 - 3x3 camera calibration matr...
function [double_sorted_data] = yearly_double_sort_2x4(quantile_data,estimation_data,control_var,sort_var) %This function constructs double-sorted 2x4 portfolios, i.e., above and %below median % quantile_data = sortrows(quantile_data, {'year','permno','time'}); quantile_data.control_quantile= yearly_quantile...
%---------------------- BEGIN CODE ---------------------- % Clear all the previously used variables, close all % figures and clear screen close all ; clear all ; clc ; l = 1e3; EbNodB=[7]; EbNo=10.^(EbNodB/10); n=1; % In-phase symbol generation si=2*(round(rand(1,l))-0.5); % Quadrature symbol generation sq=2*(round...
% Compute the error of a pose-landmark constraint % x 3x1 vector (x,y,theta) of the robot pose % l 2x1 vector (x,y) of the landmark % z 2x1 vector (x,y) of the measurement, the position of the landmark in % the coordinate frame of the robot given by the vector x % % Output % e 2x1 error of the constraint % A 2x3 Jaco...
m = 0.111; R = 0.015; g = -9.8; L = 1.0; d = 0.03; J = 9.99e-6; s = tf('s'); TF = -2*m*g*d/L/(J/R^2+m)/s^2; rlocus(TF) sgrid(0.70, 1.45) axis([-5 5 -2 2]) zo = 0.01; po = 4; C=tf([1 zo],[1 po]); rlocus(C*TF) sgrid(0.70, 1.45) [k,poles]=rlocfind(C*TF) %k=80.1815 %sys_cl=feedback(k*C*TF...
function [peak_T, P, p, threshold, deltaP] = Lomb_Scargle(t, Y, a, zero) %This function uses the Lomb_Scargle method to detect periodic components %in a given signal. % %The arguments required are t, Y, a, and zero. %t is the times (in hours) of your points %Y is the array of points (i.e., the Y(t) values) %a is the er...
function Handles %HANDLES 此处显示有关此函数的摘要 % 此处显示详细说明 clear,close,clc; f=@(x) exp(-2*x); x=0:0.1:2; plot(x,f(x)); end
function extract_timecourses(save_path,mask_path,h5_path,tiff_path) % extract_timecourses(save_path,mask_path,h5_path,tiff_path) % Extract average timeseries from ROIs specified by pixel masks. % % All arguments are optional parameters. User will be prompted if % unspecified. % % JG 2018 if nargin<1 savefi...
function VAR_sim = estimateVAR(data,settings) % Least-squares VAR estimation % preliminaries n_x = size(data,2); T = size(data,1); % select lag length if settings.select_VAR_simlaglength == 1 p = selectlag_IC(data,settings.max_simlaglength,settings.penalty); elseif settings.select_VAR_simlaglength == 0 p =...
function all_feats = getCNNFeature_img_gpu(im, all_boxes, net) all_feats = []; nCandidates = size(all_boxes,1); imGlobal_ = single(im) ; % note: 255 range im_w = size(im ,2); im_h = size(im ,1); p = 0; batchSize = 512; numBatches = ceil(nCandidates/batchSize); for k = 1:numBatches cur_batchSize = min(nC...
%% PDE Simulation Tester %{ Author: Avishai Halev Advisor: Nancy Rodriguez-Bunn Last modified: Keshav Patel Date modified: 09/04/2018 This file runs the "continuumSimulation.m" file and plots the solution. A movie is saved at completion of the script %} close all clearvars -except oldResult pResult ...
function dodoMain_Reduced_Resolution( im_tag ) % dodoMain_Reduced_Resolution generates low resolution PANchromatic % (PAN) and MultiSpectral (MS) images according to the Wald's protocol for % im_tag image from Pérez-Bueno, F. paper image dataset following the same procedure as % Vivone, G. paper. % % Input arguments: ...
%% Aligned-Face Recognition Poject: %% MATLAB initializations: clc clear all close all %% Add paths of functions: addpath('functions_ASM'); addpath('functions_CLNF/demo'); addpath('functions_warp'); addpath('functions_LDA'); addpath('functions_preprocessing'); %% Ask user about some settings: do_crop_aligned_dataset...
function [] = xeno_canto() % dataDir = './data/xeno_canto/'; dataDir = '/Volumes/ALEX/data/xeno_canto/'; species = { 'Ring-billed+gull', 'Great+egret' 'Common+yellowthroat', 'Red-winged+blackbird', 'Ruddy+duck', 'Double-crested+cormorant', 'Mallard', 'Mute+swan', 'House+finch', ...
% linear programming (CPLEX) implementation for evaluating WFW. % % Author : Chen SONG % Created : 2019 % Description : Run LP (CPLEX) to check the feasibility of each desired % wrench inside the given set function inWorkspace = wrench_feasible_linear_programming_CPLEX(desired_wrench_set,dynamics) ...
function filtered = myMeanLPF(image,radius) filter_size = 2 * radius + 1; kernel = ones(filter_size,filter_size,filter_size) / (filter_size ^ 3); filtered = imfilter3d(image,kernel); end
% RES = RMSE(ACTUAL, EXPECTED) % % Root Mean Squared Error % % ACTUAL - acctual value % PREDICTED - predicted value % RES - Root Mean Squared Error, if error occurrs it's set to -1 function res = rmse(actual, expected) if( length(actual)~=length(expected) ), disp('ERROR! Actual and Predicted need to be equal...
%Plot the DIFFERENCE between conditions % %important - setup so that taskY - taskX. %Thus if taskX is the 'good' condition (RH, Free vision) %And taskY is 'bad' (LH, Per vision) %Then taskY - taskX = how bad is the 'impairment' %i.e. higher positive score shows greater impairment %e.g. for Per - Free, higher positive ...
%% Electomagnetic Fields: Electrostatic problem (Integral and MoM) % "a" sugarú huzalból "R" sugarú kört hajlítunk (a<<R). % A kör síkjában, annak középpontjától "h" távolságban % egy "Q" nagyságú ponttöltés áll, levegöben. A huzal össztöltése zérus. % Írjanak Matlab függvényt, amely a momentum módszerrel kiszámítja a ...
function [ output_args ] = imzmlJSON(fp,fn,varargin) %imzmlJSON - create a JSON file for any imzML file so that it can be %uploaded to the METASPACE engine using the batch functionality. % Get the stuff from the input arguments [opts] = readArgsData(varargin); % Now we can print out the JSON file... [json] = jsonPart...
function [p_delta,values]=deltaDistribution(delta_value,values) p_delta=zeros(size(values)); p_delta(values==delta_value)=1; end
clear; constants; ang = deg2rad([-10 -100 -100]'); [~, pos, ~] = FK3links(ang,"R",robot); fullMatOld = pos; newAngles = IK3links(fullMatOld,"R",robot); rad2deg(newAngles) fullMatOld for curAngles=newAngles % rad2deg(curAngles) [~, pos, ~] = FK3links(curAngles,"R",robot); fullMatNew = roundn(pos - fullMatO...
function [pd,keynodes] = getKeyPd(recon,type) A = recon.A; subs = recon.subs; soma = find(sum(A,2)==0); % regular = A==1; junction = find(sum(A)>1); tip=find(sum(A,1)==0); keynodes = unique([soma,junction,tip]); if nargin<2 | isempty(type) pd = pdist(subs(keynodes,:)); elseif type=='geo' % geo dist G = grap...
% rotate p about a point o in 2D by angle da % % p = [x y 1; x y 1; x y 1 ...] function rotp = rotateAroundPoint(p, o, da) removeCol = false; if size(p, 2) == 2 p(:,3) = 1; removeCol = true; end if size(o, 2) == 2 o(3) = 0; end matrix = vrrotvec2mat([0 0 1 da]); rotp = bsxfun(@plus,matrix*bsxfun(@minus,p...
function [ count ] = faceTest(k ) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here test = load('testset.mat'); testset = test.testset; [V_hat, xbar, alpha] = faceRecognition(k); z = testset-repmat(xbar, [1, size(testset,2)]); l = size(alpha,2); %disp(size(alpha)); count = ...
%Cèl·lules vermelles clc; I = imread('normal-blood1.jpg'); BW = rgb2gray(I); %imshow(BW); B = BW < 180; %figure;imshow(B); F = imfill(B,'holes'); %figure;imshow(F); [sX sY] = size(B); M = zeros(size(B)); M(:,1) = 1; M(1,:) = 1; M(:,sY) = 1; M(sX,:) = 1; M = logical(M); IR = imreconstruct(M, F); %figure; imshow(IR);...
% ------------------------------------------------------------------- % Generated by MATLAB on 11-Oct-2017 18:19:12 % MATLAB version: 9.2.0.556344 (R2017a) % ------------------------------------------------------------------- clear all; close all; clc; functionData = LoadFunctionData(); SIZE_VARIABLE = 3; CONSTANT_...
function vals = depack_cellofcells(values) vals = cell(1,length(values)); for i = 1:length(values) vals{i} = values{i}{1}; end end
%% Range of movement of Spine in Lateral Box Transfer % Code AUTHOR: Yaiza Benito Molpeceres. DATE: January-May 2020. % Adapted to Octave by Guillermo Asín Prieto % Exoskeleton trials segmentation: 54, 55, 56, 62. % Five phases shown in figure 1: % 1: Subject picks up the box in the sagittal plane (idxO1:idxF1) ...
function [ indexes ] = intersectspheres( p1, p2, c, r ) %INTERSECTSPHERES пересечение луча со сферами % Функция возвращает индексы в массивах c, r для сфер имеющих пересечение % с лучом заданным точками p1, p2 % p1 - точка начала луча % p2 - вторая точка луча % c - центры сфер % r - радиусы сфер % index...
function [simaverage, simerror, simratio] = mctaskmelt(data, prob, uncert, meltdata, Liquid_mass, T, P, binedges, nbins) samplerows=size(data,1); sdata=NaN(samplerows,size(data,2)); i=1; while i<samplerows % select weighted sample of data r=rand(length(prob),1); tempdata=data(prob>r,:); if i+size...
function [child_net,Flag] = func_check(child_net) % to check the #input<=Kmax; if not, remove some inputs % child_net: 1 x (ngenes*ngenes) % to improve: just need to check the part around "cut_point" global num_gene; global Kmax; Flag = 0; % =1 means there are some #input > Kmax for i=1:num_gene input = ch...
%% * Transceiver % diode k-parameter k2 = 0.0034; k4 = 0.3829; % antenna resistance resistance = 50; % scale ratio of SMF alpha = 2; % coefficients on current terms beta2 = k2 * resistance; beta4 = k4 * resistance ^ 2; % number of transmit and receive antennas nTxs = 1; nRxs = 1; % number of users nUsers = 1; % average...
clear;clc; %%% define the parameters K =10; N = 1; sigma1 = 0.3; sigma2 = 0.25; phi = 0; TruePosition = [-0.3;0.5]; theta = 2*pi/K; landmark = [cos(((1:K)-1)*theta);sin(((1:K)-1)*theta)]; distance = sqrt((landmark(1,:)-TruePosition(1)).*(landmark(1,:)-TruePosition(1))+(landmark(2,:)-TruePosition(2)).*(landmark(2,:)-Tru...
% Data files database_files = {'data/Phil_Image_Short_bw_100ms_cut.csv', 'data/Phil_Image_Long_bw_100ms_cut.csv', 'data/Phil_Moving_Short_bw_100ms_cut.csv', 'data/Phil_Moving_Long_bw_100ms_cut.csv'}; testset1_files = {'data/Yellow_Image_Short_bw_100ms_cut.csv', 'data/Yellow_Image_Long_bw_100ms_cut.csv', 'data/Yellow_Mo...
function [z,dz,pe,rhoe] = fmodlvls(p,sfctemp,atm) % Model height and pressure levels %% Levels, pressure n = 1000; % # of levels h = 15000; % height m z = linspace(0,h,n)'; % levels m dz = z(2)-z(1); % m [pe,rhoe] = fpres(p,sfctemp,z,atm); % pressure profile end
function S = combineSpikeTrains(SpikeTimesCell_1T, SpikeTimesCell_2T); sizeNew = max(size(SpikeTimesCell_1T)) + max(size(SpikeTimesCell_2T)); for i = 1:sizeNew if i <= max(size(SpikeTimesCell_1T)) S{i} = SpikeTimesCell_1T{i}; else S{i} = SpikeTimesCell_2T{i - ma...
function [A,b] = upperTriangularPP(A,b) [m,~] = size(A); for i = 1:m-1 for j = i+1:m [~,k] = max(A(j:m,i)); k = j+k-1; %zamenjuj j-tu vrstu sa k-tom vrstom temp = A(j,:); A(j, :) = A(k,:); A(k,:) = temp; tmp = b(j); b(j) = b(k); b(k) = tmp; ...
% Non-linear transfer function function result = phi( x ) result = (2 ./ (1 + exp(-x)) ) - 1; end
% function result = membrane_current_constant(params, rho, V) % % Molecular flow across membrane for constant current. % Note need to be cautious using this as large currents can cause % unphysical (i.e. negative) concentrations. % % Inputs % params -> state of system % params.membrane_J ...
% transformSig4noisy.m % % transformSig4noisy(base_sig, candidate_sig, noisy, T, pk_base,pk_cand) % for ECG signals % This functions transforms noisy to base_sig. The reference % signal, base_sig and candidate_sig, are verified for each window % within RR peaks. The size of noisy and T are equated to th...
function [ I1, I2 ] = genSquareTest(S1,S2,t1,t2,ang1,ang2) % Generates a pair of binary images that are square phantoms of % specified size, XY rotation, and translation from the image center. % % Input % -------------------- % S1,S2 Length of the squares in pixels. % t1,t2 1x2 v...
%% Setup Drone m = 0.2 I = [[0.1,0,0];[0,0.1,0];[0,0,0.08]] % sample time ts = 0.01 % Initial States (Initial XYZ is generated by XYZsignal script) Euler_0 = [0;0;0] % XYZ_0 should not be [0;0;0] because the initial target point is set to % [0;0;0] XYZ_0 = [1;2;0] body_rate_0 = [0;0;0] % Set surround rate (if 0: fo...
# Author: Valentin Andrei # E-Mail: am_valentin@yahoo.com function [flat_S, v_f, v_t] = get_speech_spectrogram (x, FS) % Usage: S = get_speech_spectrogram(x, FS) % % Input: % % x - Input Signal % FS - Sampling Frequency % % Output: % % flat_S - Spectrogram as a column vector debug...
function [x] = ifft3(X) %IFFT3 Summary of this function goes here % Detailed explanation goes here x = ifft(ifft(ifft(X, [], 3), [], 2), [], 1); end
classdef DicomImageLoadSpecification < ether.process.LoadSpecification %DICOMIMAGELOADSPECIFICATION Summary of this class goes here % Detailed explanation goes here properties patient = []; end properties(Access=private) overrideMap; end methods %-------------------------------------------------------...
% Follow this Wikipedia page for model equations: % https://en.wikipedia.org/wiki/Kalman_filter#Example_application.2C_technical % State vector definition: x_k = [p_k; v_k], i.e. position and velocity. % Evolution of state vector: x_k = F*x_km1 + G*a_k, a_k is random accel. % This is the same as: x_k = F*x_km1 + w_...
clear all outpath = 'C:\Users\jaker\Pictures\Oregon_Eclipse\code\matlab\out'; dirname = 'C:\Users\jaker\Pictures\Oregon_Eclipse\16bit\png'; offsets = load(fullfile(outpath,'offsets.mat')); etimes = exposure_times(); % Get the two test images fi = 16; img_nums = [fi,fi+1]; fnames = get_files(dirname,'png'); cli_header(...
% Normalization of 2d-pts % Inputs: % x1s = 2d points % Outputs: % nxs = normalized points % T = normalization matrix function [nxs, T] = normalizePoints2d(x1s) xy_centroid = [mean(x1s(1,:)); mean(x1s(2,:)); 1]; % First shift the point to the origin shifted_xy = x1s - xy_centroid; d...
function tree_output = kd_buildtree(X,plot_stuff,parent_number,split_dimension) % pramod vemulapalli 02/08/2010 % inspired by the work done by Jan Nunnink, 2003. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % INPUTS % X --- contains the data (nxd) matrix , where n is ...
function dnaseq = protein2dnaOptimized(protseq) % Input a protein sequence (using three letter abbreviations, no spaces e.g. MetArgLeu)and returns the corresponding % DNA sequence (in the case of degenerate codons, a random codon is chosen). protseq=upper(protseq); codonTable=readtable('codons.csv'); codonArray=upper(...
classdef PCATransform < ATransform % Pricipal Component Analysis transform class properties %The different components U = []; m = []; %How many components are used (-1 means calculate the elbow of eigenvalues) degree = -1; elbow = []; threshold = 0;...
function statsLDADraw(~,~,fig,window) %statsLDADraw - draw the plots from LDA % Guidata sts = guidata(fig.fig); % Determine the components... try cs = [get(window.comp1,'Value') get(window.comp2,'Value')]; catch cs = [1 2]; end % Plot the ellipses? try doEllipse = get(window.ellipse,'Value'); catch d...
function p = objective(A, b, lambda, cum_part, x, z) obj = 0; start_ind = 1; for i = 1:length(cum_part), sel = start_ind:cum_part(i); obj = obj + norm(z(sel)); start_ind = cum_part(i) + 1; end p = ( 1/2*sum((A*x - b).^2) + lambda*obj ); end
function elt = quad2d_elt() % function elt = quad2d_elt() % % Returns the quadratic 2-D (6-point) element data structure nvars = [1;1;1;1;1;1]; flist = [1 0 0; 2 0 0; 3 0 0; 1 2 0; 1 3 0; 2 3 0]; vnodes = [0 0; 1 0; 0 1; 1/2 0; ...
function [AA,BB,Ts,Ti,ks,err_of_BDCSD_A,err_of_BDCSD_B,flag] = bdcsd(A,B,tol,for_sd_ds) %BDCSD Block Diagonal Controllable Structural Decomposition % % [At,Bt,Ts,Ti,ks] = bdcsd(A,B) % % transforms a controllable pair (A,B) into the block diagonal % controllable structural decomposition form. % % ...
function [natureArray] = JuliaSetPoints(complexArray,c,cutOff) %This function determines if each point in grid value is associated with %specified complex value c and is a member of julia set. It returns a 2D %array where it had evaluated each grid point and grid points which are in %Julia set have a value of 0 whi...
% % LAB4 Ex.1 function xk = dfs2(xn,n,k) len = length(xn); Xn(1:len) = 1:len; xk = Xn*exp(-j*pi/k(end)).^n'*k; end
% function bplt(x,y,u,ux,uy,uz,Tm,visc,cname,bgtname,bgt) if(strcmp(cname,'sww')) casename = 'Smooth Wavy Wall'; elseif(strcmp(cname,'rww')) casename = 'Rough Wavy Wall'; end if(strcmp(bgt,'rs')) s = 1/(Tm); ttl = ['$$\frac{\eta_{ij}}{u_\tau^2}$$']; else s = 1/(Tm*Tm/visc); ttl = ['$$\frac{\dot{\eta_{ij}}}{u_\t...
close all; clear all; clc; disp('7.Q1'); q1 = rand(3,10); Htrue = [10 0 -1; 1 10 20; .01 0 3]; q2 = Htrue * q1; q1 = normalize2D(homogenize2D(q1)); q2 = normalize2D(homogenize2D(q2)); Hest = computeHomography(q1, q2); q2est = Hest * q1; %s = q2(1,1)/q2est(1,1); %q2est = q2est * s; q2est(1,:) = q2est(1,:) ./ q2est(...
%% Artificial Neural Networks and other Learning Systems - Lab 2 %% 1. Introduction % % In this lab we use Radial Basis Functions (RBF) to approximate some simple % functions of one variable. Suppose we have the function $f: R % \to R$. RBF introduces a hidden layer such that $\hat{f}: % R \to R^n \to R$, where $n$...
function dx = KTmodel_E(tt,x) %UNTITLED Summary of this function goes here % Detailed explanation goes here % global k t r s ke te k = 0.335; t = 23.348; % k=3*10^(-6)*v^2+0.032*v+0.0001; % t=13.192*v^2-313.67*v+2049.9; r = -0.603; s = 0.157; ke = 1; te = 0.69; dx = zeros(4,1); dx(1) = x(2); dx(2) = (k/t)*(x(3)+r)...
function [Wl,Wr,G,Xlr,fval] = MTML_imputation_fs(y,Xl,Xr_bar,lambda1,lambda2,lambda3,lambda4,coords,G_init,maxiter,toler) %solving MTMLa with regional variable imputation %input: % y: cell of n*1 vector; Xl: cell of n*dl matrix, Xr_bar: r*dr matrix, % Xlr: cell of n*dr matrix, lambda1:hyperparamet...
function [sys,x0,str,ts] = sfunsinda(t,x,u,flag,sindafile) %function [sys,x0,str,ts] = sfunsinda(t,x,u,flag) persistent FirstCall % Determine if it is the beginning of the simulation if (flag == 0) & isempty(FirstCall) FirstCall = 1; elseif flag == 9 FirstCall=[]; else FirstCall=0; end % % Original File i...