text
stringlengths
8
6.12M
function [fitlines, conturIm] = bwCt_LFt(bwIm, minline, maxdist) %bwCt_LFt finds foreground object contours only in binary image, and fits %them into lines % bwCt_LFt takes a binary image I as its input, and returns a % binary image BW of the same size as I, denoting only the contours % of the foreground objects...
function [subont] = depth_n_subont(ont, d) %DEPTH_N_SUBONT % % [subont] = DEPTH_N_SUBONT(ont, d); % % Creates a sub-ontology contain terms up to a specific depth. % % Input % ----- % [struct] % ont: The ontology structure, see pfp_ontbuild.m. % % [double] % d...
function computeBaselineNeuron(F) %computeBaselineNeuron computes baseline per neuron % Layers are the layers you want to compute the baseline on % window is the window span in seconds (ex 50 sec) % window window = F.Analysis.BaselineWindow; % window is the window span in seconds (ex 50 sec) dt = F.dt / 10...
% make2Dgaussian.m % % function to make a noisy 2D Gaussian, with which to test particle % tracking functions. % z = A*exp(-(x-x0)^2 / (2*sigma_x^2))*exp(-(y-y0)^2 / (2*sigma_y^2)) % % Should previously initialize random number stream: % RandStream.setDefaultStream(RandStream('mt19937ar','seed',sum(100*clock))...
function [Useq] = plotPoissonSeq(n) fu = fopen('u-seq.m', 'r'); Useq = fread(fu, [n,n], "double"); imagesc(Useq); print('poissonSeq.eps', '-deps'); end
%rng('default'); load('testdata_scz_Z1_ctl_Z0.mat') mu0=mean(Z0); sigma0=cov(Z0); mu1=mean(Z1); sigma1=cov(Z1); %% smpsiz=100:100:2100; lamdav=1:0.2:5; Zc=cell(21,21); %% for kx=1:21 for ky=1:21 Sz=smpsiz(kx); Lv=linspace(1,lamdav(ky),round(Sz/4)); p=ones(100,1); [kx ky] par...
clc; clear; ImgDirPath = 'D:\Car Side View\'; OutDirPath = 'D:\sun\OUT\'; ImgFiles = dir(strcat(ImgDirPath, '*.jpg')); OutFiles = dir(strcat(OutDirPath, '*.jpg')); length = size(ImgFiles,1); for i = 1 : length ImgFiles(i).isdir = 0; end for j = 1 : size(OutFiles, 1) for k = 1 : length if strcmp(ImgFil...
% [retfitinfo,yfit,amp]=jdmmin(DataX, DataY, fitinfo) % minimization function, for TCSPC data, loosely based on simplex % minimization principles. % yfit is a matrix and amp is a vector such that yfit*amp is the % overall fit function, while yfit(:,N) is the N-th function, and amp(N) is the N-th % amplitude. % [retf...
clear; clc; tic %% Initials img_raw = imread('data/chessboard_lightfield.png'); global u v s t c u = 16; v = 16; s = size(img_raw, 1) / u; t = size(img_raw, 2) / v; c = 3; % load('results/focal_stack.mat'); % fprintf('load complete\n'); toc img_array = zeros(u, v, s, t, c); img_array = uint8(img_array); for i = 1...
function [f_resultant, Mag_resultant, Phase_resultant] = LegFunction(I_mag,I_phase,k,f_o,f_c,The_o,The_c,m_max,n_max) [f, Mag, Phase] = SwitchingFunction(k,f_o,f_c,The_o,The_c,m_max,n_max); f_new= 0:f_o:max(f); y=(f/f_o)+1; Mag_new=zeros(1,length(f_new)); Phase_new=zeros(1,length(f_new)); for i=1:length(y) ...
% Linear regression with multiple variables % House price prediction based on size and number of rooms %% Initialization %% ================ Part 1: Feature Normalization ================ %% Clear and Close Figures clear ; close all; clc fprintf('Loading data ...\n'); %% Load Data data = load('houseData.txt'); X ...
clear; fid=fopen('/home/scw4750/github/IJCB2017/liufeng/data/protocols/protocols_3parts_bbox/norm/probe3_with_label.txt','rt'); list=textscan(fid,'%s %d'); list=list{1}; img_dir='/home/scw4750/github/IJCB2017/liufeng/data/probe_croped'; out_dir='/home/scw4750/github/IJCB2017/liufeng/data/debug/150_200_image'; for i=1:l...
%% Zhanwen "Phil" Chen %% CS250 %% Final Project %% Bird vars max_speed = 10; %m/s numBirds = 10; side_length = 10; leader_id = randi(numBirds,1); %% Environment vars sky_xlim = 200; sky_ylim = 200; %% Initialize birds birds = initBirds(numBirds,side_length,max_speed,sky_xlim,sky_ylim); birdsList{1} = birds; % birds...
function Falsapos = Fpos(a,b) fprintf('a,b,error,iteracion\n'); f=inline('exp(-1*(x^2))-cos(x)'); iteracion=1; T=0.00001; E=10; tic po=a; while(T<E) p=(a*f(b)-b*f(a))/(f(b)-f(a)); if f(a)*f(p)<0 b=p; end if f(p)*f(b)<0 a=p; end E=abs(((p)...
clear all clc load ProjectTerrain h=T/1000; C=1/20000; g=3.7; cg=1; V=0.01; cycles=100; constrain='constraints.ini'; [dhdx dhdy]=calc_gradients(x,y,h); [ segment,TerrainFile,xs,ys,xe,ye,nwp,wp ] = getProjectInput( 'path1.ini' ); [xp_path1,yp_path1,hp_path1,dist_1B1,hplus_1B1,hminus_1B1]=computepath(xs,ys,xe...
function [new_ft_data] = remove_outliers(mean_ft_data) %Order data least to greatest sorted_ft = sort(mean_ft_data); %Find the median med_sft = median(sorted_ft); %Calculate median of lower & upper half of data half_length = floor(length(sorted_ft/2)); up = sorted_ft(half_length+1:end); low = sorted_ft(1:half_length...
function [ePb,eeqm,evar] = eqm(mu, sigma) nSimu = 3000; nGenere = 10; v = 1; s = 2*v*round(rand(nSimu, nGenere)) - v; n = randn(nSimu, nGenere) * sqrt(sigma) + mu; r = s + n; signal = mean(s < 0 & r > 0,2) + mean(s > 0 & r < 0,2); % for i = 1:nSimu % P1 = mean(s(i, :) < 0 & r(i, :) > 0); % P2 = mean(s...
function [D,temp2,Eij] = EnergyDistance_wn(data,n_mc,n_types,n_time,n_mod); % n_mod % # models % n_types % # observation types % n_time % # of observations along time % n_mc % # of realizations per model tic % computing fragments "Eij" of D^2 % figure which terms Eij are actually need...
function ISO = IsoShadow(Y1,Y2,Y3,F,Nlvl,lvl) % A function for visualizing 3D level sets of a 3D ridge function % Yi: N by N matrix where N are the number of meshgrid points % F: N^3 by 1 matrix function evaluations paired with reshaped rows of Yi % Nlvl: The number of level sets over the observed range of F % lv...
function [output] = readData(s) % Read value returned via Serial communication output = fscanf(s); end
function vp = CalculezValProprii(d, s, m, tol) % Se calculeaza intervalele in care se gasesc valori proprii cu functia % IntervaleValProprii de la cerinta 4; r = IntervaleValProprii(d, s, m); n = length(d); if m > n m = n; endif % Se aplica metoda bisectiei pe fiecare interval in care se gaseste o % valo...
% Forest表格 % 数的种类(kind) 胸径(DBH) 株数(num) 受危害株数(num_ill) 幼苗株数(num_new) % %郁闭度Y,乔木层密度p1,更新密度p2,多样性指标mul,病虫危害比率p,火险等级h,土壤有机质含量t % %输入数据 area=1000*500/10000; %公顷 n_kind=input('请输入树种的数目):'); Forest=zeros(n_kind,5); for ii=1:n_kind string=['请输入第' int2str(ii) '种树的[胸径,株数,受危害株数,幼苗株数]:']; temp=input(string); For...
function keypress(hobj,event) figure('KeyPressFcn',@keypress);% function KEY=keyboardinput() global KEY; %设置figure的KeyPressFcn回调函数,以响应键盘按下的事件 % figure('KeyPressFcn',@keypress); % function keypress(hobj,event) %取得figure的CurrentCharacter属性值,并在命令窗口显示 % key=get(hobj,'CurrentCharacter'); KEY=0; ...
function vt=shiftGame(clv,t); % SHIFTGAME computes from the game v the t-shift game of v. % % Usage: vt=clv.shiftGame(t) % % Define variables: % output: % vt -- Returns the characteristic function of the % t-shfit game of v. % % input: % clv -- TuGame class object. % t -- epsilon ...
function [Tex_Euler, Axes_Euler, Axes_Aspect, strain] = ReadTexFile(pname, it_start, it_end,phase_index) % Reads texture and morphology matrices from TEX_PH#.OUT files for each % step % Input: % pname: path to texture files for a given point % it_start: the first deformation iteration % it_end: the final deforma...
function idx = closestval(a,b,w) % function closestval - find closest match to a given value % % syntax: idx = closestval(a,b) % idx = closestval(a,b,w) % % closestval(a,b) finds the index idx of the value in vector a closest to % the scalar b. For several identical nearest values, idx only returns the % first...
function [disconnected_inlier_point_indices, all_disconnected_inlier_point_indices] =... find_disconnected_inlier_point_indices(... disconnected_inliers, common_point_flags, group_assignments,... group_idx1, group_idx2) disconnected_inlier_point_indices = []; all_disconnected_inlier_point_indices =...
theta_timeline_corr=theta_timeline; end_ts=length(theta_timeline); theta_prev=theta_timeline(1); DTHETA_INF=-0.9*pi; DTHETA_SUP=0.9*pi; inf_chunk=zeros(end_ts,1); sup_chunk=zeros(end_ts,1); for t=2:end_ts-1 theta_prev=theta_timeline(t-1); theta_next=theta_timeline(t); Dtheta=theta_next-theta_prev; if...
function outp(~, value) disp(value);
function [Utr,S1]=slepEigsLaplacian(A,D,CONST_W,opts) [Utr,S1]=eigs(@Binline,size(A,1),max(CONST_W),'sa',opts); function y=Binline(x) y=D*x-A*x; end end
function [d, indices, newIndices]=findBedsWithVoxelizing() load('compsSideViewsAll') load('../../dataStructureForStatistics/bedrooms_2_with_dist_nametags.mat') load('compsHeightViewsAll') tic j=0; distToGround=zeros(0, 1); sizes=zeros(0, 3); distsToWalls=zeros(0, 4); indices=zeros(0,1); % clear comps; for ...
% ============================================ % Author: Alex Chen % email: alextpf@gmail.com % 2014 % ============================================ function tri = Triangulation(verts) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 1. Do Delaunay triangulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% verts = ve...
function [dj] = dJ(q, dq) global l1 l2 t1 = q(1); t2 = q(2); dt1= dq(1); dt2= dq(2); dj = [ -l1*cos(t1)*dt1 - l2*sin(t1+t2)*(dt1+dt2), -l2*cos(t1+t2)*(dt1+dt2) -l1*sin(t1)*dt1 - l2*sin(t1+t2)*(dt1+dt2), -l2*sin(t1+t2)*(dt1+dt2) ]; end
function [labels, data, word] = prep() load('./nips_1-17.mat'); cn = find(contains(docs_names, 'CN')); lt = find(contains(docs_names, 'LT')); ns = find(contains(docs_names, 'NS')); rows = sort([cn lt ns]); mycounts = counts(:, rows)'; labels = ones(1, length(rows)); names = docs_names(ro...
function [radar_UL,cov_UL] = tsp_radar_code_UL(ULcomm, radar_UL, radar_comm_UL, cov_UL,k) % radar code matrix update I = ULcomm.UL_num; Mr = radar_UL.TX; K = radar_UL.codelength; Nr = radar_UL.RX; %eta_B = radar_comm.Bmrchannelgains; eta_rt = radar_UL.channelgain; H_rB = radar_comm_UL.radar2BSchannels; %% Ar_k xi_UL_k ...
function test_label = improved_Recognition(X_trn_subt, X_tst_subt, W_trn, train_face_id) num_test_imgs = size(X_tst_subt, 2); X_test_Proj = X_tst_subt * W_trn(1:num_test_imgs, :) * W_trn(1:num_test_imgs, :)'; X_train_Proj = X_trn_subt * W_trn * W_trn'; num_train_imgs = size(X_train_Proj, 2); test_label ...
function StableObject_SSF(varargin) global screen try InitScreen(0); Add2StimLogList(); p=ParseInput(varargin{:}); objColors = p.Results.objColors; objRect = p.Results.rects; backContrast = p.Results.backContrast; backReverseFreq = p.Results.backReverseFreq; % for rev...
clc;clear; fprintf('**** Design of Screwjack ****\n\n'); %---------------------------------------- %----Design of screw----% W = input('Enter Load to be lifted (KN):'); Sst = input('Enter Screw material Tensile Strength (Mpa):'); Sss = input('Enter Screw material Shear Strength (Mpa):'); Pb = input('Enter Bearing press...
A = [3,2,5,4,6; 2,1,3,-7,8; 5,3,2,5,-4; 4,-7,5,1,3; 6,8,-4,3,8]; %******************************************** Maxtimes = 100; n = 5; e = 1e-7; V = diag(diag(ones(n))); for i = 1:Maxtimes Nodiag = abs(A) - diag(diag(A)); Max = max(reshape(Nodiag,numel(A),1)); [p,q] = find(Nodiag == Max); ...
close all; clear all; clc; addpath(genpath('./')) I = im2double(imread('house.tif')); SNR_0 = zeros(1,20); SNR_G = zeros(1,20); SNR_S = zeros(1,20); i = 0; for s = 0.01:0.1:2 i=i+1; [SNR_0(i) ,SNR_G(i), SNR_S(i)]=denoise(I,s)...
%This is anticausal T(z). The output is a structure with H,F,H such that T(z) = H (z^-1 - F)^-1 G function T = TF_T(sys) Klqr = sys.Klqr; P = sys.P; R_e = inv (sqrtm(( sys.R + sys.B'*P*sys.B )')); T.H = R_e*sys.B'; T.F = (sys.A-sys.B*Klqr)'; T.G = (sys.A-sys.B*Klqr)'*sys.W; % T.dim = siz...
s = [ 7.4142 4.1611 2.2523; 7.4045 4.4941 2.3438; 7.3988 4.2809 2.3565]; llim = 3.5; rlim = 5.5; n1 = 4:0.5:5; n2 = 4:0.5:5; cx=zeros(3,1); cy=zeros(3,1); figure('Position', [0 0 800 800]); xlim([llim rlim]); ylim([llim rlim]); p = get(gca, 'Position'); lx = get(gca, 'XLim'); ly = get(gca, 'YLim'); for i = 1:3 ...
function r = rand_bac( coherencesteps, totalsteps ) %r = rand_bac( coherencesteps, totalsteps ) % Generate random time series with bounded autocorrelation. % % This procedure returns a column vector of random numbers of length % TOTALSTEPS, whose autocorrelation is zero for lags greater than or % equal to COHER...
function haxs = plotXYpanels(t, x, y, tlims, xyaxslims, indz, haxs) % haxs = PLOTXYPANELS(t, x, y, tlims, xyaxslims, indz, haxs) % % inputs % - t: vector array of the independent variable. % - x: vector or matrix with first dependent variable. % - y: the other dependent variables, same size as x. % ...
% book : Signals and Systems Laboratory with MATLAB % authors : Alex Palamides & Anastasia Veloni % % % % z-Transform computation % Sequence of finite duration % problem 1 % a) f=[-3,5,6,7,8]; n=-2:2; syms z F=sum(f.*(z.^-n)) pretty(F) % b) n=0:4; F=sum(f.*(z.^-n)); pretty(F) %Sequenc...
function [stego]=conceal(msgVec1_CA,msgVec2_CA,cover,Delta,main_folder) YCbCr=rgb2ycbcr(cover); % RGB to YCbCr Cb=YCbCr(:,:,2); Cr=YCbCr(:,:,3); [C,R]=size(Cb); cd(strcat(main_folder,'\curvelet transform')); scales_fdct_Cb = fdct_wrapping(Cb,1,1); % take curvelet Cb ...
function rets = loadGenRets(time,bf,gen_rets_file,asset_n,flag) % this file constructs a path independent matrix of returns, loading % already generated scenarios and inserting them in such a way that % nodes belonging to the same time layer have the same descendants if nargin<5 flag=0; end t=length...
clear all; expall_init; atkFreeRevenue = 0.3150; atkDi=calcDI(50); attackTestPrHist=zeros(length(timeTrainDay),1); attackTestRPHist=zeros(length(timeTrainDay),1); Pr=50*ones(length(atkDi),1); attackVect=zeros(length(atkDi),1); maxAttack=10; PrDiffWindow=10; lastDecTime=1; maxDec=floor((max(timeTrainDay)-min(timeT...
load('GPL6244_Expr_intersect'); N=15507; ff = @(x)fitnessf(x,C,P); if max(size(gcp)) == 0 % parallel pool needed parpool % create the parallel pool end %options = gaoptimset('PlotFcns',@gaplotbestf); gaoptions = gaoptimset('Display','iter','UseParallel',true,... 'StallGenLimit',150); for k=16:30 tic...
%mnist data visualization clear clc %close all indices = [1 110 210 310 410 510 610 710 810 910];%randsample(COLS, 10000); if 0 figure; suptitle('Cross-encoder results part1'); ROWS=10; COLS=11; offset = 0; k = 1; for digit1 = 1:5 k = 1; digit2 = digit1+1; str_digit...
function sig_mix = conductivity_mixture(sig1,sig2,alpha) % Input: % sig1: conductivity of first component % sig2: conductivity of second component % alpha: ratio of two components. alpha = 1 for pure 2nd component % Output: % sig_mix: conductivity of mixture ...
function [ output_bits ] = brute_force_decode( input_bits, generators ) code_rate = 1/size(generators, 2); N = length(input_bits)*code_rate; best_dist = inf; % For every possibe N-bit sequence, s % 2^N-1 iterations for i=0:2^N-1 seq = dec2bin(i, N) == '1'; % encode sequence s as ...
function setColorSwitchRaw(colorSwitch) global trackingParams; trackingParams.colorSwitch = colorSwitch;
clear all; close all; addpath('./feature_util'); addpath('./edison_matlab_interface'); addpath('./matlabPyrTools'); %run('./vlfeat/toolbox/vl_setup'); datasets = {'PASCAL_S', 'ECSSD', 'DUTS_Test', 'HKU_IS', 'DUT_OMRON'}; gt_all_path = '../DATASETS/TEST/'; for dataset_id = 1:length(datasets) MatSaveDir = ['...
% vim: sw=2:ts=2 function sys=parse_netlist() ckt=Ckt; sys.E=ckt.C; sys.A=-ckt.G; sys.B=ckt.B; end
function [ x ] = triangular_pulse( input_args ) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here x = zeros(M,1); for n = 0:M-1 if (n <= M/2) end
function scrollfcn(hfig,evnt) gd=guidata(hfig); mousenew = get(gd.ax1,'CurrentPoint'); xy=mousenew(1,1:2); xl=get(gd.ax1,'xlim'); yl=get(gd.ax1,'ylim'); xrange=diff(xl); yrange=diff(yl); gd.xlims=[xy(1)-(xrange/2) xy(1)+(xrange/2)]; gd.ylims=[xy(2)-(yrange/2) xy(2)+(yrange/2)]; set(gd.ax1,'xlim',gd.xlims,... ...
function varargout = has_linsol(varargin) %HAS_LINSOL Check if a particular plugin is available. % % bool = HAS_LINSOL(char name) % % % % [varargout{1:nargout}] = casadiMEX(838, varargin{:}); end
function [eta c finalError] = findSolution(iniGuessEta, iniGuessC, g, h, L, sigma, options) % % % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % [eta c finalError] = findSolution(iniGuess, period, c,sigma,h) % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % % Usi...
% FINDENDSJUNCTIONS - find junctions and endings in a line/edge image % % Usage: [rj, cj, re, ce] = findendsjunctions(edgeim, disp) % % Arguments: edgeim - A binary image marking lines/edges in an image. It is % assumed that this is a thinned or skeleton image (or % nearly s...
close all, clear all, clc; z =load('d2noisy.txt'); x1 = z(:,1:2); y = z(:,3); figure plot3(x1(:,1),x1(:,2), y, 'o'); x = [ones(size(x1,1),1) x1]; trainingSamples = 50 ;%//number of rows in x numFeatures = 3 ;%//number of cols in x or number of constants theta = [0 0 0]'; maxIterations = 500000; %500000 iterations, e...
% Harris detector clear, clc, close all imageFiles = {'pink.jpg'}; for nImage = 1:length(imageFiles) % Load image img = imread(imageFiles{nImage}); img = im2double(img); imgGray = rgb2gray(img); figure(1); clf; imshow(img); title('Original Image'); % Calculate Harris corn...
% Chapter 4 - Electromagnetic Waves and Optical Resonators. % Program_4a - Iteration of the Ikeda Map. % Copyright Birkhauser 2013. Stephen Lynch. % Chaotic attractor for the Ikeda map (Figure 4.11(b)). clear echo off A=10; B=0.15; N=10000; E=zeros(1,N);x=zeros(1,N);y=zeros(1,N); E(1)=A;x(1)=A;y(1)=0; for ...
%define a line of a specified length n = input('Number of Needles:\n'); for i = 1:n x = 10*rand; y = 10*rand; theta = 2*pi*rand; x_values = [x,x + cos(theta)]; y_values = [y, y + sin(theta)]; line(x_values, y_values) end axis([0, 10, 0, 10]) % for j=1:n % if floor(x_values(j,1))==floor(x_values(j,2)) % ...
clear all close all clc tf = 20; p = [1;9.81;0.1]; x0 = [0;0]; %x0 = [pi;0]; u0 = 0.0; f0 = DynFunc(0,x0,u0,p); display(['Steady-state? f(x0,u0)= [',num2str(f0.'),']']) [A,B] = LinFunc(x0,u0,p); dx0 = [90*pi/180;0]; opt = odeset('MaxStep',1e-1); Dyn = @(t,x) DynFunc(t,x,u0,p); [t,x]=ode45(Dyn,[0 tf],x0+dx0,op...
%Graficos SVM % HP LS-SVM MSE load(['','results.mat']); figure(1) plot (Data.x, Data.y, 'b--o'); xlabel('Topología'); ylabel('LS-SMV MSE');
ALPHA = 0.5; SIGMA = 0.1; N = 500; % Total no. of customers K = 1; % Current no. of occupied tables TABLES = zeros(1,N); TABLES(K) = 1; THETA = zeros(2,N); THETA(:,K) = [rand;rand]; for i = 2:N table_prob = zeros(1,K+1); for k = 1:K table_prob(k) = TABLES(k)/(i-1+ALPHA); end ...
function [ sobel_img ] = SobelFilter(img) [m,n]=size(img); %m=height n=width disp('Begin SobelFilter'); sobel_img = img; SOBEL_CAP = 31; for y=2:n-1; for x=2:m-1; val = ((img (x + 1,(y - 1)) - img(x - 1,(y - 1) )) + (img(x + 1,y) - img( x - 1,y)) * 2 + (img(x + 1,(y + 1)) - img( x - 1,(y + 1)))); ...
function [box] = min_bounding_box_aligned(data_column_vectors) %minimum volume axis-aligned box bounding the given vectors % %usage %----- % min_bounding_box_aligned(data_column_vectors) % %input %----- % data_column_vectors = coordinates of data points as matrix of column % vectors % ...
%%%%%%%% PLOT ACCUMULATED MOTION DM %%%%%%%% function plotAccumMotionDM(motionA, accumParams) motionA.eccCount % notmalize protrusions and retractions for b=1:accumParams.numBinsEcc protrusionFront(b,:) = motionA.protrusionEccSum(b,:)/motionA.eccCount(b); retractionFront(b,:) = motionA.retractionEccSum(b,:)/mo...
clc, clear all params = load('results/optimize/inriaParametersGoChosenSmall.mat'); test = load('results/inriaTestSvmGoChosenSmallFinal.mat'); paths = load('paths'); % params.method.detectorArgs = {'type','square','scales',2.^(0:0.1:2),'spacing',1}; params.method.detectorArgs = {'type','square','scales',2.^(1.32:0.005...
clear all ; close all ; cd('C:\shared\badger\alex\Russell BADGER 2015-11-12') ; ls ref1 = load_untouch_nii('reg_mc_Test_Russell_2015_11_12_WIP_EEG-fMRI_MB3_3.75mm_SENSE_6_1.nii.gz') ; topup = load_untouch_nii('Test_Russell_2015_11_12_WIP_revEEG-fMRI_MB3_3.75mm_SENSE_12_1.nii') ; reptopup = repmat(topup.img,[1,1...
function [retVoterMask] = generate_voter_mask(voterec,scoresK,scoresK_id,... testpos, codebook, valid_vote_idx, imgsz, maskRadius) if(length(maskRadius)==1) maskRadius = [maskRadius,maskRadius]; end annolist = codebook.annolist; nb_test = size(testpos, 1); nhypo = length(voterec); retVoterMa...
% AERSP 458 Project 1 %% Case1 clear, clc format long r0 = [-1.7512, 2.0439, -2.6693]; %[LU] v0 = [-2.1843, -0.4926, 0.4740]; %[LU/TU] t0 = 0; t1 = 1.7; %[TU] mu = 4*pi^2; %[LU^3/TU^2] h = cross(r0,v0); p = norm(h)^2/mu; a = -mu*norm(r0)/(norm(r0)*norm(v0)^2-2*mu); e = sqrt(1 - p/a); alpha = 1/a; sigm...
%Stuart McDonald Problem 2 ECEN 5244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Correlation and standard deviation from problem % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sigma1 = 1 sigma2 = 2 sigma3 = 3 rho12 = 0.5 rho23 = -0.5' r...
%Optimum Alpha taken as 5.5 found from the previous code clc; clear all; close all; %generating random bits data = randi([0 1],1024,1,'int8'); %modulating as QPPSK symbols to generate X sym = nrSymbolModulate(data,'QPSK','OutputDataType','single'); sym = sym * sqrt(2); X = diag(sym); %generating F using meshgrid L =...
classdef (Abstract,Sealed) Viewer methods (Static) commandInfo = Info() Help(command) AddPolygons(polygonsStruct) CaptureSpinMovie() ImageOut = CaptureWindow() ClearAllTextures(BufferType) ClearTextureFrame(Frame,BufferType) Close() DeleteAllPolygons() Init(pathStr) InitVolum...
function mapFind(m,k)
% This is material illustrating the methods from the book % Financial Modelling - Theory, Implementation and Practice with Matlab % source % Wiley Finance Series % ISBN 978-0-470-74489-5 % % Date: 02.05.2012 % % Authors: Joerg Kienitz % Daniel Wetterau % % Please send comments, suggestions, bugs,...
function [ Data ] = HighlightRegions( Data, CC, RegionIdx, HighlightVal ) %HighlightRegions returns an image with the selected pixels highlighted % Pixels are fed by their RegionIdx, which is the pixel location in % singular array format if(isfloat(HighlightVal)) for x=(1:numel(RegionIdx)) Data(CC.Pix...
function out = model % % BPMFC.m % % Model exported on Sep 11 2019, 15:13 by COMSOL 5.1.0.234. import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model'); model.modelPath(['D:\OneDrive - business\Work\2D' native2unicode(hex2dec({'6c' 'e2'}), 'unicode') native2unicode(hex2dec({'6d' '6a'}...
function [output]=DACss2(fs, Inom, Vini, R, Co, Ri, Rsi, Ci) % [output]=DACss2(fs, Inom, Vini, R, Co, Ri, Rsi, Ci) % Creates a state-space model of one output channel of a current-steering % DAC and simulates one switching period. fs is the sampling frequency, Inom % is a vector containing the nominal current values o...
function experimentInfo = getExperimentFeatures() experimentInfo(1).type = 'chr2_during'; experimentInfo(2).type = 'chr2_between'; experimentInfo(3).type = 'arch_during'; experimentInfo(4).type = 'eyfp'; experimentInfo(5).type = 'arch_between'; for iExpt = 1 : length(experimentInfo) switch experimentInfo(iExpt).t...
function [ A_row ] = plate_10_A( plate_idx, p, p0, p1, p2, p3, p4, p5, p6, M_x_max, M_y_max, N_max, N_10, d_x, d_y, d_z, epsilon, epsilon_b, Epsilon_0 ) A_row = zeros(1, 2); % A_row = zeros( 1, M_x_max * M_y_max * ( N_max + N_10 ) ); if plate_idx A_row(1) = p0; A_row(2) = 1; % center point else warning(...
%digitDatasetPath = fullfile(matlabroot,'toolbox','nnet','nndemos', ... % 'nndatasets','DigitDataset'); addpath ../data/; trainimages=LoadImage('../data/train-images-idx3-ubyte'); trainimages=reshape(trainimages,28,28,1,[]); trainlabels=LoadLabel('../data/train-labels-idx1-ubyte'); trainlabels(trainlabels==0)=10; te...
function killevery2ndytl ytl=get(gca,'yticklabel'); for yy=2:2:numel(ytl), ytl{yy}='';end; set(gca,'ytickLabel',ytl)
function PostWrapper(problemnameArray, solvernameArray, repsSoln) % Take post-replications at solutions recorded during previous % runs of solvers on problems. % Inputs: % problemnameArray: structure listing the problem names % solvernameArray: structure listing the solver names % repsSoln: number of replications for ...
clear; clc; % designate a subset of files to process (or leave it empty to process all) % TODO: Make this a number or the indicators a string? %FP_PROC_SUBSET = [ "0129", "0124" ]; FP_PROC_SUBSET = [] % change these to the relevant locations on your disk FP_RAW_FILE_DIR = 'C:\Users\zls5\Desktop\Zach\Hao'; % raw file ...
clc; close all; clear; load('Y.mat'); load('X.mat'); % load('X_noisy.mat'); % X = X_noisy; iterations = 850; stepsize = 0.0001; [~, error_per_iter] = gradient_ascent_fixed(X,Y,stepsize,iterations); clear weights X = [X, ones(size(X,1),1)]; [weights, error_per_iter_cons] = gradient_ascent_fixed(X,Y,stepsize,itera...
sig2 = 0.4; gam = 10; crit_L1 = bay_lssvm ({ Xtrain , Ytrain , 'f', gam , sig2 }, 1); crit_L2 = bay_lssvm ({ Xtrain , Ytrain , 'f', gam , sig2 }, 2); crit_L3 = bay_lssvm ({ Xtrain , Ytrain , 'f', gam , sig2 }, 3); %The model can be optimized with respect to these criteria: [~, alpha ,b] = bay_optimize ({ Xtrain , Ytrai...
function ode_in = bodies2odein(Bodies) num_bodies = length(Bodies); ode_in = zeros(1, 4*num_bodies); for n = 1:num_bodies ode_in(2*n-1) = Bodies(n).Xpos; ode_in(2*n) = Bodies(n).Ypos; ode_in(2*n-1 + 2*num_bodies) = Bodies(n).Xvel; ode_in(2*n + 2*num_bodies) = Bodies(n).Yvel; end end
function retVal = lookInDatabase( A, Database ) % >> Internal fuction. Not really to be used directly.. unless you have % a Masters in Messing-Around. % Takes an image A, computes its SURF points and descriptors, and % matches them with any of those present in `Database` (which is a % cell-array). ...
function drawGrid(occupancy_grid, dim, resolution, colour) %DRAWGRID Draws a cube representation of the occupancy grid [row, col, plane] = ind2sub(size(occupancy_grid), find(occupancy_grid == 1)); nPoints = numel(row); for i = 1:nPoints cell = [row(i); col(i); plane(i)]; pos = dim(:,1) + (cell-0.5) .* resolut...
function dim = size(s,r,param) % Copyright 2012 The MathWorks, Inc. dim = [s r];
%% default setting clear; close all; % get video video = VideoReader('./jump/shahar_jump.avi'); % video = VideoReader('./bend/shahar_bend.avi'); % video = VideoReader('./skip/shahar_skip.avi'); w = video.Width; h = video.Height; m = int16(video.Duration * video.FrameRate); % calling with default method which is interfr...
function G = approxfcn(F, range) %APPROXFCN Approximation function. % G = APPROXFCN(F , RANGE) returns a function handle, G, that % approximates the function handle F by using a lookup table. % RANGE is an M -by -2 matrix specifying the input range for each of % the M inputs to F. num_inputs = size(range, 1); ma...
function [sv1,sv2,u]=fpreadsc(fname) % FPREADSC reads the unformatted data EXPORTED by FlexPDE on a rectangular grid. % % Description: % This utility function reads the unformatted % data EXPORTED by FlexPDE using SURFACE/CONTOUR % plot commands. % Limitation: Acts only on rectangular domains. % This code has ...
clear all; clc; % Replace the strings with the correct numbers x = -20:1:20; % Replace the strings with the correct numbers % Calculate the function y = 2*exp(-0.2*x); % Plot the function plot(x,y,'-x','LineWidth', 2, 'Color', 'blue') xlim([-10 10]) % X label and Y label xlabel('ap') ylabel('gr')
pkg load image useful_functions; # NB this needs to be included if video_analysis hasn't just been run STATS_SZ = 120; BKP_ROOT = '%03d.bkp'; # make directory path match location of bkp files BKPS = {{10, 10, 0}, # the number of video i.e. ..024.bkp.. padded with zeros to width 3 {11, 6, 0}, # followed by tm ...
clear %close all clc % INPUTS =============================================================== g = 9.8; theta = 30; b = 0.5; x0 = 0; y0 = 0; v0 = 10; tSpan = [0 2]; % SETUP =============================================================== vx0 = v0*cosd(theta); vy0 = v0*sind(theta); s0 = [...