text
stringlengths
8
6.12M
function a = fn_readimg(fname,flag) % function a = fn_readimg(fname[,'permute']) %--- % read image using imread, and handles additional features: % - converts to double % - detects if color or gray-scale images (in the last case, use a 2D array per image) % - can read a stack of images (returns 3D array) % % images are...
function [colonyEdgeIdx, colonyEdge] = specifyRegionWithinColony(colonyState, regionWidth) %% returns indices corresponding to the region with high activator values % colonyEdgeIdx: pixels in the colony edge. distmatrix = bwdist(imcomplement(colonyState)); [row, column] = find(distmatrix>0 & distmatrix<=regionWidth); ...
function [Hp_linf, G] = findHpl_inf1(Iloc) % algorithm no.1 to find Hp(l_inf) % predefined points P1 = [163 274 1 435 71 1 257 355 1 513 105 1]; P2 = [349 270 1 25 48 1 416 201 1 93 20 1 ]; % first intersection with l_inf l1 = cross(P1(1,:), P1(2,:)); l2 = cross(P...
%% Mod_EstOLS Function % Goal: % Use OLS to estimate the VAR model and provide VAR results. % If specified, run short run restriction and provide SVAR results. % Input: % Input 1: Model setup from Mod_setup. % Input 2: Order of variables. Write [] if doesn't want to identif...
Hyy_coor = [61.85, 24.29]; % Hyytiälä coordinates figure; figsize=[1 1 1000 1000]; % set up size of figure, in pixels here set(gcf,'Position',figsize) mh = worldmap('europe'); % plot worldmap setm(mh,'MLabelLocation',10); %set location of longitude labels map_box=[-45 45;45 90]; % set part of world to be plotted % ne...
%% Declaration of Authoriship % This code was written by Dirk DeVilliers and some portions were edited by Jason K. George % for the purpose of his final year project at Stellenbosch University % in partial completion for the subject Project (E) 448 %% Code function [y_out] = interferometric_fringe_dir(z) %% Calculating...
function plotBurstAmpDurScatter(R,BB,condsel) if ~isfield(R,'condcmap') R.condcmap = jet(numel(condsel)); end % if isfield(R,'condnames') % R.condname = R.condnames; % end if nargin<3 condsel = 1:size(BB.AEnv,2); end if nargin<3 condsel = 1:2; end for cond = condsel if BB.plot.durlogflag A ...
function EER = runMonteCarlo() % Adding paths: addpath('2/1','2/2','2/3','2/4','2/5') % Running 1'th Experiment: EER{1}{1} = Database1_1_MC(); EER{1}{2} = Database1_2_MC(); EER{1}{3} = Database1_3_MC(); EER{1}{4} = Database1_4_MC(); % Running 2'th Experiment: EER{2}{1} = Database2_1_MC(); EER{2}{2} = Database2_2_MC();...
function [ceq,gradceq]=dynConst2(x,p) % both ceq and gradceq need to be reshaped later ceq = zeros(2*p.numJ*(size(x,2)-1)-1,1); gradceq = zeros(size(x,1),size(x,2),size(ceq,1)); for i=1:size(x,2)-1 % since we use x as optimized variable, we use 's' for joint states s1 = x(1:2*p.numJ,i); s2 = x(1:2*p.nu...
% ASLtranslate % Author: Andrea Murphy % Date: Spring 2020 % DESC: Evaluate the classifier on the validationSet confMatrix = evaluate(categoryClassifier, validationSets); % Compute average accuracy mean(diag(confMatrix));
function display = setDefaultDisplay % display = setDefaultDisplay % % Most of our expTools code relies on a display calibration. If no % calibration file is specified or available, then set some default % values. These are the default values. % display.screenNumber = max(Screen('screens')); [width, height...
% function [] = Move_No_Wait(VCS) % does something coole... % Johannes Rebling, (johannesrebling@gmail.com), 2019 function [] = Move_No_Wait(VCS,pos) if pos > max(VCS.RANGE) || pos < min(VCS.RANGE) short_warn('Requested position out of range!'); else pos = VCS.MM_To_Steps(pos); % convert to steps VCS.D...
function [RSInfo] = VRC_RS(f,RS_Rad,VRC_ID,VRC_RSseed,ClusterInfo,RSInfo) %% RangeSearch Analysis %% if VRC_ID(1,1) == 1 && VRC_RSseed == 1 RSInfo(f).SeedBoundingBoxes = ClusterInfo(f).Ch1.BoundingBoxes; RSInfo(f).SeedCentroidCoords = [ClusterInfo(f).Ch1.ClusterCentroidsY ClusterInfo(f).Ch1.Cl...
function [Q,R] = DeleteColQR(Q0,R0,k) % function [Q,R] = DeleteColQR(Q0,R0,k) % Update a QR factorization after a column has been deleted. % Q0 is mxm orthogonal, R0 is mxn upper triangular with n<=m, 1<=k<=n % and w is mx1. % Q is mxm orthogonal, R is mx(n+1) upper triangular so that % QR = [A(:,1:k-1) A(...
y0 = 0; t0 = 0; hlist = 2.^(-(1:10)); f = @(t,y) 1+y.^2; for k = 1:10 h = 2.^(-k); [ylist,tlist] = heun(f,y0,t0,h,10-1); plot(hlist,tlist); hold on end
%--- LINEAR COMBINATION IN SOUND fs = 44100; N = 145000; M = 4; % signal 0: "Alas, Poor Yorick!" load hamlet.mat hamlet = 2*alas(1:N); subplot(511) stem(hamlet(1:10000), 'b', 'Marker', 'none', 'LineWidth', 1); title('Hamlet', 'FontSize', 12); sound(hamlet,fs); % sine wave n = 0:N-1; sinewave = 0.99*cos(2*pi/200 * n...
function [pkgNameStr] = pkgName(varargin) % Get name for the package (CIAtah by default). % Biafra Ahanonu % started: updated: 2021.03.16 [‏‎14:39:41] % inputs % % outputs % % changelog % % TODO % %======================== % DESCRIPTION % options.exampleOption = ''; % get options % options = getOp...
function data = importThermo(varargin) % ------------------------------------------------------------------------ % Method : importThermo % Description : Read Thermo data files (.CF) % ------------------------------------------------------------------------ % % -----------------------------------------------------...
function [] = printCNN(net) i=0 for i= 1:37 if (net.layers{i}.type == 'conv') size(net.layers{i}.biases) size(net.layers{i}.filters) fprintf('======================================') end end
function [filename, filepath] = amdarFilename(fileDate) %AMDARFILNAME Returns the filename for a given date. % %INPUTS: % filedate - Integer in Matlab date format. % %OUTPUTS: % filename - String % %SYNTAX: % filename = amdarFilename(filedate) % %NOTES: % The filepaths presented here are hard-coded as an example....
function x = cramer(A,b) [n,n] = size(A); for j = 1:n B = A; B(:,j) = b; x(j) = det(B)/det(A); end x = x';
function c = c_mtx_add(M, N) % return number of complex operations c = M * N;
%FindProperPeaks函数筛选出边界点位置并返回它们 function location = FindProperPeaks(pks,locs) a = [-pks';locs']; a =a'; aa = sortrows(a,1); location(1) = aa(1,2); location(2) = aa(2,2); end
function [ train_warped,test_warped ] = temporal_warping( template_signals,template_lengths,train_signals,train_lengths,test_signals,test_lengths,warping_window_size,debug ) disp(' Temporal Warping...'); train_warped = zeros(size(train_signals,1),size(template_signals,1),size(template_signals,2),[]); f...
function display(sys) %DISPLAY Display the properties of a POLYSYS model in the Command Window. % 7.20.2007: TJW - Initial coding. % 7.22.2007: TJW - Changed class name from twpds to polysys. %% Collect necessary information. % Get format spacing from command window isLooseDisplay = not(isequal(get(0,'FormatSpacing...
function [ordered_cell1,ordered_cell2] = order_cell(H,C,cpi,cluster_order1,cluster_order2,a) [I_top2,H_t1,H_t2] = toptwo(H); %get the order of cells along each transition trajcetory [ordered_cell1] = ordercell_alongl(H,H_t1,H_t2,I_top2,cpi,cluster_order1,a); CPI_o_cell(cluster_order1,ordered_cell1,C,cpi) [ordered_cell2...
clear all addpath /home/leonhard/spm8_r4667/ spm('defaults','eeg'); addpath('/data1/sleep/meg/scripts') global rootDir rootDir = '/data1/sleep/meg'; cd(rootDir) s = ['find -L -mindepth 3 -maxdepth 4 -type d '... '| grep -E ".*subj[0-9].*sleep.*_0[1-2]\.ds$" '... '| sort -n > folderList_subjMegDirs.txt'] syst...
%% Step 2 in the arm tracking process. % Bring in first skeletonization of the arm and remove branches to yield single arm. % eb version %% Import first skeletonization video %this code will improve the results of the skeletonization. imp = 1; %import new file? % open videos if imp == 1 clear all ...
%Creating program to perform scaling about a fixed point %For coordinates of actual quad object P for i = 1:4 fprintf('Enter x-coordinate of pt.%d :', i); x(i) = input(''); fprintf('Enter y-coordinate of pt.%d :', i); y(i) = input(''); end P = ones(3,4); P(1,:) = x; P(2,:) = y; %Ente...
classdef conv1d_diffusion < conv1d %CONV1D_DIFFUSION Summary of this class goes here % Detailed explanation goes here properties end methods end end
function ExtractFrame % This function extracts frame from a video and outputs image file on the % directory of the video. % Feel free to modify such that it receives filename, more complex for loop % input, etc. clc; clear all; workingDir = 'C:\Users\Yeshara Packirisamy\Documents\UCT\Fourth Year 2018\Thesi...
nr_sub = 200; consistent_with_SAT_TTB = zeros(nr_sub,2,2); consistent_with_SAT_TTB2 = zeros(nr_sub,2,2); consistent_with_SAT_TTB3 = zeros(nr_sub,2,2); consistent_with_TTB = zeros(nr_sub,2,2); for sub = 1:nr_sub % if data.isFullyRevealed(sub) for s = [1,0] if s==1 SAT_threshold = 7; ...
function out1 = hess_grf_ceq_heel520(in1,toe_th,dmax,cmax,k,us,ud) %HESS_GRF_CEQ_HEEL520 % OUT1 = HESS_GRF_CEQ_HEEL520(IN1,TOE_TH,DMAX,CMAX,K,US,UD) % This function was generated by the Symbolic Math Toolbox version 8.4. % 23-Jun-2020 10:35:31 out1 = 0.0;
function [R_ok,RMSE,ubRMSE,fRMSE,BIAS,POD,TS,FAR,p]=calc_performance(OBS,SIM,N) OBS(isnan(SIM))=NaN; if N==1; OBS_N=OBS; SIM_N=SIM; end if N>1 OBS_N=time_res_sum(OBS,(N./2)); SIM_N=time_res_sum(SIM,(N./2)); end % SPAN=round(30/N); % for ii=1:size(OBS_N,2) % OBS_N(:,ii)=(OBS_N(:,ii)-ANOM(OBS_N(:,ii),...
function d=zad5_diffusivity_hm(vk,t,mi) v=vk*1e6; eps=9.58./v-1.12; mi=mi.*1000; d=1.25.*1e-12.*(v.^(-0.19)-0.292).*t.^1.52.*mi.^eps;
function [] = load_domain_in_kidnapping_list (Domain,BC,InitialVertexReference) % % [] = load_domain_in_kidnapping_list (Domain,BC,InitialVertexReference) % % This function tries to find boundary borders in the existing grid. % If these borders are not present in the triangulations the funcion % updates Kidnappi...
function T_true = NewtonMethod(Lamda_eqv1,Lamda_eqv2,T_ap0,T_a1,T_a2,TOL,N_MaxIt,alph_absor) % Newton's method: solving the true temperature T given two apparent temperatures Ta1 and Ta2 % define variables c2_planck=(1.98644*10^-25)/(1.3806*10^-23); Lamda_eqv1=Lamda_eqv1*10^-9; % Convert unit from nm to m Lamda_...
% Taken from 'Orbital Mechanics for Engineering Students' by Howard Curtis % URL: http://courses.washington.edu/aa31008/AA310TextAppendixD.pdf %This function uses Newton?s method to solve Kepler?s % equation E - e*sin(E) = M for the eccentric anomaly, % given the eccentricity and the mean anomaly. % % E - eccentric ano...
function [H, h] = mklsrdat(N, M, L, r, zlag) % MKLSRDATA make data arrays for least-square approximation with % autocorrelation data % [H, h] = MKLSRDAT(N, M, L, r, zlag) % (c) Lehrstuhl fuer allg. Elektrotechnik und Akustik % Ruhr-Universitaet Bochum % (p) 27.05.1994 A. Raab % form all v...
function [white_circle,count]= white_circle(im_blank,center,radius,angle_array) x = center(1) + radius*angle_array(1); y = center(2) + radius*angle_array(2); im_blank(round(x)+size(im_blank,2)*round(y))=255; %Create circle boundary bw_circle=imfill(im_blank,[center(1),center(2)]); %Fill in the circle count=nnz(bw...
function [mAP] = cal_precision_multi_label_batch(B1, B2, data_label, query_label) mAP = 0; for i = 1 : size(B2, 1) F = bsxfun(@minus, B2(i,:), B1); F = abs(F); F = sum(F, 2); [~, ind] = sort(F); n = size(B1, 1); d = bsxfun(@plus, data_l...
clc syms x ; N = 10;%taking matrix of N*N size(N=2,3,4,5,10,20) A=zeros(N);%matrix A with zero values f=zeros(1,N);%vector f of 1*N size for i=1:N%iteration to get matrix A and vector f %f = sin(i*pi*x); a1 = @(x) (i*pi*cos(i*pi*x)).*(i*pi*cos(i*pi*x));%defining function a1 for matrix A a2 = @(x) ...
function [pix2x, pix2y] = pix2xy %pix2xy %For converting pixel numbers to xy %Initilization pix2x = zeros(1024, 1); pix2y = zeros(1024, 1); for kpix = 0:1023 jpix = kpix; ix = 0; iy = 0; ip = 1; while 1 if jpix == 0 break else id = mod(jpix, 2); ...
function [P,E,C] = mllsqr(X,Y,E) % P -> Parameters % C -> Covariance if nargin < 3 || isempty(E) P = (X'*X)^-1*X'*Y; C = sum((Y-X*P).^2)*(X'*X)^-1/(size(X,1)-size(X,2)); E = diag(C).^(1/2); else W = diag(1./E.^2); P = (X'*W*X)^-1*X'*W*Y; C = (X'*W*X)^-1; E = diag(C).^(1/2); end end
% FILTRACIA % % Sluzi na nacitanie parametrov filtracie % % Spusta - TESTFIL % SPAT - VYB_FIL % % Ak uz bola vykonana nejaka filtracia, moznost vyberu - IDENTIFIKACIA - ID_PARAMETRE % a predtym vykona: clear ic2,clear color,id_parametre, % Kde: % "ic2" je pomocna premenna, ktora informuje, ze uz sa vyko...
function [howmany,subscripts,centercomma,parens]=hasoutput(i,whichword) declare_globals howmany=0;subscripts=[];centercomma=[];parens=[];out=0; temp1=find(~isspace(funstr{i})); temp1=temp1(temp1<funstrwords_b{i}(whichword)); if isempty(temp1) howmany=0; else [outflag]=inbracket(i,funstrwords_b{i}(whichword),funstr); ...
addpath '/usr/local/lib/matlab/ddxmatlab' addpath '.' clear all; %% initialize avalon = ddx_init(); joystick_control = 1; T_sim = 20000; delta_t = 1/5; t = 1; alpha_rudder = deg2rad(0); aoa_sail = deg2rad(20); %% control loop while t < T_sim [localization, control, wind, gps, rudderstate, sailstate, joys...
function [pi ii] = polyxmesh(V,F,L) % POLYXMESH Find intersections between a line and a mesh % % [xi, yi, ii] = polyxmesh(V, F, x1, y1) % % Inputs: % V #V by 3 list of mesh vertices % F #F by 3 list of indices into V representing faces % L list of (x,y,z) coordinates of knot points for spline to check intersec...
function CustomParamFigControl2(option1,option2,option3,option4) % function CustomParamFigControl(option1,option2,option3) % This function controls CustomParamFig % Initial Call: % option1: Model Name % option2: Parameter text list % option3: Parameter value list global vinf...
% Read JSON file and overlay the annotations on the original image close all; root = './DICOM_annotations'; slice_number = 220; directory = fullfile(root, strcat('slice_', num2str(slice_number))); CT_slice_location = fullfile(directory, strcat('slice_', num2str(slice_number), '_CT.dcm')); US_slice_location = fullfile(d...
function R = rotate_3D(V, mode, theta, u) % Function to compute the rotation of a vector in 2D and 3D spaces. % % Copyright and support % (c) Nicolas Douillet 2018, nicolas.douillet (at) free.fr % %%% Syntax % R = rotate_3D(V, mode, theta, u) % %%% Description % R = rotate_3D(V, mode, theta, u) computes the vector R, w...
function c = tapas_hgf_binary_LJM_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % LJM HGF experiments - alternative config file % % % What we modified: % Omega priors: om3: sigma = 0 % om2: sigma = 256 % % % Why: To allow for more heterogene...
function h = mark3D(xyz, varargin) % MARK3D % % Description: % Wrapper for Matlab plot3 function with SBFSEM-tools keys, defaults % and auto splitting of XYZ inputs for fast command line use % % Syntax: % h = mark3D(xyz, varargin); % % Inputs: % xyz X, Y and ...
function f = atmosphere(CdFunct,m,h0,t,y) h = h0 - y(1); % Constants G = 6.67*10^-11; M = 5.9723*10^24; re = 6371000; R = 287.058; gamma = 1.597; % Include Mach a = sqrt(gamma*R*temp(h)); Ma = y(2)/a; % Improve drag % [u, k] = viscosity(h); % Be = P*(L^2)/(u*k); % Re = u*L/k; % Cdcalc = (Sw*Be)/(Sf*(Re^2)); % Modif...
function img_new=occlusion(img,r) %find the 0 part img_ini=[inf(size(img,1),r) img]; img_ini=[img_ini inf(size(img,1),r)]; k=find(img_ini==0); img_new=img_ini; store=inf(size(img,1),2); for i=1:r img_mimic_right=circshift(img_ini,[0,i]); %right shift img_mimic_left=circshift(img_ini,[0,-i]);%...
clc; clear all; fs = 44100; f = fopen('outputdouble.txt'); datay = textscan(f,'%s'); fclose(f); y = str2double(datay{1}(1:1:end)); audiowrite('izlaz.wav',y,fs); % player = audioplayer(y, fs, 24); % play(player);
close all clc Y1 = 1; f = @(t,Y) [Y(2); Y1]; y1 = linspace(-2,8,20); y2 = linspace(-2,2,20); [x,y] = meshgrid(y1,y2); u = zeros(size(x)); v = zeros(size(x)); t=0; % we want the derivatives at each point at t=0, i.e. the starting time for i = 1:numel(x) Yprime = f(t,[x(i); y(i)]); u(i) = Yprime(1); v(i) = ...
function firstlevel_fir_nh hostname = char(getHostName(java.net.InetAddress.getLocalHost)); switch hostname case 'DESKTOP-3UBJ04S' base_dir = 'C:\Users\hipp\projects\WavePain\data\fmri\fmri_temp\'; n_proc = 2; case 'revelations' base_dir = '/projects/crunch...
function [cell,edge,vtx,tie]=InitialSetting2DMonolayer(initprm, r, INIT_VER) vtx.pos(1:length(r.x),1:2)=[r.x' r.y']; %% number if INIT_VER==1 cell.numb=initprm.cnumb; vtx.numb=initprm.cnumb*2; edge.numb=initprm.cnumb*3; tie.numb=initprm.cnumb*2; elseif INIT_VER==2 cell.numb=initprm.cnumb; vtx....
clear close all clc nr_car =64; %Number of total carriers nr_training_bits = 12; %Number of training bits in the begining of the frame (no OFDM) length_cpre = 10; %Prefix length length_suf = 4; %Suffix to cope with the infl...
%ABSTRACT % Library function for SDCM. Standardize in 2D (both rows and cols) to get rid of tumor load and gene affinity effects as preparation for smooth neutralization (form of whitening). function SD2D4L2Rs = std2D(L2Rs,fcnVar,epsilon) %Initialize: %if(nargin<2) fcnVar = @(X,dim)nanvar(X,0,dim); end ...
function [ax, obj, cbar] = draw_tricorrmat_withbubbles(ax, data, labels, cmap, bubble_sizelim, figure_ticksize, colorbar_ticksize, show_grid) % draw_tricorrmat_withbubbles.m % % Draw lower triangular part of correlation matrix using a blue-white-red % colormap % % Inputs: ax : axis handle to plot on % ...
clear all;clc; basepath = 'E:\Business and friend work\Robert Fromeki\Fiber photometry Analysis-20220818T172908Z-001\Fiber photometry Analysis\FP files'; %% path to folder files = dir(basepath); for ii = 3:length(files) cd([basepath,'\',files(ii).name]); datafiles = dir(pwd); for jj = 3:length(dat...
function features = extractMBFDFeatures(C, modes) % features = extractMBFDFeatures(C, modes) % % Extracts mode-based first digit features from the supplied array of % JPEG coefficients. % % ------------------------------------------------------------------------- % Written by Paweł Korus while with SZU and AGH % Curr...
function [vecpow,vecpow2]=ps_rip3(p,q,w) [ran]=rip_select(p); p=p(ran); q=q(ran); for j=1:length(p) %Hippocampus F = fft(p{j}(1,:)); pow = F.*conj(F); vecpow(1,j)=sum(pow); %Other brain area F2 = fft(q{j}(w,:)); % w is either 2 or 3 pow2 = F2.*conj(F2); ...
clc clear all; close all; N = 512; % number of symbols Nb_s = 2; % number of bits per symbol Nb = N * Nb_s; % number of bits L = 32; lambda = 0.2; sigma = 1; bits = round(rand(Nb,1)); %random bits generation. H = eye(N); c_index = 2*bits(1:2:end) + bits(2:2:end) + 1; C = 2^(-0.5) * [1+1j , 1-1j , -1...
function T34 = jointToTransform34(q) % Input: joint angles % Output: homogeneous transformation Matrix from frame 4 to frame 3. T_34 % PLACEHOLDER FOR OUTPUT -> REPLACE WITH SOLUTION T34 = zeros(4); % Rotation angle between frame 4 and frame 3 t = q(4); % Rotation Matrix from frame 4 to frame 3 C34 =...
function [ Quality ] = EstimateJPEGQuality( imIn ) % This function estimates the quality of a JPEG image that has been % loaded using "jpeg_read" from the MATLAB JPEG Toolbox. The algorithm % is taken from http://fotoforensics.com/tutorial-estq.php % % Copyright (C) 2016 Markos Zampoglou % Infor...
%% This code got really annoying b/c I accidentally saved every variable in % the workspace when I previously saved the data files. % This means that various counters can be overwritten when we read in the % datafile, so we had to use different variable names here. % the variable 'h' is assumed and it is stored in so...
function [subject,checked,error_msg_array] = checked_subject_data(subject_file_info,properties) checked = true; subject = struct; subject_info = load(fullfile(subject_file_info.folder,subject_file_info.name)); subject.name = subject_info.name; root_dir = subject_file_info.folder; erro...
% close all;clf; % % xmin=-0.5; xmax=0.5; ymin=-0.5; ymax=0.5; % % xres = 400; yres = 400; % % x = linspace(xmin,xmax,xres); % % y = linspace(ymin,ymax,yres); % % z = ones(yres,1)*x + 1i*y'*ones(1,xres); % % f = exp(1./z); % % p = surf(real(z),imag(z),0*f,angle(-f)); % % set(p,'EdgeColor','none'); % % caxis([-pi,pi]), ...
function [x C d] = project_affine(v, A, b, C, d) % PROJECT_AFFINE Project a point into an affine set. % % project_affine(v,A,b) is the projection of v onto % the affine set { x | Ax = b }. % % You can also call the function as % % [x C d] = project_affine(v,A,b); % % and then call it again with different...
function [u]=qpsk(bitArray, tSampling, tPulse, ampPulse) %QPSK Map the bitarray to QPSK symbols % % Arguments % % bitArray : A logical vector % tSampling : Sampling interval % tPulse : Pulse duration % ampPulse : Pulse Amplitude % % Returns % % u : The complex QPSK signal assert(mod(length(...
function obj = plot(obj,varargin) %@fmagnitude/plot Plot function for fmagnitude objects. % OBJ = plot(OBJ,VARARGIN) plots the FFT amplitude. % % These are the optional input arguments: % ShowDC - flag specifying that the DC amplitude should be % plotted as well. % NormRange - array specifyi...
clear all; % This file calculates and plots the euler approximations for elements A, % B, and C when A is added at a constant rate P in both linear and semilogy % scales. This file was used to solve problem 3.1.7 in Project 1 for APPM % 2360 Fall 2018 % Define constants and N_A'(t) k_A = 1/5; k_B = 1/15; A_0 = 15000;...
function ShowPolyOfMatrix() % function ShowPolyOfMatrix() % Horner's method for polynomials in a matrix. % GVL4: Section 9.2.4 clc fprintf('Horner''s method for polynomials in a matrix\n\n') n = 1000; q = 17; b = randn(q,1); [A,R] = qr(randn(n,n)); I = eye(n,n); % Fully exploiting Horner's rule requires 6 ...
function [payoff] = payoff_dual_opt_short(S) % S 是一个序列 % payoff 为二种情况:跌幅< 5% payoff = 1%; % 跌幅>5%: payoff = 12%; upper = 1; middle = 1/12; S0 = 1; K1 = 0.95; ST = S(:, end); payoff = ones(size(ST)) .* middle; payoff(ST < K1) = upper; end
%crop images and depth maps to be square function cropped = cropImages(image) cropped = image; %crop to square with average zero disparity leftedge = round((size(cropped.imRGB, 2)/2) - (size(cropped.imRGB, 1)/2)) - cropped.median_pixel_disparity; leftedge2 = round((size(cropped.imRGB, 2)/2) - (size(cr...
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % scheduleVisualizationResource.m % Function to visualize the schedules according to resource % Input: % - APs - processors % - APPs - total application set % - Tasks - total task set % - Msgs - total message set % - CommonTaskSchedules - common task ...
clear nr_iteration_max=20; nr_bloc=10000; nr_data_bits = 1000; nr_bits_per_symbol = 1; memory=3; number_input=1; number_state=2^memory; % epsilon=0.18; Poncture1=[1,1,1,1,1,1,1,1]; %Poncture2=[1,1,1,1,1,1,1,1]; %Poncture3=[1,1,1,1,1,1,1,1]; Poncture2=[1,0,0,0,0,1,0,0]; Poncture3=[0,0,1,0,0,0,0,1]; %Poncture2=[1,0,0,0,0...
clear; clc; warning('OFF'); sInterferenceFolder = 'C:\sse\iot_test\recording\'; % sScaledInterferenceFolder = 'C:\sse\iot_test\recording\'; % %-------------------------------------------------------------------------- % Calculate average RMS for all recordings %--------------------------------...
function varargout = capab(varargin) % CAPAB MATLAB code for capab.fig % CAPAB, by itself, creates a new CAPAB or raises the existing % singleton*. % % H = CAPAB returns the handle to a new CAPAB or the handle to % the existing singleton*. % % CAPAB('CALLBACK',hObject,eventData,handles,...) cal...
function [R,T]=findTransformation(X1,X2) x1=mean(X1,2); x2=mean(X2,2); q1=X1-x1(:,ones(1,3)); q2=X2-x2(:,ones(1,3)); H=q1*q2'; [U,S,V] = svd(H); X=V*U'; if(abs(det(X)-1)<1e-5) R=X; T=x2-R*x1; else disp('Algorithm fails!'); end HT=[R T;zeros(1,3) 1]; tranimate(HT); clc; end
function [Sig] = Noise_coherence_3AFC(noise_bands,mod_band,mod_bpfo,t_len,fs) %Order is t_incoh, t_coh, t_incoh, t_incoh %Noise_bands = each row should be a band (low_f, high_f) and should go %lowest band to highest band bp_filt_mod = fir1(mod_bpfo,mod_band * 2/fs,'bandpass'); lowest_bound = min(min(noise_bands)); %...
clear; xsteps = 25; ysteps = 25; xmax = 0.5; ymax = 0.5; data = zeros(xsteps+1, ysteps+1, 2); A0 = 0.142; % lattice parameter (in nm) data_dat = fopen('indent_data.dat', 'w'); for i = 0:xsteps % x steps for j = 0:ysteps % y steps xindent = i*xmax/xsteps; yindent = j*ymax/ysteps; ...
%Initializing counter count = 0; %Reading images from directory Faultimages ='D:\MSc-Artificial Intelligence\Semester 2\Embedded Image Processing\Assignment 1\Images\6-CapMissing'; a=dir([Faultimages '/*.jpg']); out=size(a,1); %Gives the size of the directory %%Predictions for noise images %Underfilled Pre...
% Inclass16 clear; %The folder in this repository contains code implementing a Tracking %algorithm to match cells (or anything else) between successive frames. % It is an implemenation of the algorithm described in this paper: % % Sbalzarini IF, Koumoutsakos P (2005) Feature point tracking and trajectory analysis % ...
function rotated = rotator(img, rads) % Calculating the size of the padding matrix [ROWS, COLS] = size(img); diagonal = sqrt(ROWS^2 + COLS^2); rowPad = ceil(diagonal - ROWS) + 2; colPad = ceil(diagonal - COLS) + 2; % Creating the paddding matrix and filling it whith the original image ...
% Project Euler % Problem 2 % % Each new term in the Fibonacci sequence is generated by adding the % previous two terms. By starting with 1 and 2, the first 10 terms will be: % % 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... % % By considering the terms in the Fibonacci sequence whose values do not % exceed four million, fi...
function [implied] = getImpliedLogs(w_l,w_m,w_s,AL,AM,AS,param) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Prototype is getImpliedLogsBS %%% Need to add AL,AM,AS,param b/c of FOC needed %%% This is solely for calibration %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
k = 2; x = rand(1,100); y = (x > .5)' + 1; x2 = rand(1, 50); y2 = (x2 > .5)' + 1; num_labels = length(y2); phi = get_phi(y, k); mu = get_mean(x, y, k); sigma = get_covariance(x, y, mu); p = get_p_x_given_y(x2, mu, sigma); % P(X|Y)P(Y) :: MxK probs = p .* phi'; printf('Comparing classifications against samples...\...
function plot_spec0 % Fit experimental data for a pair +hmin -hmin (high Hmin) % using 5 parameters % A - amplitude % I0 - main field % I1 - additional uniform field, proportional to Imin (due to shielding) % Rmin - coil radius % K1 - uniform field distorsion caused by SC coil fit=0; find_figure('p...
function showCorners(I,Ixx,Iyy,Ixy,Gxx,Gyy,Gxy,R,RNonMax,corners) % Normalize all matrices Ixx = Ixx/max(Ixx(:)); Iyy = Iyy/max(Iyy(:)); Ixy = Ixy/max(Ixy(:)); Gxx = Gxx/max(Gxx(:)); Gyy = Gyy/max(Gyy(:)); Gxy = Gxy/max(Gxy(:)); RNonMax = RNonMax/max(RNonMax(:)); R = R...
function [ILDnet] = dynsetup(num_freqs,num_ilds,num_ICCls_units) %Function to set up a neural network to solve the ILDAlone specint problem %Specifically set up for Batch Training of a Dynamical Network (see manual) %Architecture: % 2-Layer network % Input --> ICCls --> ICx --> Output IL...
close all; clear all; clc; % image loading filename = 'resim17'; resimOrijinal = dlmread([ filename 'degerler.txt']); resimOnisleme = dlmread([ filename 'onisleme.txt']); resimKenarlar = dlmread([ filename 'kenarlar.txt']); A = uint8(resimOrijinal); B = uint8(resimOnisleme); C = uint8(resimKenarlar); imwrite(A,['..\Son...
function lab2_q3 clc clear syms m; c = 0.25; g = 9.81; t = 4; ml = input('Enter ml :'); mu = input('Enter mu :'); e = input('Enter e in % :'); i = 1; vt = 36; error = 1; fm = (sqrt((g*m)/c))*(tanh(sqrt((g*c)/m)*t))-vt; fprintf('step\tfmL\t\t\t\tfmU\t\t\t\tfmr\t\t\t\tmL\t\t\t\tmU\t\t\t\tmr\t\t\t\tError\n'); mr = (m...
a=imread('a-data\a.bmp'); a2=imread('a-data\a2.bmp'); a3=imread('a-data\a3.bmp'); a4=imread('a-data\a4.bmp'); a5=imread('a-data\a5.bmp'); a6=imread('a-data\a6.bmp'); a7=imread('a-data\a7.bmp'); a8=imread('a-data\a8.bmp'); a9=imread('a-data\a9.bmp'); a10=imread('a-data\a10.bmp'); a11=imread('a-data\a11.bmp'); a12=imread...
function kernel = matGaussK(X,sigma) kernel = exp(-X./(2*sigma));
function showImage(image) figure; num=1; for i = 10:10:120 subplot(3,4,num); imshow(im_meanshift(image.data,i),[]); title('when width is '+ string(i)); num=num+1; end
function epsilon = OscillatorsToEpsilon(Amp,E,Gamma,Theta,Phi,Lam) cphi = cos(Phi); sphi = sin(Phi); cthet = cos(Theta); sthet = sin(Theta); eV = (1239.8./Lam); epsilon = zeros(length(Lam),3,3); for index = 1:length(eV) Osc = Amp./(E.^2 - eV(index).^2 + eV(index).*Gamma*1i); temp = zeros(3); for n = 1:leng...