text
stringlengths
8
6.12M
%% %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; moving = 0; %% %sudo ln -...
% CustomFactors holds custom solver factor creation associations % for those solvers that allow it through an appropriate 'customFactors' % option. % % Custom factors must be implemented as a Java subtype of the appropriate % solver class and/or interface for that type of solver. % % For example, if you have implemente...
classdef AbstractSolver < ether.optim.Solver %ABSTRACTSOLVER Summary of this class goes here % Detailed explanation goes here properties(Constant,Access=private) logger = ether.log4m.Logger.getLogger('ether.optim.AbstractSolver'); end methods %--------------------------------------------------------------...
function plot_phasediagram() % plot_phasediagram % % Plot all the phasediagrams contained in the *.mat files in this folder. % % Developed by GeoModelling Solutions GmbH % % Original author: Dani Schmid % Last committed: $Revision: 0 $ % Last changed by: $Author: karthik $ % Last changed date: $Dat...
function [bestnfac,bestper,allper] = loo_npls(X,Y,nfactors) %% Parameters bestper = 0; bestnfac = []; allper =[]; Xdim = size(X); Ydim = size(Y); Nf = 5; %% unfold pls YP = cell(nfactors,1); indices = crossvalind('Kfold', Xdim(1), Nf); for i = 1:Nf test = (indices == i); train = ~test; [Xfactors,Y...
function school_by_year_show(saveFigures, setNo) % Show stats for schooling by year % --------------------------------------- cS = const_cpsearn(setNo); ny = length(cS.yearV); % Stats: school by year for a particular age range [avgSchoolV, fracM] = aggr_cpsearn.school_by_year(setNo); output_cpsearn.fig_new(saveFigur...
clear variables; clc; load('data.mat'); global mu mu = 398600e+9; %gravitational constant %% %orbital elemets %% global orbit_vec orbit_vec.Re = 6371*1000; %earth radius orbit_vec.h = 400*1000; %height above sea level orbit_vec.sma = orbit_vec.h+orbit_vec.Re; %semimajor axis orbit_v...
function [fullP, fullMeanDemands, curProcID, visited, currentClass, classMatch,SEFFcalls_proc,SEFFcalls_act,SEFF,numActs] = ... readXML_CMCQNCS_addEntriesP_SEFF(... actGraph, processors, tasks, entries, actCalls, actProcs, K,... ...
function varargout = fluidforces(varargin) % F = fluidforces(t,freq, swimvecx,swimvecy, xm,ym,fxmtot,fymtot, xl,yl,fxltot,fyltot, ... % xr,yr,fxrtot,fyrtot) % or % [Flateralt,Flateraln,Faxialt,Faxialn] = fluidforces(...) % % Options: % 'nregions' - Number of regions along the body in which force will be % int...
clear all; close all; load('parameters.mat'); addpath(code_path); %---input--- idiag = 1212; zdiag = 5; font_size = 15; fig_position = [50, 50, 1200, 500]; l_max = 30; m_max = 20; %----------- build_grid_2d; data_file = fullfile('data', ['dat', sprintf('%4.4d', idiag)]); load(data_file); phi_before = Tref * squee...
% Door gambling task - Cue Splitting 09/01/2018 % matching trial count across regolar or special conditions % EEG = pop_select(EEG, 'trial', randsample(1:size(EEG.data,3), numTrials)) % all 26 subjects (including low redoers) - to correlate type effect vs redo rate clc clear p...
% This script design the perameters for flume experiments. clc clear all % The plate is fixed which amounted to the wave flume. % Different water depth means different submergence. DOCK_LENGTH = 1.00; DOCK_ANGLES = 0; DOCK_SUBMER = [-0.10 -0.05 0.00 0.05 0.10]; % PL is for Plate Length. % PI is for Plate Inclination...
function [energyMatrix] = computeEnergy(height, width, matrix) energyMatrix = zeros(height, width); for i = 1:height for j = 1:width energyMatrix(i, j) = matrix(i, j); if i ~= 1 if j == 1 if energyMatrix(i-1, j) < energyMatrix(i-1, j+1) energ...
function Model = AdaptiveHistogramTrain(X,options) %function Model = AdaptiveHistogram(X,options); % % given N, D-dimensional samples X, size(X) == [D,N] : % for each dimension d, select a set of k - 1 thresholds such that the points % of X projected into d fall into the k bins in approximately the same number ea...
function K = rbf_kernel(X, Y, gamma) % Compute the rbf (Gaussian) kernel between X and Y: % % K(x, y) = exp(-gamma * (x-y).^2) % % for each pair of rows x in X and y in Y. % % Inputs: % - X: Shape: n_samples_X * n_features. % - Y: Shape: n_samples_Y * n_features. % - gamma: Kernel parameter. Defaults to 1/n_features. E...
function spc_makeRoiA(i) global spc global gui i=i+1; figure(gui.spc.figure.project); waitforbuttonpress; figure(gcf); point1 = get(gca,'CurrentPoint'); % button down detected finalRect = rbbox; % return figure units point2 = get(gca,'CurrentPoint'); % button up detected point1 = point1(1,1:2...
function P2=makestimAREVCOR(P) % MakestimARevcor - stimulus generator for ARevcor stimGUI % P=MakestimARevcor(P), where P is returned by GUIval, generates the stimulus % specified in P. MakestimARevcor is typically called by StimGuiAction when % the user pushes the Check, Play or PlayRec button. % MakestimA...
% SamplingDataTrainPCA.m % 2015/10/20 % ランダムにサンプリングしたデータ(DataSampling)に % trainPCAをかける clear all; clc; tic; sample = 200; half = sample / 2; num_om = half; num_hm = half; % データの読み込み FileName = 'SamplingData/%d/samplingdata_%d_%d.xls'; IndexSize = 5621; dim = 3; SampleData = zeros(sample,IndexSize*3); for cnt = 1...
% script to plot rejection results tolerance2 = csvread('mhn10000t2'); tolerance5 = csvread('mhn10000t5'); tolerance7 = csvread('mhn10000t7'); tolerance10 = csvread('mhn10000t10'); colors = brewermap(4,'set1'); tolerances = {'\epsilon = 2.5','\epsilon = 5.0','\epsilon = 7.5','\epsilon = 10.0'}; ar = {'AR = 0.2%','AR ...
function [vel_p] = chi_generate_vel_pitot(basedir) %% [vel_p] = chi_generate_vel_piitot(basedir) % % This function generates an input file for chi-processing vel_p.mat % directory input % % Input % basedir : unit base directory % % Output % vel_p.time : tim...
function out = mloads(jstr, varargin) % out = mdumps(obj, ['compress']) % function that takes a matlab object (cell array, struct, vector) and converts it into json. % It also creates a "sister" json object that describes the type and dimension of the "leaf" elements. if isempty(jstr) out = {}; ...
clear all hold off t = load("../../../Tree.m"); s = t(:,1); n = t(:,2:7); border = 0.4; minVal = min(min(n))- border; maxVal = max(max(n))+ border; camup([0 1 0]) grid on pbaspect([1 1 1]) rotate3d on axis([minVal, maxVal, minVal, maxVal, minVal, maxVal]) xlabel('X') ylabel('Y') zlabel('Z') hold on len = size(t,1...
function [lsRedShock, lsRedParam] = chkredundant(this, varargin) % chkredundant Check for redundant shocks and/or parameters. % % % Syntax % ======= % % [redShocks, redParams] = chkredundant(m) % % % Input arguments % ================ % % * `m` [ model ] - Model object. % % % Output arguments % ================= %...
% created by wykys 2016 function [ str_hod ] = stredni_hod_fce( matice ) % funkce spočítá střední hodnotu, jako vstup jí slouží výstupní matice z % funkce matice_dat str_hod = sum( matice(:,1) .* matice(:,2) ); end
%% Define Red Pitaya as TCP/IP object IP= ''; % Input IP of your Red Pitaya... port = 5000; tcpipObj=tcpip(IP, port); %% Open connection with your Red Pitaya fopen(tcpipObj); tcpipObj.Terminator = 'CR/LF'; fprintf(tcpipObj,'SPI:INIT:DEV "/dev/spidev1.0"'); fprintf(tcpipObj,'SPI:SET:DEF'); % set ...
function unsteadyP1(Nh, Nd) % import time-step global t; % import all the necessary functions of the variational problem global coefficient_functions; % import geometric entities of the domain global triangles; global nodes; % initialise the linear system global M; M = zeros...
% Set params of the detection cameras = {17, 18, 19, 40, 50, 53, 54, 56, 57, 58, 59, 60}; homography_directory = '~/mct-bqp/data/hda/homographies'; hdaRootDirectory = '/media/pedro/mct/HDA_Dataset_V1.3'; num_cams = length(cameras); detections = cell(num_cams,1); detections_ocl = cell(num_cams,1); % NOTE We have all occ...
function [newcoor, newsymbol, newcharge, newtypes, newbound, newPair] = resortXYZ(coor, symbol, charge, types, bound, Pair, first, radii); %This function is to resort the atoms according to the neighbor list %The atoms are located based on the sequence in the neighbor list. %INPUT: %coor (N*3) -- atomic coordinate; %r...
% p0=load('PCC-Point0-des.dat'); p1=load('PCC-Point1-des.dat'); p2=load('PCC-Point2-des.dat'); N=50; t=[0:N-1]; nss=8; hp1=plot(t,p0(1:N),'-<',t,p1(1:N),'-o',t,p2(1:N),'-s',2.8284*ones(1,nss),linspace(0,1,nss),'--.'); grid %grid minor hl1=legend('Analysis region 0','Analysis region 1','Analysis region 2','Measure er...
function [ d1, d2 ] = convert_zone_to_trials( data,varargin ) % CONVERT_ZONE_TO_TRIALS shuggles data matrix such that all all % combinations of recordings are paired with each other as a trial, e.g. % Sps you have 4 recordings, a,b,c,d to compute coherence between whole % group, find all 4 choose 2 combinations of a-d...
function [chk, wa, wb, wc] = get_weights(x, y, x1, y1, x2, y2, x3, y3) % Checks whether (x, y) are in the triangle based on the 3 vertices 1, % 2, and 3, and returns the linear combination weight as wa, wb, and wc. x1 = repmat(x1, size(x,1), size(x,2)); y1 = repmat(y1, size(x,1), size(x,2)); x2 = repmat(x2,...
clc clear all I1 = (imread('/Users/INNOCENTBOY/Downloads/videos/Imageprocessing/week4/motion1.jpg')); bpp=class(I1); I1= double(I1); %% Negative Image I2 = 255-I1; %% Logarithmic c = 1; I3 = c*log(I1+1); %% Power Law c1= 1; Lamda = 0.5; I4 = c1*(I1.^Lamda); Lamda = 1/Lamda; I5 = c1*(I4.^Lamda); %% Contrast stretchi...
function loopThroughFigs(list) if (nargin < 1) || isempty(list) list = sort( get(0, 'children')' ); end currentFigs = get(0, 'children'); tf_validFigs = ismember(list, currentFigs); list( not(tf_validFigs) ) = []; cnt = 0; try while not(isempty(list)) cnt = cnt + 1;...
function [ status ] = readData( fEvt,fSta,fPhase,fVel,origLat,origLon ) run('globalVar.m'); [X0,Y0,F0] = ll2utm(origLat,origLon); vel = load(fVel); velMod = vel(:,1); velMods = velMod/1.73; depthMod = vel(:,2); evtData = load(fEvt); evtID = evtData(:,14); evtLat = evtData(:,7); evtLon = evtData(:,8); evtDep = evtDat...
% Author: Ratana Lim % Created date: 25/04/2018 function x=limitchk(x,up,low,nbus,loadbusLocation) for ii=1:numel(x) if x(ii)<low x(ii)=low; elseif x(ii)>up x(ii)=up; end end %% volateg constraint check % busdata = busdatas(nbus); % load the bus data % linedata=linedatas(nbus); % load the line data % %...
close all; clear all; clc; % load('LinearSeparable.mat','X','Y'); %X: D*N; Y: 1*N load('NonLinearSeparable.mat','X','Y'); %X: D*N; Y: 1*N %generate data % N = length(Y); %number of samples % D = length(X(:,1)); %dimension of features [D,N] = size(X); % %find the positive and negative data % posIdx = find(Y==1)...
f =@(x) (x.^2-1+exp(-x)); x = 0.5:0.2:1; y = f(x); hold on; plot(x, y); %Algoritmo per il metodo di Bisezione a = 0.5; b = 1; toll = 1e-8; fa = f(a); n = -1; n_max = 100; amp = toll+1; while amp >= toll && n < n_max n = n+1; amp = abs(b-a) c = a + (amp/2); fc = f(c); if fc*fa <...
function cmd_out = force_mode_tcp(obj,varargin) %% enable force mode % varargin = tare_trigger,DoF,wrench,cmd % arg1: tare_trigger: 1-zero the sensor before start 0-don't zero the sensor before start % arg2: DoF: 6-by-1 boolean vector, 1-compliant dof, 0-rigid dof % arg3: wrench: 6-by-1 force/torque vector t...
function [] = accuracy(n) equips = ["psv","acmilan","liverpool","chelsea","barcelona","madrid","juventus","none"]; [x,y] = size(equips); CONF = zeros(y,y); for equip = equips(1:end-1) N=size(dir([char(equip) '/*.jpg']),1); images = randperm(N,n); id_equip = getIds(equips,equip);...
function [XC, Exc] = eval_Xalpha_XC_with_phi(natom, nbf, phi, ipw, D) % Evaluate XC matrix using Xalpha functional and phi % Input parameters: % nbf : Total number of basis functions % phi : Values of basis function at integral points % ipw : Integral point weights % D : Density matrix % Output parameter: % ...
%选择操作函数 %输入: %Chrom 种群 %FitnV 适应度值 %GGAP 选择概率 %输出: %SelCh 被选择的个体 function SelCh=Select(Chrom,FitnV,GGAP) NIND=size(Chrom,1); NSel=max(floor(NIND*GGAP+.5),2); ChrIx=Sus(FitnV,NSel); SelCh=Chrom(ChrIx,:);
clear all; clc % Clearing Matlab desktop vid=videoinput('winvideo',1,'YUY2_640x480'); % Defining the video input object %set(vid,'FramesPerTrigger',1); % Setting frames per trigger % preview(vid); %////// Showing the video of the moving Ball(TO BE USED % % WHILE TESTING) % pause(10);% Waiting for a certain time for t...
function [cdata] = coarser(olat,olon,odata,clat,clon) % COARSER Interpolation of model data onto coarser resolution % function [cdata] = coarser(olat,olon,odata,clat,clon) % where olat/olon are the finer original resolution lats/lons, % odata is the original data [lat,lon,time], and clat/clon are % ...
%% Focal fields - TEM00 Gaussian Mode % This script calculates the field of a TEM00 Gaussian Mode in the focus of % a microscope objective with a given NA. The formula used here was % taken from "Novotny, L. and Hecht, B. (2006); Principles of Nano-Optics". % % © Jens Brauer, 2016 %% Constants lambda = 800; % Wa...
function operation_button_payoffinfo(hObject, eventdata, handles) % 子界面的作图画Payoff % 吴云峰 20170331 global OPTSTRUCTURE_INSTANCE; global QMS_INSTANCE; opt_entrustinfo_ = get(handles.asset.table_optopensel, 'Data'); % 更新数据 curr_biaodi_px = nan; portfolio_T_idx = []; portfolio_K_idx = []; portf...
function eye = quick_correlation(eye, filterOn, filterOff, amplitudeScale, slidingWindowWidth, corrBufferScale) % apply sliding window on eventstream and store correlation results in % substructure allTimestamps = eye.ts; allActivityOn = eye.activityOn; allActivityOff = eye.activityOff; len = length(allTimestamps); ey...
function [x y]=fRK4b(n,a,b,x,y) f=@(x,y)exp(-x)-x.*exp(-x); %Figura 9.4 (a) (b) h=(b-a)/n; % espacamento em x for k=1:n K1f=f(x(k), y(k) ); K2f=f(x(k)+0.5*h,y(k)+0.5*h*K1f); K3f=f(x(k)+0.5*h,y(k)+0.5*h*K2f); K4f=f(x(k)+h, y(k)+ h*K3f); x(k+1)=x(k)+h; y(k+1)=y(k)+...
clc filepath = '/mnt/NetDisks/Xinyi_Server/A-PET/experimental data/03-15-2020 point_source_3d/4x4x4'; filepath = 'D:\APET_DATA\03-15-2020 point_source_3d\4x4x4'; filepath = '/media/xinyi/LABDESK_2TB/APET/APET_DATA/'; filepath = '/media/xinyi/LABDESK_2TB/APET/APET_DATA/02-19-2020 ultramicro phantom/ultramicro_high_activ...
function tick2text(varargin) %TICK2TEXT Changes tick labels to text objects % % tick2text % tick2text(ax) % tick2text(ax, param1, val1, ...) % % This function creates text objects that mimic x, y, and z tick labels, % while the original tick labels are removed. The text object format % allows more modification (such a...
function [ projDist_dir, projDist_pos ] = projectionDistance( P, dataType, options ) %function [ projDist_dir, projDist_pos ] = projectionDistance( xA, mask, options ) % determines the distance between projections in high D space fracVar2capture = .95; %% parse options struct if ~isempty(options) && isfield(options, '...
function [s, id] = get_scores_from_file % % loads score matrix and plots info % s = load('scorematrix.txt', '-ascii'); id = load('id.txt', '-ascii'); % [np, nt] = size(s); % nid = max(id); % entries = (1:np); % % fprintf('Size of score matrix: %u x %u\n', np, ...
classdef NetworkAether < hgsetget %NETWORKAETHER A virtual space that connects neurons and transmits signals between them. % % This object acts as a virtual "wiring" that connects neurons to one another, performing functions similar to an % axon. On its own, a single aether object connects only two...
function [centre radius] = calc_circle(pt1, pt2, pt3) delta_a = pt2 - pt1; delta_b = pt3 - pt2; ax_is_0 = abs(delta_a(1)) <= 0.000000001; bx_is_0 = abs(delta_b(1)) <= 0.000000001; % check whether both lines are vertical - collinear if (ax_is_0 && bx_is_0) centre = [0 0]; radius = -1; return ...
function Points = EllipticCurvePointsModp3Mod4(a, b, p) % Points = EllipticCurvePointsModp3Mod4(a, b, p) % Input: Two integers a, b, and a prime p > 3. It is assumed that 4a^3 + % 27b^2 is nonzero, so that the associated elliptic curve % y^2 = x^3 + ax + b %is nonsingular. % Output: Points, a 2 column vector...
%-----------------------------Script for brain tumor segmentation--------------------% close all clear all %datadir = '../experiments/data/Brain_tumor' datadir = '/home/haltair/Research/vision/experiments/data/Brain_tumor'; %resultsdir = '../experiments/results/Brain_tumor' resultsdir = '../results/bts'; ERR = 10^...
% calculate vortex motion until mean power stabilizes function PP = vort_stable(N, w, mu, BH, BD) PPo=-1; Phi0=0; j=0; while(1) j=j+1; [Phi, P] = vort_period(N, w, mu, BH, BD, Phi0); Phi0=Phi(end); PP=mean(P); if (abs(PP-PPo)/PP<1e-5) break; end PPo=PP; if j>=100 printf('Warnin...
function runData = extract_signal_runs(folderName,loadStateCodeStr,params_loading,Data_inspection) %EXTRACT_RUNS global verbose % File Processing subSessionFolders = dir([folderName filesep '*.gdf']); nFile = numel(subSessionFolders); if nargin == 3 Data_inspection = false; end %% Extract signal from runs j = ...
function stats = glm(y,factor,model,iscateg,facnames,varnames) % function P = glm(y,factor,model,[iscateg,facnames,varnames]) % % General linear model. Performs AN(C)OVA/MAN(C)OVA calculations. This is % a general regression model to determine the effect on y of the independent % variables in factor. They may be ca...
function [X,L] = FastSolver(y,A,alpha,a1,a2) global_max_iter=100; lasso_max_iter=100; % Initialization and setting M=size(y,1); N=size(A,2); X=zeros(N,1); L=zeros(M,1); Z=ones(M,1); AT=A'; ATA =AT*A; tau=eigs(ATA,1); tauInv =1/tau; beta=(20*M)/sum(sum(abs(y))); % betaInv=1./beta ; % betaTauInv=betaInv*tauInv;...
clear; close all; clc; %% Read files X = dlmread('features.txt'); Y = dlmread('targets.txt'); V = dlmread('unknown.txt');
%Initial version of a trading tool based in genetic neural network. %% Parameter of the account % broker broker = 'xtb'; % initial deposit initial_deposit = 5000; % comision per lot comision_vol = 0; %% Parameters for the forex currency % symbol symbol = 'EURUSD'; % value of a lot lot_value = 100000; % minimun lot mi...
function numvect = EDB2extrnums(Str,delim) % EDB2extrnums - Extracts the numerical values in a text-string, separated by a given delimiter. % Periods (.) are interpreted as decimal points. % % Input parameters: % Str Text string, [nchars,1]. % delim The delimiter to look for, e.g., comma, space, slas...
function earthplot3D(earthmap, t, r, re, El, e, a, ECI, color) load('earth_constants.mat'); n_sat = length(ECI); set(gcf,'Menubar','default','Name','Orbit Visualization', ... 'NumberTitle','off','Position',[70,10,750,750]); lim=(1+e)*a;%Setting the limits of the graph clf axis([-...
function train_matrix=train_ChainCode () my=dir('C:\Users\HP WIN 8\Desktop\FCI4 term 2\Pattern\Assignment\Pattern Recognition Data Set (0-9)\*.bmp'); s1='C:\Users\HP WIN 8\Desktop\FCI4 term 2\Pattern\Assignment\Pattern Recognition Data Set (0-9)\'; train_matrix=cell(10 ,10); nfiles=length(my); trained=[ ]; ...
%% Prep_MainPara Module % * VAR parameter contains parameter for model setup and results. % * Bootstrap parameter contains parameter regarding bootstrapping for CI. % * Plot parameter contains parameters regarding single or multiple plots. %% %% 1.VAR Parameters Para.p = 4; % V...
function [value, M] = calCri2(A, X, K, I, new, M) % Caculate the criteria value % INPUT % A: the adjacency matrix % X: the membership vector % K: the number of blocks % I: the node to be moved % new: index of the block to which node I is moved % M: the matrix of total edge...
// UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}} // RUN: cd %S // RUN: %clang_cc1 -x objective-c -fmodules -fno-implicit-modules \ // RUN: -fmodule-file-home-is-cwd -fmodule-name=libA -emit-module \ // RUN: -fmodules-embed-all-files %S/Inputs/normal-module-map/module.map \ // RUN: -o %t/mod....
function [ X, vX, aX, tarray ] = cartesian_circ( Pstart, Pend, Pcenter, Rotaxis, righthanded, t, dt, vp ) % Interpolate a circular arc path in cartesian space based on initial and end position % [x,y,z] and orientation angles [theta,phi,psi], rotation center and % axis, and rotation direction % Output: % X = cartes...
function cfg = track_nets(cfg) % Track the functional nets through time global dynanets_default; method_list = cfg.track.method; if isstruct(cfg.track.method) cfg.track.method = {cfg.track.method}; end for m = 1 : length(method_list) cfg.track.method = method_list{m}; track = method_list{m}; for ...
% event parameters lat_range = [-27 -26]; lon_range = [-115 -114]; mag_range = [5 7]; start_time = '2014-09-06 01:00:00'; search_time_range = 10; % in hour % station parameters %station_network = '_GSN'; %station_network = 'TA'; %station_network = '*'; station_network = '_US-ALL,_GSN'; min_epi_dist = 0; ...
clc; clear all; close all; dataset = 'VIPeR'; %dataset = 'PRID'; if strcmp(dataset,'VIPeR') data = load( 'data/VIPeR_split.mat'); n_gallery = 316; n_train = 316; n_test = 316; end if strcmp(dataset,'PRID') data = load( 'data/PRID_split.mat'); n_gallery = 649; n_train = 10...
addpath('/n/home09/jguo/SAM_drymodel/Drycore/'); addpath('/n/home09/jguo/WRFV3.3/stat'); %% set up global variables global cp dx dz fcor ccrit ggr tau taum nr nzm nz rd rout r rm cd ce alpha ztop zsponge z zm zz t t_end dt Nstep cs eddyu eddyv eddyw eddytheta v00 theta00 H ppi00 global eddy_flag sponge_damp diffusion ...
function [sim_basis] = OrthonormalizeBasis(obj) %OrthonormalizeBasis Summary of this function goes here % Detailed explanation goes here [Q,~] = qr(obj.sim_basis,0); sim_basis = Q(:,1:obj.n_sim_basis); end
MNImask = imgload('MNImask'); % [ bounds, bounded_mask ] = mask_bounds( MNImask ); MNImask_boundary = bndry_voxels(logical(MNImask), "full"); %% f = Field(); f.mask = logical(MNImask_boundary); f.xvals = {1:91,1:109,1:91}; plot_voxmf( f ) %% mask = imgload('MNImask'); %% % Create a 3D grid of coordinat...
% closedLoop.m % Constants global ts; center = 0; % Format: {time, visStim} % [Mode, K0, K1, K2] visStim0 = [1, 0, 0, center]; visStimN = [1, 0, -1, center]; LaserOn = '0000'; LaserOff = '0000'; olf1 = '0000'; olf2 = '0000'; histogramBounds = [10 ,70; 70, 130]; trialStructureList = [... {0, v...
function result=fc(t,f0) T=1/f0; result=zeros(1,length(t)); for time_index = 1:length(t) if mod(t(time_index),T)<T/6 result(time_index)=mod(t(time_index),T)/(T/6); else if mod(t(time_index),T)>T/6 && mod(t(time_index),T)<4*T/6 result(time_index)=-mod(t(time_index),T)/(T/6)+2; ...
clear hold on %% D|PID close all clear K = 2652.28; %K= K/23; %Reductora p = 64.986; b2 = 0.5; b= 10; z = 20; Kp = p^2*(2*b+1/z^2)/(b2^2*K);%00.015;%[0.5,2]; taud2 = p/(K*Kp);%0.02;%[0.1,0.5,2,]; %Debe ser >0! taui = b2*z^2*(2*b+1/z^2)/(b*p);%[0.5,2]; taud1 = b2*(b-b2+2)/(p*(2*b+1/z^2)); % SOLO PINTA LAS FIGURAS DISTI...
%Get user inputs for folder %[filename pathname] = uigetfile('*.avi', 'select first movie'); %[tagfile tagpathname] = uigetfile('*.csv', 'select taglist file'); parDir = uigetdir(pwd, 'Choose parent directory'); cd(parDir) dirList = dir('*colPos*'); close all for i = 1:numel(dirList) %for i = 1:2 %% masDi...
%Load Bipolar signals S17=load('S17.mat'); S17=S17.S17; S12=load('S12.mat'); S12=S12.S12; S9=load('S9.mat'); S9=S9.S9; %Load Monopolar signals V17=load('V17.mat'); V17=V17.V17; V12=load('V12.mat'); V12=V12.V12; V9=load('V9.mat'); V9=V9.V9; V6=load('V6.mat'); V6=V6.V6; 'Loaded channels' %Total amount of time s...
% Compare refaced data with ground truth. Calculate L1 and L2 norm. Plot % convergence of training across epochs. Create summary images. dirGroundTruth = fullfile('data','Dataset-defacing5-maskface'); dirGTIm = fullfile(dirGroundTruth,'testA'); dirUnsup = fullfile('generate_images', '20181001-105440-defacing5-maskfac...
% RMHC runs=10; R=50; d=10; T=500; trials=10000; winHitting2=zeros(1,R); for r=1:R for run=1:trials x=RandomBinaryString(d); evals=0; findOpt=0; while (findOpt==0&&evals<=T-2*r) xp=x; mut=randi(d); xp(mut)=1-xp(mut); if SampleGame(xp,r)...
close all;clear all;clc; load hall; img = hall_gray; v = zigzag(img); img1 = uint8(izigzag(v,size(img))); max(max(img-img1)) imshow(img1);
[num, txt, raw] = xlsread('controldata.csv'); accelx = num(1:end,3); accely = num(1:end,4); accelz = num(1:end,5); gyrox = num(1:end,6); gyroy = num(1:end,7); gyroz = num(1:end,8); angleX = rad2deg(atan(y/sqrt(x^2+z^2))); angleY = rad2deg(atan(x/sqrt(y^2+z^2))); compFangX = 0.98 * (angleX + gyrox * dt) + 0.02 * acce...
function [S] = runFSM(nref,x0,varargin) %{ Fast Sweeping algorithm Input- nref - non-negative index of refraction x0 - a 2x1 vector of coordinates of the source point [x,y] varargin : S0 - values of the distance map at the points x0; (default : S0=0); Output- S - optical length on a regular grid copyright 2014 Amit B...
function global_demo1(num) global globalvar if nargin>0 globalvar=num end fprintf('Global variable in function %s is %d\n',... mfilename, globalvar);
%This is a code that computes the %cartoon RTC function in a linear %coupled network, with given coupling %lengths. It also computes all %the partial derivatives on all the %parameters clear all; %LGN kernel time delay T=3; %LGN kernel time parameters alpha=4; beta=1/2; %LGN kernel width sigma=0.3; %Cortical time ...
%------------------------------------------------------------------- % Here's an implementation of the sigmoid function, which you may find useful % in your computation of the costs and the gradients. This inputs a (row or % column) vector (say (z1, z2, z3)) and returns (f(z1), f(z2), f(z3)). function sigm = sigmoid...
function c = guessMult(d, tol) lam1 = max(d); c=0; for i = 1:length(d) if abs(d(i)-lam1)/max(lam1,1) <= tol c=c+1; end end end
clear; close all; clc; smallWorldExample SIZE = 11; C = 4; % graph = GenerateCircularGraph(SIZE, C); graph = A; CalculatePathStatistics(graph) VisualizeGraph(graph);
function s = vocodeFromEnvelopes(fc, envelopes, carrier_type, Fs, rms_level, fl, fu) % generate a vocoded signal based on envelopes % supports two different vocoding strategies: % (1) based on bands of pink noise (carrier_type: pink) % (2) based on pure tones (carrier_type: sine) % % fc: 1 x n vector of centre ...
if (~exist(fullfile('data-striation', 'no-focus1', 'before', 'avg.png'), 'file')) averagePhotos(fullfile('data-striation', 'no-focus1', 'before'), 8); end IB = imread(fullfile('data-striation', 'no-focus1', 'before', '1.jpg')); if (~exist(fullfile('data-striation', 'no-focus1', 'after', 'avg.png'), 'file')...
##Plano de Bits function aux = plano(img,n) aux = img; for i=1:size(img)(1) for j=1:size(img)(2) if(bitand(aux(i,j),2**n)>0) aux(i,j) = 255; else aux(i,j) = 0; endif endfor endfor endfunction
function [ ] = simple_ik(typeInteger) % Simple inverse kinematics using inverse jacobian method % joint limits (degrees) joint_limits = [... -97.494 97.494 0; ... % s0 -60 123 31.5; ... % s1 -174.987 174.987 0; ... % e0 -150 2.864 -73; ... % e1 -175.25 175.25 0; ... ...
% F5 function o = FUN5(x) dim=size(x,2); o=sum(100*(x(2:dim)-(x(1:dim-1).^2)).^2+(x(1:dim-1)-1).^2); end
function plotBurstConstruction(fsamp,dataC,dataX,XH,burstinds) % plot data% Run inside constructGenCrossMatrix a(1) = subplot(5,1,1) XC = dataC; tvec = linspace(0,size(XC,1)/fsamp,size(XC,1)); plot(tvec,XC,'b') a(2) = subplot(5,1,2) plot(tvec,dataX,'b') a(3) = subplot(5,1,3) plot(tvec,XH,'b') ylim([0 4]) a(4) = su...
function makedir(directory_name) if exist(directory_name) ==7, return; end warning off % R13 compatibility if strfind(version,'R13'), I = findstr(directory_name,'/'); parent_dir = directory_name(1:I(end-1)); new_dir = directory_name(I(end-1)+1:end); status=mkdir(parent_dir, new_dir); else ...
% 'Track and Label Bounding Box(Cuboid) Automatically Based on predefined Bounding Box % % [Japanese] % トラッキングアルゴリズムを利用することで、点群データ向けラベリング(Cuboid)を半自動化します。 % 使い方は以下の通りです。 % % Step 1 : Labeler上でROIラベルを定義します。ラベルタイプは"Cuboid"を選択します。 % % Step 2 : 点群データをクラスタリングします。Labeler本体の機能としてクラスタリング機能が % 提供されていますので、そちらを利用します。La...
function [stimulusData, responseData] = parsePresentationFile( ... filename, metaData, screenCoords, encoding) %PARSEPRESENTATIONFILE Load experimental setup from a spreadsheet file % % stimulusData: % The columns define the order of stimuli drawn to the screen. % Each column is a new stimulus drawn on the scree...
% % This code uses the Euler method to solve y'=-a*y+0.25*t^2 % with time step h=0.1 and h=0.05. Then it estimates the error % and plots the estimated error as a function of time. % clear clf reset % a=2; y0=2; h=0.1; % % Run with h % n=5/h; t=[0:n]*h; y=zeros(1,n+1); y(1)=y0; for j=1:n, y(j+1)=y(j)+h*(-a*y(j)+0.25*...
length=2.1336*10^3;%mm; width=1.524*10^3;%mm; radiu_in=0.4572*10^3;%mm radiu_out=1.9812*10^3;%mm x1 = [0.381 0.381 -0.381 -0.381].*10^3; x2=[-1.2954 -1.2954 -2.8194 -2.8194].*10^3; y1 = [-1.5616428.*10^3 length+1.5616428.*10^3 length 0]; y2=[0 length length 0]; c1 = linspace(0,-pi,20); c2 = l...