text
stringlengths
8
6.12M
function B=fCreateBodyGround(Name) B=Body('Name',Name,'Type','Ground'); B.init(); end
function [IOU, flippedIOU, IOUSort, maxInd] = pairByIOU(testOutcome, testBoxes, ii) % We take the IOU matrix, and find the most suitable pairs of boxes, such % that the sum of IOU's will be greatest. IOU = bboxOverlapRatio(testOutcome(ii,:).bbox{:}, ... % This IOU's of all rows in the first with those of the second ...
clear; close all; clc; %% TEST % Assert that Elastic Net gives expected results when run with orthogonal % predictors. X = gallery('orthog',100,5); X = X(:,2:6); y = center(1:100)'; delta = 10; [b_en info] = elasticnet(X, y, delta); b_ols = X'*y; b_en2 = zeros(size(b_en)); for i = 1:info.steps b_e...
function LL = optimPowerScale(xx) % Optimization objective function for a scaling factor SR and a power beta. % For use within FMINSEARCH (or similar) only. global S_dist param1 tau1 loc_param = param1; loc_param.SR = xx(1); loc_param.sge = xx(2); % loc_param.tc_val = xx(3); % ...
clear all clc plx_path = fullfile(pwd, 'test', '4chDemoPLX.plx'); %Check if file exists if ~exist(plx_path, 'file') error('File not found.'); end %Try to open file from specified path fID = fopen(plx_path); %If fopen failed, return error if(fID == -1) error('Error opening file with fopen, check permissions.'...
function [ xr, yr ] = EC_point_double( a, xp, yp, n ) %EC point double doubles the input points s=3*xp^2+a; sinv=invmodn(2*yp,n); s=mod(s*sinv,n); y0=mod(yp-s*xp, n); xr=mod(s^2-2*xp,n); yr=mod(-(s*xr+y0),n); end
close all; clear all; clc; start = [0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1]; %format danych wejściowych out_s = 25; %ilość wyjść z sieci net = newff(start, out_s, {'tansig'}, 'trainlm', 'learnh'); %stworzen...
%SCRIPT EVALUATES OUTER EM-LOOP TERMINATION CONDITIONS eps=0.1; % target percentile accuracy cntMax=5; % max loops counter switch mode case {'base','iid'} % if baseline or iid, only once ! iflg=0; case {'gibbs','neal'} % if neal or indep.-gibbs, stopping criterion dW=sum(abs(We...
% ========================================================================= % Function: GetCylindricalAxialSF % % Parameters: axialForce (N), diameter (mm), yieldStrength (MPa) % stressConcentrationFactor % % Outputs: n (axial stress safety factor) % % Description: Calculates the axial stress safety facto...
function [ Zin V I S Z2 rb re ] = dipolea( freq, L, a ) % [ Zin V I S Z2 rb re ] = dipolea( freq, L, a ) % Calculate the input impedance of a dipole antenna, also returns % the excitation voltage vector and the current distribution. % L is the length and a is the radius. % S is the subsampling matrix (see mktriss, ...
function landmarks = CMRfind_facial_landmarks(X,bbox, Ldetector,scfak) % Init [a,b,c] = size(X); if c~=1 X=uint8(mean(X,3)); % X=uint8(X(:,:,1)); end nfaces = size(bbox,1); bbox1 = bbox; landmarks = zeros(nfaces,136); for k1=1:nfaces; bbox = bbox1(k1,:); % find facial region and rescale image ...
% Implementa la cantidad pasos de bisección pedidos. % % Parámetros: % f: Puntero a la función a la cual hallarle el intervalo % para la raíz. % a0: Límite inferior inicial. % b0: Límite superiro inicial. % delta: Diferencia deseada entre dos aprximaciones sucesivas. % max...
function int_mask = get_mask_from_instruments(instr_subset,instr_list) persistent list if ~ischar(instr_list) % initialize with instrument list list = instr_list; int_mask = 1; else % comes from Jess subset = strsplit(instr_subset,' '); mask = zeros(1,length(list)); for i = 1:length(subset)...
function [] = histTimeSeries(vars,colors,titles,selection,acc,filtFlag,plotsPath) % Plot Force if isempty(acc) figure('Name',selection,'NumberTitle','off','Visible','off') set(gcf, 'DefaultAxesFontSize', 16) t = tiledlayout(5,1); if strcmp(filtFlag,'filt') ...
function [ Bout ] = Rectangular_B_field_pair( X,Y,Z,x0,y0,z0,n0,I,W,L,T,S ) % Calculates the magnetic field due to a rectangular pair of coils % XYZ - point of calculation % x0y0z0 - coil pair center % n0 - pair orientation % I - current % WL - width and length (half) % TS - thickness (full) and sepa...
fs=44100; N=fs; t =0:1/fs:0.3; f=440; tone ={}; bannhac=[]; for i =1:12 tone{i}=0.3*sin(2*pi*f*(2^(i-1)).^(1/12)*t); end %'A' 'A#' 'B' 'C' 'C#' 'D' 'D#' 'E' 'E#' 'F' 'G' 'G#' A = tone{1}; A1=tone{2}; B = tone{3};C=tone{4};C1=tone{5}; D=tone{6};D1=tone{7};E=tone{8};E1=tone{9};F=tone{10};G=tone{11};G1=tone{12}; bannhac ...
function [B]= f_B(kompartment,vstup) B = zeros(kompartment); [m,n] = size(vstup); for i=1:kompartment for j=1:kompartment if(i == j) for z=1:m if(vstup(z,1) == i) B(i,j) = 1; end end end ...
% Reads the result.dat file function [X] = read_data(infile) %h = fopen('data.dat', 'rb'); h = fopen([infile '.dat'], 'rb'); row = fread(h, 1, 'integer*4'); col = fread(h, 1, 'integer*4'); ch = fread(h, 1, 'integer*4'); X = fread(h, row * col * ch, 'double'); X = reshape(X, [row col ch]); fclose(h)...
% setInfo_search %ABL Slider set(H.ABLslider_text,'String',[num2str(round(get(H.ABLslider,'Value'))) ' dB']); XStimParams.curr_ABL = round(get(H.ABLslider,'Value')); set(H.ABLslider,'Value',XStimParams.curr_ABL); %DUR edit box XStimParams.curr_stimdur = str2num(get(H.DUR,'string')); set(H.DUR,'value',XStimPa...
% % function to run the temporal autoencoding neural network (TANN) % function fn_tann_hcp_onesbj_restNtasks_mat(sbjnm, list_hcp_flnm) % %clear all; %rootpth='/data/leej45'; rootpth='/data/HCP/HCP_900'; datapth=[rootpth '/s3/hcp']; rstpth = '/data/leej45/s3/hcp'; %=== addpath for commonly used m-files %addpath([rootp...
function [output] = padadd(A, x, index) % PADADD Adds data columns to an array even column lengths don't match. % Missmatched areas of data array are padded with NaNs. % % answer = padadd(A, x) % appends "x" column vector as the last column of "A" % % answer = padadd(A, x, index) % assigns "x"...
function [ output_args ] = result_comp( input_args ) %RESULT_COMP �˴���ʾ�йش˺����ժҪ % �˴���ʾ��ϸ˵�� result = 'model_deep_contour/models/test/svm_stride/'; ionation = {'cov1','cov2','cov3','cov4','cov1-4'}; name = {'cov2','cov3','cov4','cov5','cov272'}; col = {'r','b','c','y','k'}; figure(1);h...
fp = fopen('bench_wrt_popsize.txt'); data = textscan(fp, '%12n%12n%12n%12n%12n%12n', ... 'HeaderLines', 1, 'ReturnOnError', 0); fclose(fp); data = cell2mat(data); subplot(1,2,1); loglog(data(:,1), data(:,3) * 1e-3, '^-', ... data(:,1), data(:,5) * 1e-3, '^--', ... data(:,1), data(:,6) * 1e-3, ...
% Aprroimxtes to the absolut value clear N = 100; alpha = (2*cos(pi/8))/(1+ cos(pi/8)); beta = (2*sin(pi/8))/(1+ cos(pi/8)); h = randn(N,1) + j*randn(N,1); h_abs1 = abs(h); h_abs2 = zeros(1,N); for xx = 1:N h_max = max([abs(real(h(xx))), abs(imag(h(xx)))]); h_min = min([abs(real(h(xx))), abs...
git function [x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6] = area_location(Facename) % faceDetector = vision.CascadeObjectDetector(); % videoFileReader = vision.VideoFileReader(Facename); videoFrame = step(videoFileReader); % bbox = step(faceDetector, videoFrame); length = size(videoFrame,2);%水平方向 wid...
function updateMessage(obj, varargin) % UPDATEMESSAGE Updates the specified message in the queue % The updated updates the specified message in the queue with a new visibility % timeout value in seconds or updates a set of fields using the specified % request options and operation context. % % Example: % % updated t...
function [eegArray] = eegSessionAverageTimeSeries(class) %EEGSESSIONAVERAGETIMESERIES return average time series of %eeg class ,A class is an array of eeg struct %This perform through fft accumulation %Number of channels : 32 Nc = length(class); N = 2^nextpow2(length(class(1).fp1));%get next power of 2 one trisl leng...
Tini = 0; # Tiempo inicial Tfin = 2*pi; # Tiempo final n = 100; # Instantes de tiempo donde se evaluara la solucion function xdot = myf(x, t) # x = (v1_x, v1_y, v2_x, v2_y, r1_x, r1_y, r2_x, r2_y) # Notar que aunque la variable t es llamada no es usada # j cuenta la cantidad de veces que s...
%---------------------------------------------------------------- % scripts to read and open data from a netcdf files % % this script is general and thus requires the % pathbase, path, and years2 vars to be predefined % % e.g. %pathbase='/net2/Levi.Silvers/data/amip_long/'; %path='AM2.1_1870-2004/AM2.1_1870-2004-HGlo...
% $Header: svn://.../trunk/AMIGO2R2016/Postprocessor/Post_Plot/AMIGO_plot_residuals.m 2203 2015-09-24 07:11:27Z evabalsa $ % AMIGO_plot_residuals: plots residuals % %****************************************************************************** % AMIGO2: dynamic modeling, optimization and control of biological systems ...
% The sequence of triangle numbers is generated by adding the natural % numbers. So the 7^(th) triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 % = 28. The first ten terms would be: % % 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... % % Let us list the factors of the first seven triangle numbers: % % 1: 1 % 3:...
clc clear all a=-1;b=5;h=.01;tau=1; n=tau/h; x=a:h:b; T=((b-a)/h); y(1:n+1)=a:h:0; for i=n+1:T y(i+1)=y(i)-y(i+1-n)+y(i-n); end plot(x,y)
function [ x_a ] = cross_abs( a, freq, e_s_rel ) %CROSS_ABS % Raleigh Absorption Cross Section for a Spherical Particle % % Input: a - particle radius (m) % freq - frequency (Hz) % e_s_rel - Permittivity of Scattering medium (relative to e0) % Output: x_a - absorption cross section (m) ...
function d = dft(y) n = 2^8; x = [0:4*pi/n:4*pi]; x = x(1:end-1); y = 0; w = e^(-2*pi*i/n); for j = 1:49 y = y + sin(j*x); end d = []; for j = 1:n dj = 0; for k=1:n dj = dj + w^(j*k)*y(k); end d= [d;dj]; end d = d/n; ffty = fft2(y); phi = e^(2*pi*i/n); for k=1:n yk = 0; ykf = 0; ...
x(1)=0.0005666; x(2)=0.001286; x(3)=0.00171; y(1)=0.1105; y(2)=0.1569; y(3)=0.2112; for i=1:3; data=load (['C:\Users\probook\Desktop\Mecánica de Materiales\Tareas\Tarea 4\Datos_papel\papel_vertical_1.txt']); x=data(:,1); y=data(:,2); x=x./1000; e=73*10^-6; a=2.5*10^-2; l=20*10^-2; s=e*a; x=x./l; y=y./s; y=y.*(10^...
clf, N=32; A=6; %clear figure, FFT length and cosine amplitude wc=linspace(0,pi,1000); %cosine frequency Xw0=A*(sin((N/2)*wc)./sin(wc/2)).*cos(wc*(N-1)/2); %FFT value at DC Xw0(1)=A*N; %use L'Hospital to correct NaN in first element (wc=0) plot(wc/pi,Xw0),hold on,plot([0:2*pi/N:pi]/pi,zeros(1,N/2+1),'or') xlabel(...
% University of British Columbia, Vancouver, 2017 % Alex Kyriazis % William Choi % % OUTDATED % Loads training data based on training data in microglia_features.mat % This file is set somewhere else. function [ list ] = load_training_features( ) %LOAD_FEATURES Summary of this function goes here % Detailed expla...
function project3 clear all f = imread('project3/Fig0424(a)(rectangle).tif'); figure,imshow(f);title('original image'); [M, N, ~] = size(f); wM = zeros(M, M); wN = zeros(N, N); for u = 0 : (M - 1) for x = 0 : (M - 1) wM(u+1, x+1) = exp(-2 * pi * 1i / M * x * u); end end for v = 0 : (...
clear;clc;close; addpath ../../chebfun L = chebop(0,5); L.op = @(t,y) diff(y,2) - 2*t*y^2 + t; L.lbc = 0; L.rbc = 1; y=L\0; plot(y); dy=diff(y); figure y0=[0 dy(0)] f=@(t,y) [ y(2); 2*t*y(1)^2-t]; opt=odeset('RelTol',1E-10,'AbsTol',1E-12); [t,y] = ode45(f,[0 5],y0,opt); plot(t,y(:,1));
function[waypoints, areaMatrix, forbiddenZones] = ... computing_waypoints(area, j, i, width, height,... centralPoint, areaMatrix,... distanceStripes, distanceWaypoints, forbiddenZones) % computing waypoints waypoints = [(distance...
clc close all clearvars N = 1000; x = linspace(0,pi/2,N)'; x2 = linspace(0,0.5,N)'; y = sin(x); y2 = x - x.^3/prod(1:3); y3 = x - x.^3/prod(1:3) + x.^5/prod(1:5); % y4 = 1 - pi^2*(0.5-x2).^2/prod(1:2); % y4 = 1 - 5*(0.5-x2).^2; y4 = -5*x2.*(x2 - 1) - 0.25; % -5(x^2 - x + 1/20) % e = 100*abs(y-x)./(y+1e-3); % e2 ...
function [S,L]=sp2pixel(superpixels,m,n,seeds,label) xx=zeros(m,n); xx(5:5:end,5:5:end)=superpixels(5:5:end,5:5:end); superpixels=xx; xxxx=reshape(superpixels',m*n,1); S=[]; L=[]; for i=1:m*n for j=1:length(seeds) if xxxx(i)==seeds(j) S=[S i]; L=[L label(j)]; end end end...
% Martello strumentato % Versione per elzborare una singola registrazione % set (0,'DefaultFigureWindowStyle','docked') clc close all %% clear variables %% conf=[] %In configuration mettiamo degli indici che ci dicono il campione %utilizzato, la piastra di carico, la superficie d'appoggio l'adesivo e ...
function [coor, lat] = Read_LAMMPS_Structure() fp=fopen('out.xyz','r'); while 1 tline = fgetl(fp); if ~ischar(tline) fclose(fp); break; end tmp=sscanf(tline,'%d'); NCoords=tmp; tline = fgetl(fp); for i=1:NCoords tline = fgetl(fp); tmp=sscanf(tline,'%f %f %...
%% PRoblem of the Day 2 Quiz % Ian Doarn % 9/5/2017 nine = 9; ten = 10; temp = nine; nine = ten; ten = temp; disp("nine = " + nine); disp("ten = " + ten);
function [gaborcolor_cov,im_gabor_3d,im_color_gradient] =fun_GaborColorCov(I) % I: input RGB image % gaborcolor_cov: output encodeded feature using covariance pooling (gabor feature and color feature) % im_gabor_3d: Gabor feature, im_color_gradient: color gradient feature (For observation) % written by: Nanjun He(huna...
function [ thetas ] = calculate_angles( points ) %Returns the angle between the normal of the boundary at the ith point and %the x-axis where the angle is defined over 0 to 2pi counterclockwise %points(i), thetas(i) [num_rows, num_columns]=size(points); x_axis=[1;0]; thetas=[]; for i = 1 : num_columns i...
function PrepMotionSliceTime(boldData) % PREPMOTIONSLICETIME - Executes motion & slice timing correction using AFNI. % This function corrects for motion artifacts and slice timing acquisition effects using AFNI software. It is % currently only compatible with computers running the Linux operating system. % % SYNT...
x = [265 400 500 700 950 1360 2080 2450 2940]; y = [1025 1400 1710 2080 2425 2760 3005 2850 2675]; A = zeros(24); % spline pass through start point for i=1:8 A(i,(i-1)*3+1) = x(i).*x(i); A(i,(i-1)*3+2) = x(i); A(i,(i-1)*3+3) = 1; end % spline pass through end point for i=2:9 A(i+7,(i-2)*3+1) = x(i).*...
function processed_data = crefavg_hack(data,ChanTotal,Chan_border) % processed_data = crefavg(data,nChan,groupSpan) % Process the data to do Common Reference Averaging (CRA) i.e. subtract the median from each channel across all time from itself and then subtract the median at each time point across all channels from ev...
function p = smlog2prob(q), % Calculate probability of softmax function from log probability % % -- Input % q = log(p) before normalization (i.e. sum(exp(p)) need not to be 1.) % [Ndata Ncls] % % 2009/06/05 OY % % Copyright (c) 2009, Okito Yamashita, ATR CNS, oyamashi@atr.jp. [Ndata,Ncls] = size(q); maxq = max(q,[]...
function Modsweep=SAMstepper(T, EXP, Prefix, IncludeTheta, NoTol); % SAMpanel - generic amplitude modulation panel for stimulus GUIs. % S=SAMpanel(Title, EXP) returns a GUIpanel M allowing the % user to specify a fixed sinusiodal amplitude modulation to be applied % to all the stimuli of a series. Guipanel S ha...
function [ w, w0 ] = GetW( X, y, lambda, tolkkt, C ) %GetW Calculate w, w_0 A = bsxfun(@times, X, y'); %Find Inactive set, 0<lambda<C bndind = find(lambda > tolkkt * C & lambda < (1 - tolkkt) * C) ; %Find w w = A(:, bndind)*lambda(bndind); %find w0 w0 = mean(y(bndind)'-w'*X(:, bndind)); end
fid = fopen("input.txt"); % open the file best_id = 0; while ~feof(fid) % feof(fid) is true when the file ends row = 0; col = 0; line = fgetl(fid) % read one line smallest = 0; largest = 127; size = 128; for index = 1:6 %find row c = line(index); if(c == 'F') ...
function res = patch(ph, tabLevel) %PATCH MATLAB patch to Steno3D Surface conversion if ~isgraphics(ph) || ~strcmp(ph.Type, 'patch') error('steno3d:convertError', ['steno3d.utils.convert.patch ' ... 'requires graphics input of type "patch"']); end res = {}; if isempty(ph.Vertic...
%%smooth potential confinement function re=hmu(a,mu,delta,vz,alpha_R,dim,smoothpot,mumax,peakpos,sigma) t=25/a^2; sx=[0,1;1,0]; sy=[0,-1i;1i,0]; sz=[1,0;0,-1]; alpha=alpha_R/(2*a); band11sm=(spdiags([ones(dim,1) ones(dim,1)],[-1,1],dim,dim)); band1m1sm=(spdiags([ones(dim,1) -ones(dim,1)],[-1,1],dim,dim)); eyesm=speye(d...
%% 9-13-2016 - script to compare response times once they've been calculated %% load in subject close all;clear all;clc % this is from my z_constants Z_ConstantsStimResponse; DATA_DIR = 'C:\Users\djcald.CSENETID\Data\Subjects\3ada8b\data\d9\MATLAB_conversions\3ada8b_ResponseTiming'; sid = SIDS{6}; % load subject dat...
function Weight=lstm_mom_setup(layers) %% Momentum initial M=layers(1); N=layers(2); % input gates Weight.w_i=zeros(M+1,N); Weight.r_i=zeros(N,N); Weight.p_i=zeros(1,N); % forget gates Weight.w_f=zeros(M+1,N); Weight.r_f=zeros(N,N); Weight.p_f=zeros(1,N); % cells Weight.w_z=zeros(M+1,N); Weight.r_z=zeros(N,N); % output...
function [CI_lo,CI_hi] = crossval_errorbars(vals,params) % this function calculates the 95% confidence bars for a crossvalidation table alpha = 0.05; num_repeats = 0; num_folds = 0; assignParams(who,params) crossval_correction = 1/(num_folds*num_repeats) + 1/(num_folds-1); meanvals = mean(...
function params = train_weaker(datas, weights) [n, m] = size(datas); dimension = m - 1; %choose axis and threshold best_error = -1; best_axis = -1; left_label = -1; right_label = -1; best_threshold = -1; %calculate total weight w_t_n1 = 0; w_t_1 = 0; for i = 1:n i...
%Returns the M^n matrix using Max-Min algebra function [powMatrix]=powMaxMin(M1,n) [f c] = size(M1); if f~=c error('An square matrix is required!'); end powMatrix = eye(f); for i=1:n powMatrix=fuzzy_maxmin(powMatrix,M1); end end
classdef HE_Edge <handle properties e_pair = HE_Edge.empty; %对偶边 e_succ = HE_Edge.empty; %后继边 e_vert = HE_Vertex.empty; %首顶点 e_face = HE_Face.empty; %右侧面 end methods function edge = HE_Edge() end end end
classdef (Abstract = true) measurement < qes.qHandle % base class of measurement classes, defines the basic features of % measurement. % Copyright 2015 Yulin Wu, Institute of Physics, Chinese Academy of Sciences % mail4ywu@gmail.com/mail4ywu@icloud.com properties timeout = Inf; % seconds, maximu...
clear; load('error_linear_output.mat') load('error_multiplier.mat'); total_error = error_linear_output + error_multiplier; hold on; scatter(cap_x,error_multiplier,'x'); scatter(cap_x,error_linear_output,'x'); scatter(cap_x, total_error,'s','filled'); xlabel('Capacitor size /C_0'); ylabel('Mean error /%'); set(gca, 'Y...
clear all clear global close all clc addpath(genpath('../lti_toolbox')); %% 1. Goal % The goal of this tutorial is to design a controller based on an % H-infinity formalism. Depending on the type of constraints we impose, a % different solver is most suited and will therefore be picked by the % toolbox. %% 2. System...
function doy=ymd2doy(cdate) % % Function ymd2doy % ================ % % Computes the day of year for given year, month and day % % Sintaxe % ======= % % doy=ymd2doy(cdate) % % Input % ===== % % cdate -> 6x1 vector with year, month, day, hour*, minute* and sec* % ymd=[ ye...
function cmd_runfit(args) warning off all mtalk('\n\nPERFORMING RUNNING NONLINEAR FIT'); % Load in freq data pid = mprocessinit(['\n Loading in frequencies from file "',args.freqFileName{1},'"...']); F = str2double(mread(args.freqFileName{1},'%s')); mprocessfinish(pid,1); mtalk(['\n ',num2str(length(F)),' frequencie...
../../src/process/ai.m
function coord_stuct = ... Grids_coords_for_plane( basis_1 , basis_2 , centre_point ,... length_of_plane , sampling_interval ) %Genrates that coorindates that we are requires to genreate the intensity %The input are the 2 basis that span the plane, the sampling interval %the size of the plane and the org...
function [x1,x2,x3]=func_01(a1,a2) fprintf('nargin=%d,',nargin) fprintf('nargout=%d \n',nargout) x1=a1+a2; x2=a1-a2; x3=(a1+a2)/2;
%% 球面調和関数を用いた特徴量の確認のための実験(従来手法) % 比較用の従来手法プログラム % % 投影視点 % 提案手法とそろえるため、Geodesic dome 視点ではなく 直交グリッドの交点視点を用いる % % [従来手法] % クエリとデータベースのモデルについて、 % ・ランダムに回転と平行移動 % ・(投影計算) % 2次元投影の計算 % 各投影画像をラドン変換で振幅スペクトル(平行移動不変) % 振幅スペクトルは対称形なので片側だけ取り出す % ・投影画像集合について総当たりで位相限定相関法で類似度 % クエリとデータベースの特徴量をユークリッド距離比較 % % % ...
function h = plotpolybounds(x,y,varargin) % function plotPolyBounds(x,y,[alpha]) % Plots a regression line and (1-alpha)% confidence interval on the current % figure. Alpha is optional; by default it's 0.05. opt.showstats = true; opt.color = 'k'; if ((nargin >= 3) && isnumeric(varargin{1}) && (numel(varargin{1}) == ...
function FixTrialsAnswers(filename) % FIXTRIALSANSWERS - modify the Answer field in a "trials" struct from a % .mat file in the session_files_output folder (output from % Main_convert_eprime.m), in case some answers that were recorded were % non-standard (eg. "LEFT_ARROW" instead of numbers 0, 1, 2 etc). It is % your ...
function [sci, sizes] = scomponents(A) % SCOMPONENTS Compute the strongly connected components of a graph % % ci=scomponents(A) returns an index for the component number of every % vertex in the graph A. The total number of components is max(ci). % If the input is undirected, then this algorithm outputs just the...
function x = Qrfact(A, b) n = length(A); Q = eye(n); R = zeros(n); for j = 1:n if j < n [v, beta] = householder(A(j:n, j)); else v = 1; beta = 2 - 2 * mod(n, 2); end A(j:n, j:n) = (eye(n - j + 1) - beta * v * v') * A(j:n, j:n); d(j) = beta; ...
function exercise_4_7_2() image = imread('amsterdam.bmp'); imshow(image); hold on; [row, col, ch] = size(image); x = [col/2 col/2]; y = [row/2 1]; plot(x, y, 'red -'); plot(375, 480, 'magenta *'); [M, ind_r] = max(image(:,:,1)); [M, ind_g] = max(image(:,:,2)); ...
function [meanOut, varOut] = manifoldOutputs(X2, X, Y, theta, invK) % MANIFOLDOUTPUTS Evaluate the manifold output for datapoints X. global LINEAR dataDim = size(Y, 2); numData = size(Y, 1); numDataTest = size(X2, 1); alpha = zeros(numData, dataDim); kbold = kernel(X2, X, theta)'; A = Y'*invK; meanOut = A*kbold; ...
function elem = atskewquad(fname,varargin) %ATSKEWQUAD(FAMNAME,LENGTH,Qs,PASSMETHOD) % creates a skew quadrupole element with Class 'Multipole' % FAMNAME family name % LENGTH length % Qs skew quad strength % atskewquad(Fname, L, Qs, method) % %See also: ATDRIFT, ATQUADRUPOLE, ATSEXTUP...
function [ tracklets ] = extendTrack( imageStack, trackMateTracks ) [rows,cols,T] = size(imageStack); N = numel(trackMateTracks); tracklets=zeros(T,2,N); for n=1:N z=trackMateTracks{n,1}(1,1); [zz,r]=size(trackMateTracks{n,1}); for m=1:zz tracklets(m+z,:,n)=trackMateTracks{n,1}(m,2:3); ...
% This program solves the swing equation of a one-machine system % when subjected to a three-phase fault with subsequent clearance % of the fault. % % Copyright 1998 H. Saadat % function swingrk4(Pm, E, V, X1, X2, X3, H, f, tc, tf, Dt) %global Pm f H E V X1 X2 X3 if exist('Pm') ~= 1 Pm = input('Generator out...
clc close all clear hold on name = 'takeoff_3'; % name = 'flyst_2'; % name = 'stop_3'; % name = 'landing_3'; % name = 'Fcage2'; second = 60; freq = 256; time = second * freq; file = ['/Users/leokeelin/Documents/EEG/', name, '.txt']; s = fopen(file, 'r'); % for x = 1:256*5 % temp = fscanf(s,'%d', 10); % end for...
function [dir_matrix] = mkdirmatrix(spaceres); %[dir_matrix] = mkdirmatrix(spaceres); generates matrix of spatial locations in double polar coordinates %dir_matrix: column1 = elevations, column2 = azimuths %argin spaceres: determines desired spatial resolution global GUI global XStimParams global FN if str...
function obj = rmfieldsRegexp(obj, exprs, recurse) if nargin < 3 recurse = false; end if isa(exprs, 'char') exprs = {exprs}; end for ii = 1:numel(exprs) obj = fmfieldsRegexp(obj, exprs{ii}); end if recurse fs = fieldnames(obj); for ii = 1:numel(fs...
clc %define points in the emitter frame %load('rigid_carina_points_3'); %A = emitter frame %B= lung frame load regPoints.mat % The points measured from the tracking system. Transposed for the absor % function A = regPoints' * 1000; % Times 1000 due to Slicer RAS in mm % The Matrix of Fiducial points from 3D Slice...
clear all, close all, clc; %% 各種オブジェクトの定義 videoFReader = vision.VideoFileReader('ecolicells.avi'); %% 1フレーム毎に読み込む frame = 0; while ~isDone(videoFReader) videoFrame = videoFReader(); frame = frame + 1; if frame == 11 %10Frame目を保存 img = rgb2gray(videoFrame); end end %% 画像を保存 imwrite(img, 'f...
function sleepplotDiffgroupsGOI(ti,doprint,sBin,eBin,file1,file2) if nargin==5 [data1 data1a]=fly_sleepthresh(file1,ti); [x y]= size(data1); for n=1:y; subplot(y*3,3,n+2*(n-1)); bar (data1(sBin:eBin,n)); axis tight set(gca,'ytick',[]) set(gca,'xtick',[]) end set(gcf,'PaperOrien...
function[P2]=avg_samples(p,timecell) ft_data1 = []; ft_data1.fsample = 1000; ft_data1.trial = p; ft_data1.time = (timecell); ft_data1.label = {'HPC'; 'PAR'; 'PFC'}; cfg = []; avg= ft_timelockanalysis(cfg,ft_data1); P2=avg.avg; end
% OK - can you do the eclipse thing faster in matlab? % Given you've already learned a heap from the Python experience... dirname = 'C:\Users\jaker\Pictures\Oregon_Eclipse\16bit\png'; fnames = get_files(dirname,'png'); imgs = cellfun(@(x) imread(fullfile(dirname,x)),fnames,'uni',0); % I just wanna load these into a hy...
function [J, K] = eerepulsion(ERI, P) M = length(ERI); J = zeros(M); K = zeros(M); for mu = 1:M for nu = mu:M J_ = 0; K_ = 0; for kap = 1:M for lam = 1:M J_ = J_ + P(kap,lam)*ERI(mu, nu, lam, kap); K_ = K_ + 0.5*P(kap,lam)*ERI(mu, kap, lam, nu); ...
cd%%% Aerial Tracking System %%% Orson Lin, Richard Fedora, Murat Ambarkutuk %%% 04/30/2016 %%% Virginia Tech %% Initialization % clear all; close all; clc; %% Variables and parameters params.isAnnotated = true; params.isTrained = true; params.datasetLocation = '../data/DARPA_VIVID/eg_test01/egtest01/'; params.fileNam...
a = load('flowers.mat'); flowers = a.x_fl; b = load('normalization_matrix.mat'); Z = b.Z; j = 1; % Z = 8*Z; compressed_flowers = zeros(256, 256, 4); err = zeros(1,4); for i = 2.^(0:3) compressed_flowers(:,:,j) = compression(flowers, i*Z); err(j) = mean2(abs(compressed_flowers(:,:,j) - flowers)); ...
classdef SpacecraftFactory < Factory properties (Constant, Access = protected) defaults = {'Capsule', @SpacecraftCapsule}; exception = 'Unkown spacecraft type provided'; end methods function self = SpacecraftFactory(varargin) self@Factory(varargin); end function sc = generate(self, data) % data ...
t = [-1:10e-3:12]; u = 5*rectangularPulse((t - 3.5)/5); i1 = 2.16*((u/5)-exp(-((t-1)/4.91))); i2 = 2.16*(exp(-((t-6)/4.91))) .* (0.5*sign(t-6)+0.5); i = i1 + i2; yyaxis left stairs(t,u) ylabel('U1,3/V') yticks([0:5:10]) axis([0 12 0 10]) grid('on') yyaxis right plot(t,i) ylabel('IU1,3/A') yticks([0:2.16:4.32]) axis([...
function A=rstTHDctr(qA,T,delta,nc) %Format: A=rstTHDctr1(qA,T,delta,ctr) %To restore quantized codes ('THD' means threthold) to its original levels %'ctr' is the center of the first level. %Laplacian is worse than geometric!!! ---------------------------------------- %r1=nc(3)/nc(2); %alpha1=-log(r1)/delta; %c1_lap =...
function p = predict(Theta1, Theta2, X) %PREDICT Predict the label of an input given a trained neural network % p = PREDICT(Theta1, Theta2, X) outputs the predicted label of X given the % trained weights of a neural network (Theta1, Theta2) % Useful values m = size(X, 1); num_labels = size(Theta2, 1); % You need ...
% testLocal: test the Local GP approximation's error vs time % performance. % % REQUIRES: % The script uses the EXPERIMENT structure containing % experiment parameters, as explained in RUN_EXPERIMENTS.m. % % EXPERIMENT.M -- contains a list of the cluster sizes used % % EXPERIMENT.EXTRA should be set to one of: % ...
function e = myerfz(R,IMPLEMENTATION) % This function computes e = Erfz(R+1j*R) for R real % % Based upon the Matlab implementation of the error function for complex % numbers by Marcel Leutenegger ( (c) January 2008, LGPL version 2.1). % https://documents.epfl.ch/users/l/le/leuteneg/www/MATLABToolbox/ErrorFunc % tion....
%%%% TR = 1.2; dirstr = '/net/stanley/home/hernan/data/flow/031119ph/turbocasl' spmstr = sprintf('%s/s_0004.img',dirstr) anastr = sprintf('%s/raw_0006.img',dirstr) serstr = 's_002.img' pix =13 thresh = 10 onsets = [80:80:500]*1.096 / TR; onsets = [70:80:500] / TR; window = 80 / TR; cd(dirstr) orthoasl( pix,... th...
classdef control_DDR < handle properties ts = 0.1; %Setting of initial conditions of the control xc = 0; %origin in x yc = 0; %origin in y phi = 0 L = 1; %Distance between wheels R = 1; a = 0; %distance from the center of wheels til the control ...
function C = AMIGO_structFieldPathsAsValue(s,inputstructname) %AMIGO_structFieldPathsAsValue returns the field's access path as string in the field value % % sA = AMIGO_structFieldPathsAsValue(s) copies the structure A and fills each % field with the field position information. % % Example: % a = struct('field1',rand...