text
stringlengths
8
6.12M
function Cells=FrameSegment_OCT(conn); % strDB='D:\Yoan\DukeOCT\AMD\AMD1.LEVER'; conn = database(strDB, '','', 'org.sqlite.JDBC', 'jdbc:sqlite:'); CONSTANTS=Read.getConstants(conn); im = MicroscopeData.Reader('imageData',CONSTANTS.imageData, 'chanList',1, ... 'timeRange',[1 1],'outType','single','prompt',false...
function csvToVTK (in_points_csv, in_triangles_csv, out_vtk) %in_points_csv='INDD100551-R.surf/surf_points_w1.csv' %in_triangles_csv='INDD100551-R.surf/surf_triangles_w1.csv' %out_vtk='INDD100551-R.surf/test_surf_tri_w1.vtk' vertices=dlmread(in_points_csv,',',1,0); vertices=vertices(:,1:3); %throw away garbage cols 3...
function shoulder = find_expected_shoulder(observed_face, face_mean, shoulder_face_cov, shoulder_mean, inverse_face_cov) shoulder = round( shoulder_mean + (shoulder_face_cov * inverse_face_cov * (observed_face - face_mean) ) ); shoulder(1) = min( max(1, shoulder(1)), 240); shoulder(2) = min( max(1, sho...
function varargout = seqma(varargin) % % SEQMA is the start of the Sequence Maker program. % It asks the user to select the sequence paradigm. % % --------------------------------------------------------------- % Sequence Maker Copyright (C) 2004 Tuomas Teinonen % % The software library is free software; you...
digit_test; indeces;
function [hitted,missed,totalGT] = calculateHitMiss(realGT,prunnedSet) totalGT = length(realGT); matchedCnt = 0; for ii = 1:1:size(realGT,2) tempGT = realGT{1,ii}; flag = 0; for jj = 1:1:size(prunnedSet,1) testGT = prunnedSet{jj,1}; if(strcmp(tempGT,testGT)) matchedCnt =...
%---Input------------------------------------------------------------- % feat : Feature vector matrix (Instances x Features) % label : Label matrix (Instances x 1) % opts : Parameter settings % opts.N : Number of solutions / population size (* for all methods) % opts.T : Maximum number of iterations (* for all ...
function gen_video_3(step, frame_rate) img_1 = imread('..\img_data_1\img (1).jpg'); img_2 = imread('..\img_data_1\img (2).jpg'); img_3 = imread('..\img_data_1\img (3).jpg'); img_t1 = [img_1, img_2, img_3]; filename='video_img_slide_1'; fn_out = [filename '_1080_f' num2str(frame_rate,'%02d') ]; video_1 = VideoWriter...
classdef Settings < fancyclip.internal.FancyclipBase & handle % Global settings for the fancyclip package % % Don't use this class directly. If you want to get or set the settings, % work with the instance of this in the fancyclip.globals.settings field properties end methods (Static=true) function out = d...
function [ X, Phi ] = get_symmetric_mode( params, C, xspan ) % Calculate a symmetric mode using the parameter C of the asymptotic 'asympt' % % INPUT: % xstart = xspan(1); % From the asymtote of the solutions asympt_params = @(x) asympt(params, C, x); % Derivative eps = 1e-12; init = [ asympt_params(xs...
function [V,Ex,Ey,C,We,We2,gridpointsx,gridpointsy,innerx,innery,outerx,outery] = bvprectangularcoax(a,b,c,d,xo,yo,er,Vo) % % This function used the finite difference method to solve the % two-dimensional electrostatic boundary value problem related to a square % coaxial cable. % a = width...
function varargout = gaussbeam(varargin) % GAUSSBEAM M-file for gaussbeam.fig % GAUSSBEAM, by itself, creates a new GAUSSBEAM or raises the existing % singleton*. % % H = GAUSSBEAM returns the handle to a new GAUSSBEAM or the handle to % the existing singleton*. % % GAUSSBEAM('CALLBACK'...
clear; clc; warning('off') s = tf('s'); % TRANSFER FUNCTION FROM EXPERIMENTAL MODEL Km = 1361.48; % CONSTANT pm = 28.692; % POLE Gm = Km/(s*(s+pm)); % Open loop motor TF % CONTROLLERS % COEFICIENTS %Integral tau_i_pi = 0.2; %Derivative tau_d_pd = 1/100; %Both tau_i_pid = 0.2; % Integral coeff ta...
function new_extract_feat_and_pred_cat(setup_data,question,network,experiment) % new_extract_feat_and_pred_cat( network.caffestuff) if isfield(question.setlist,'cat_idx_all_trainval') cat_idx_all_trainval = question.setlist.cat_idx_all_trainval; else cat_idx_all_trainval = question.setlist.cat_idx_all; end ...
classdef LmfitPolynomialModel < WeakModel properties %(Access = protected) weak_modelSpec % model specification for MATLAB fitlm function % (https://www.mathworks.com/help/stats/fitlm.html#inputarg_modelspec) weak_model % trained model end methods function obj = LmfitPolynomialModel(mode...
function [sigx, sigy] = sigma_parabolic(x, y, xnorm) % SIGMA_PARABOLIC uses a parabola for the variance at each x and y value. % % INPUT: X -- the x-values % Y -- the y-values % % OUTPUT: SIGX -- the corresponding sigmax given the x-value % SIGY -- the corresponding sigmay given the y-v...
function ij = RouletteWheelSelection(prob) r=rand; c=cumsum(prob); ij=find(r<=c,1,'first'); end
function log = cora_rr_param_experiments() HA = rod_reactor_HA_cora(); options.enclosureEnables = [3 5]; options.guardIntersect = 'polytope'; % options Zcenter = interval([510;20;20],[520;20;20]); options.R0 = zonotope(Zcenter); %initial state for reachability analysis options.x0 = center(options.R0); %initial state ...
% Dynamics of the problem function [yDyn,vDyn,mDyn] = fDyn(y,v,m,u) global D; global b; g = gFunc(y); rho = normRhoFunc(y); % Put here the dynamics yDyn = v; vDyn = u./m - g - D./m.*rho.*v.*v; mDyn = -b*u;
clear all; close all; load Xk.mat task = 'a'; sigma_r = 0.1; q = 1; R = sigma_r^2*eye(2); Xs(:,1) = [Xk(:,1); 0; 0]; % yk = [0; 0]; for i = 2:size(Xk,2) Xs(:,i) = [Xk(:,i); Xk(:,i)-Xk(:,i-1)]; yk(:,i-1) = Xs(3:4,i)+mvnrnd(zeros(2,1), R)'; end x_0 = Xs(:,1); P_0 = zeros(size(Xs(:,1),1)); T = 1; A = [1 0 T 0;0 1 0...
function [ I,J,S ] = binary2pts( binary,score ) %turns binary image with score image into x,y,s combo [I,J] = find(binary); S = score(sub2ind(size(binary),I,J)); end
%Coeficientes del filtro de orden 4 F = [0 221 1764 4410 6615 8820 22050]/22050; %corrección para entrar en [-32768, 32768] A_corr = [2.1 2 1.3 1 1 1.2 1.5]*0.8; %obtencion de coeficientes [b,a] = yulewalk(4,F,A_corr); [h,w] = freqz(b,a); %gráficas plot(F,A_corr) hold on plot(w/pi, abs(h)) title("Respuesta en f...
function frqspec(w, mag) n=length(w); mB=mag(1)*0.707; j=0; Mp=max(mag); if Mp >= mag(1) for i=1:n if mag(i) >= Mp np=i; wr=w(i); else,end end else, np=1 end for i=np:n-1 if mag(i) >= mB wB1= w(i); wB2=w(i+1); maglo=mag(i+1); wB =(wB1+wB2)/2; else, end end if ...
% value iteration by collocation clear clc clear close all clear %% Given system is Q=diag([50,50]); R=diag([5]); figname='2DVanderpoll_lowCtrlCost_'; saveonoff=1; d=2; ep=1; g=@(x)[0;1]; f=@(x)[x(2);-x(1)+x(2)-ep*x(1)^2*x(2)]; dom=[-3,3; -3,3]; %% % -1.2 and -5 K=[-1.2,-1.2]; u=@(x)K*x(:); u0=u; % [xx,...
function v = powerIter(A,v0,m) v = v0 for i = 1:m v = A*v/norm(A*v) end
% Adapted from extractDataForKerry to extract daily variables needed for % computing GPI. % % Meg D. Fowler, 2017-10-27 % %% Set path to variable files and read in dimensions load('/Users/meganfowler/Documents/MATLAB/TCs/SavedMatlabData/MJOindex&time_monthPhase'); % MJOindex_monthPhase, MJOtime_monthPhase % -----...
%Assignment No.4: High Dynamic Range Imaging and Tone-mapping %__Jishnu Pradeep__ %This function selects random pixels from the scenes as samples. Open f(). function Z = sampling(imgs) imgNum = size(imgs,3); smpNum = round(2*256/(imgNum - 1)); height = size(imgs,1); width = size(imgs,2); Z = zeros(smpNum,imgNum); k...
function [x,u,delM,alpha] = ptMR(delT,simTime,xDes,delMat,delMatTrue,dataLimit) % MPC parameter horizon = 20; % state,input matrices % t = 0:simTime/delT; x = zeros(6,simTime / delT); u = zeros(2,simTime / delT); alpha = zeros(2, simTime / delT); x0 = [0;0;10;0;0;0]; u0 = zeros(2,horizon); hMat = []; tMat = []; delM =...
%% Limpar console, variaveis e fechar janelas aberta clc; clear; close all; %% Definir massas e comprimentos dos bra�os do Rob� RR m1 = 1; m2 = 1; L1 = 1; L2 = 1; %% Definir passo e tempo final da simula��o e pegar informa��es de tamanho dos vetores gerados delta_time = 0.001; final_time = 10; t = 0:delta_time:fi...
function [q,lambda] = PowerMethod(A,q0,m) % function [q,lambda] = PowerMethod(A,q0,m) % Power method. % A is nxn, q0 is nx1, and m is a positive integer. % q is a unit 2-norm vector in the direction of A^m*x0. % lambda is mx1 and lambda(k) is the kth estimate of the dominant eigenvalue. % A call of the form q =...
function plot_spots(spots) % plot_spots Plot targeted patches for stimulation. if nargin<1 || isempty(spots) disp('spots not provided') return end xcoordsAll = spots.xcoordsAll; ycoordsAll = spots.ycoordsAll; sizesAll = spots.sizesAll; for convert=1:size(xcoordsAll,2) rectangle('Position',[...
%% Uczenie maszynowe AiR, 2018 %% %% Cwiczenie: Drzewa decyzyjne % Cel: Ilustracja roznych aspektow budowania drzew decyzyjnych i ich weryfikowania % Prosze uzupelnic brakujace fragmenty zgodnie z instrukcja (FIXME) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Decision Trees %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
%% Stelling 1 % % Met de functie save() kun je data-bestanden aanmaken. % Antwoord = 1;
function varargout = mrip(image,x,y,a,b) %MRIP Summary of this function goes here % Detailed explanation goes here xMax = min(ceil(x+b),size(image,2)); xMin = max(floor(x-b),1); yMax = min(ceil(y+b),size(image,1)); yMin = max(floor(y-b),1); [xx,yy] = meshgrid(xMin:xMax,yMin:yMax); zz = image(yMin:yMax,xMin:xMax); ...
function weights = helicalSimpleRedundancyWeights( gammas, beta, Delta ) a = Delta / 2; b = Delta / 2 - 0.5; lambda = beta - a; lambdas = lambda + (-3:3) * pi; lambda1 = abs( lambdas ); weights = zeros( size(gammas) ); for i = 1:length(gammas) lambda2 = abs( lambdas + [-2 0 -2 0 -2 0 -2] * gammas(i) ); ...
classdef eval %EVAL Summary of this class goes here % Detailed explanation goes here properties end methods (Access = 'public', Static = true, Hidden = false) alpha = Alpha( navOrRate, benchmark, rf, flag); beta = Beta( navOrRate, benchmark, flag); burkeR = Burke...
function Data = ImportDataTianjinfeiyue(fileToRead,Flag_Single) newData = cell2mat(importdata(fileToRead)); Temperature = str2num(newData(:,21:end)); Time = newData(:,1:19); clear newData num = length(Temperature); Day = zeros(num,1); Hour = zeros(num,1); Min = zeros(num,1); Sec = zeros(num,1); if Fla...
function yhat = fullPrediction(obj,x) % For some input data get mixture model prediction % i.e. y_n = sum_k (weights_k,n * y_n,k) if strcmpi(x,'val') || isequal(x,obj.x_val) % gamma = k x n % ypred = n x k % gamma.*ypred --> one line per data point % sum --> sum out the columns to get one prediction fo...
function [dist1, dist2] = dist_orig(pts1,pts2) %% Initializing n1 = size(pts1,1); n2 = size(pts2,1); dist1 = zeros(n1,n1); dist2 = zeros(n2,n2); %% Computing the distances betwen every feature points of img1 for i=1:n1 for j=i+1:n1 dist1(i,j) = sqrt(sum((pts1(i,:)-pts1(j,:)).^2)); ...
function [c] = DiffusionReactionSolver(x_min, x_max, NElem, D, Lambda, bndry_1, bndry_1_val, bndry_2, bndry_2_val) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here % Create mesh msh = OneDimLinearMeshGen(x_min, x_max, NElem); % Preallocate matrix sizes RHS = zeros(NElem+1, 1); Gl...
% build a grid function gridBuilder(size, divisions) sq = ones(size); d = ceil(size(sq,1)/divisions); c = 0; for i = 1:d:size(sq,1) if mod(c, 2)==0 sq(i:i+d, :)=0; sq(:, i:i+d)=0; end c = c+1; end imshow(sq); end
% SetInfo_altIR % combines all the other 'set...' scripts into one %check ILDAloneFlag % XStimParams.space_flag == 1 for ILDalone % == 0 for fully cued % uses .STD HRIRs, therefore make sure earphone filters are also selected XStimParams.ephone_flag = 1; set(H.ephoneuseit,'Value',1); ...
%% Set input to simulation %% set input trajectory q_dot = [-0.1,0,0,0,0.2,0]; vbb = [0,0.1,0,0.1,0,0.1]; %% set initial configuration of system xi_euler_init = [0,0,0,0,0,0 ... ,0,pi/2.8,-pi/1.3,pi/3,-pi/2 ,0]; xi_init = [0,0,0, ... 1,0,0,0, ... 0,pi/2.8,-pi/1.3,pi/3,-pi/2 ,0 ]; q_init...
function [] = reAdjustOpenClose(obj) % 重新调整开平 % 潘其超,20131121,V1.0 % 潘其超,20140814,V2.0 %  1. 重新修订,适应新结构。 currPos = zeros(obj.latest+1,1); for i = 2:obj.latest+1 if obj.direction(i-1)==1 currPos(i) = currPos(i-1)+ obj.volume(i-1); else currPos(i) = currPos(i-1)- obj.volume(i-1); end end ob...
function [CSD,interpCSD]=CSDmovie(WF,ch,neuronNames,preMs,Fs,En,varargin) % CSDmovie(WF,ch,neuronNames,preMs,Fs,En,varargin) % Function purpose : Calculate distribution of post spike fields (PSF) % % Function recives : avgWF - average spike STAs over all electrodes in ch [Double [neurons x ch x samples] % ...
%stlデータの読み出し %実行時間短縮のために、stlデータを読み出し、xlsファイルとして保存する %initialize clear all clc; tic; %input & output inName = 'rawData/om%d.stl'; outName = 'omvertex%d.xls'; %the number of sample sample = 2; %read dataset-------------------------------------------------------------- for Num = 1:sample, facedata = sprintf(inNam...
function [obj, varargout] = plot(obj,varargin) %@jointevents/plot Plot function for jointevents object. % OBJ = plot(OBJ) creates plot of the jointevents analysis result % Args = struct('showTitle',1,'GroupPlots',0,'GroupPlotIndex',0, ... 'Color','b','xlabel',0,'stimInfoDir',['..' filesep '..' ],'linkedZoom',1, ....
function [ Iwarp, minR, minC ] = WarpImage( I, A ) [r,c,color] = size(I); % get the the four corners of the given image corners = [1 1 1; r 1 1; 1 c 1; r c 1]; % Transform the the corner points using the transformation matrix cornersNe...
function [ varargout ] = util_sti_calc_test_score_multiple_arraywide( varargin ) %UTIL_STI_CALC_TEST_SCORE_MULTIPLE_ARRAYWIDE 计算每个电极在刺激期间的Score % 专用于处理方向性刺激Test Positive/Negative的Score程序。 % 与工具函数util_calc_sti_test_score_arraywide的区别是, % 本函数能够处理一个Test文件中有多个不同刺激电极的情形。 % % 输入参数: % stimulating_chid:一个序...
% AMIGO_report_DO: reports optimal control profile & constraints % %****************************************************************************** % AMIGO2: dynamic modeling, optimization and control of biological systems % % Code development: Eva Balsa-Canto % % Address: ...
clear all ; aviobj = avifile('mymovie.avi','fps',25) ; NomDuDossier='../Ghost3/' ; % NomDuDossier='../Maisons/' ; for u=-3:3 for v=-3:3 Masque(u+4,v+4) = exp( -( (u*u) + (v*v) ) ) ; end end Masque = Masque / sum(sum(Masque)) ; for numero = 0:1 if(numero<10) Nom = strcat(NomDuDos...
clear all clc %% 1. LOAD OCTONION UTILITY FUNCTIONS % addpath([fileparts(pwd),'/Data']); %add Data directory to path; addpath('crystal_symmetry_ops'); addpath('octonion_functions/'); addpath('rotation_conversions/'); pgnum = 30; %cubic symmetry genplot = false; symnames = load('PGnames.mat'); %need to add crystal_s...
function [isIntersecting] = checkIntersection(A,B,C,D) % Check to see if line segments AB and CD are properly intersecting % INPUTS: points A,B,C,D each with (X,Y) coordinates % OUTPUTS: boolean giving whether there is an intersection or not % If lines are colinear in any way or T-intersecting, but not crossing each % ...
%Uncomment below if it is the first time loading % clear; %load('..\Data\Westpoint\WestpointUnAveraged.mat'); %load('..\Data\Westpoint\WestpointAveraged.mat'); fs = 62.5e6; x = ((0:length(WestpointAveraged(1).raw)-1)./fs).*1000; figure; plot(x,WestpointAveraged(2).raw); hold on; plot(x,WestpointUnAvera...
function [traces,out] = spikeExtraction(traces,fps,traceOpt) traces = traces(:,:,1); traces = getCaEvents( traces, fps, traceOpt.tau, traceOpt.highPass ); if nargout>1 out = []; end
clc;clear;close; cd ..\calibration_data_lump; % This is the source codes for model calibration files=dir('..\watch_basin_data\WATCH_basin_*_grid.mat');files=struct2cell(files);files=files(1,:)';%basin-specific input data KGEval=nan(235,2);%basin_id, KGE bsn_data=nan(240,14,235);% 240 rows of months, 14 cols:P,Robs,Rsim...
function [tacout,indxout] = AutoCorrRec(t,tmax,nbins) % AutoCorrRec: compute spike autocorrelations for vectors in a cell array % Calling syntax is just like AutoCorr, except t may be a cell array % of spike time vectors binning = 0; if (nargin == 3) binning = 1; end if (nargout > 1 & binning) error('Only one output ...
Fs = 5120; t = 0:1/Fs:1; y = sin(10*2*pi*t); plot(abs(fft(y)))
% Run this script to add subfolders to MATLAB path addpath(genpath('algorithms')); addpath(genpath('examples')); addpath(genpath('experiments')); addpath(genpath('tools'))
clear, clc syms u1 u2 u3 s u = [u1; u2; u3]; unknown_vars = symvar([u; s]); R = (2 * s * s - 1) * eye(3) + 2 * (u * transpose(u) - s * skew(u)); q = transpose(sym('q%d%d', [5, 3])); qq = transpose(sym('qq%d%d', [5, 3])); eqs = sym(zeros(5 * 6 + 1, 1)); temp = {}; c42 = combinator(4, 2, 'c'); for index = 1:5 ...
% ------------------------------------------------------ % Company: Georgia Tech % Engineer: Everybody In The Group % % Create Date: 11/16/2017 % Design Name: Main (MATLAB model) % Project Name: VGA Image Transpose and Edge Detection % ------------------------------------------------------ clear all; clo...
function rxy = r1b(x,y,outlier) % computes lag 1 cross correlation (r(x(2:n),y(1:n-1))) % Useage: r1b(x,y[,outlier]) where x & y are column vectors if (nargin<2) fprintf(1,'Useage: r(x,y)\n'); return end if nargin==3 rxy=r(x(2:size(x,1)),y(1:(size(x,1)-1)),outlier(2:size(x,1))); else rxy=r(x(2:si...
clear all close all clc %% Generate data for Simple Harmoinc Oscillator M = 5; % mass in KG K = 0.2; % spring constant Fext = 1; % external force magnitude tf = 1000; % time span gMode = 1; % graphic mode sigma = 0.04; % standard deviation [t,y,ytilde,u,X] = SimpleHarmonicOsc(M,K,Fext,t...
function netPVSystemPower = solModel( time, location, inverterRating, varargin ) %% 0.1) Parameter Parsing ================================================= p = inputParser; p.addRequired('time',@(x) all(isstruct(x) & isfield(x,'daylightSavings') & isfield(x,'dayOfYear'))); p.addRequired('location',@(x) all(isstr...
clearvars close all addpath('../DS/lib/') addpath('spectralFEconverge\') global fonttype global fontsize global markerSZ fonttype = 'Times New Roman'; fontsize = 14; markerSZ = 80; rawResults diffNVDP goal1StiffPlot FSRK4ConsistencyPlot PSConsistencyPlot accuracyPlot plotError
% testOpperGP.m % Test Opper's method in the GP Case clear all; clc; close all; %% DELETE ME %rng('default'); %% Generate Data from GP prior and Linear Fwd Model N = 100; % Number of observations PTRAIN = 0.1; [data trueParam] = generateDataGPPriorLinearFwd( N, PTRAIN ); %% We use true param that generatd t...
function P = permute_abundances(A1,A2) %PERMUTE_ABUNDANCES Permute abundance maps in A2 such that they match the %abundance maps in A1. Warning: it assumes that most elements in the %abundance maps are 1s. To permute arbitrary values, use %permute_endmembers. % Input: % A1: N by M_1 matrix of the abundance maps to be...
% Plot spectrum and add callbacks for peak searching % Controls (work on both panels): % BTN: scroll to new position % CTRL-BTN: add point % SHIFT-BTN: remove point % 0-9,+,-: change N_r % s - save data to <name>_cwpeaks.mat % t - save peak positions to <name>_cwpeaks.txt % h - print this help message % ...
% ---------------------------------------------------------------------- % % Get Control Volume Geometry % % ---------------------------------------------------------------------- % function Duct = GetThermoDynamState(Duct,StateInfo) % --------------------------------------...
function [ kernel ] = GaussianKernel( w, s) %GAUSSIANKERNEL Returns 2D array containing a gaussian kernel with width %w and variance s kernel = zeros(w,w); for i = 1:w for j = 1:w k = (i-(w+1)/2)^2 + (j-(w+1)/2)^2; kernel(i,j) = exp(-k/(2*s*s)); end end kernel = kernel/sum(kernel(:));
function [recon_strategy,opt_struct]=get_recon_strategy_test(testcase) if ~exist('testcase','var') error(' Did not specify test case, choose one of l_me, s3d, l_m3d'); end test_case.(testcase)=1; if isfield(test_case,'l_me') load('get_recon_strategy_test_large_multi_echo'); [recon_strategy,opt_struct]=get...
clear all; clc; vm = 5; vc = 10; fm = 1; fc = 10; fs = 100; wm = 2*pi*fm; wc = 2*pi*fc; t = -2:1/fs:2; n = length(t); df = fs / n; f = -fs/2:df:fs/2 - df; % Modulation m = vm*cos(wm*t); c = vc*cos(wc*t); s = m .* c; ftm = fftshift(fft(m)); ftc = fftshift(fft(c)); fts = fftshift(fft(s)); subplot(3, 1, 1); plot(t, ...
function statsPlotConfMat(res,parent,opts) % Plot the confusion matrix in the correct axes - this will require a bit % of good coding to ensure that we can use the axes for something other % than an image afterwards... % Define the colour map cmap = flipud(gray(100)); % Get the conf mat cm = res.cm.cm; sz = size(cm,...
%Honors TA Final Project - Binary to Decimal Converter %Liu 10/30/2017 %Standard Answer bin=input('What is the binary number of conversion?(in single quote) '); %bin needs to be in char array or string ('') bits=input('How many bits? '); system=menu('What is the binary system of use?','Unsigned','Signed'); posdec=0; ...
%% Opdracht 6 % % Maak een functie met de naam opdracht_6. % De functie heeft 1 input genaamd: inputvar. % De functie heeft 1 output genaamd: outputvar. % % De functie geeft bij verschillende numerieke waardes van 'inputvar' % (de waardes 6 tot en met 10) verschillende tekstuele outputs. % % Je mag geen gebruik maken v...
function R = generateRotation(rx,ry,rz) Rx = [1 0 0; 0 cosd(rx) -sind(rx); 0 sind(rx) cosd(rx)]; Ry = [cosd(ry) 0 sind(ry); 0 1 0; -sind(ry) 0 cosd(ry)]; Rz = [cosd(rz) -sind(rz) 0; sind(rz) cosd(rz) 0; 0 0 1]; R = Rz*Ry*Rx;
function [ B ] = binaryblock( K1 , N0 , N1 , M ) % This function realizes generating the periodic sequences % K1 : the vertical direction % N0 : the size of zeros % N1 : the size of ones % M : the number of period % the horizontal direction length K2 = (N0+N1) * (M-1) + N1 % Author : Zhibin Zhao % Place : ...
function [S,I,C,R] = model_sicr(beta,epsilon,gamma,Gamma,mu,q,S0,I0,C0,TimeSpan) % % RISK_STRUCTURE( beta, epsilon, gamma, Gamma, mu, q, S0, I0, C0, MaxTime) % This is the MATLAB version of program 2.7 from page 44 of % "Modeling Infectious Disease in humans and animals" % by Keeling & Rohani. % % It is the SIC...
% exm3_expm_demo.m % 例2,求解矩阵指数函数示例 % 北京邮电大学,尹霄丽 % 2018年12月 syms t; A=[1,-2;1,4]; %e=[heaviside(t);exp(-t)*heaviside(t)]; x0=[3;2]; %求解矩阵指数函数 F=expm(t*A); F=simplify(F) x=F*x0; x=simplify(x)
function [perform, classify_rate] = find_performance(net, tr, x, y) [x2, y2] = ANNdata(x, y); predictions = testANN(net, x2); classify_rate = (size(y, 1) - nnz(predictions - y))/size(y, 1); perform = tr.best_perf; end
function [bestRunRes, runRes] = multiRESCAL(nmRuns, cores, X, errMthd, args, stopVal) %multiRESCAL Runs RESCAL multiple times and returns all runs and the best run (least error) % Input: % nmRuns - number of runs to compute % cores - number of cores to run runs on % X - n x n x m multi-graph matrix whe...
function result = position_tester(package, object, smallest_row, smallest_col) % The result of this function is true if and only if appending the % package with the given object on the given row and col doesn't result % in overlap. % Remeber that every non-object pixel in package has a value of -1....
function RotateMotorAngle(MySerial,curAngle,newAngle) angleDiff = newAngle - curAngle; numSteps = round(angleDiff/0.01125) command=['xymm 1 ',num2str(numSteps),'xy'];%xy is the serial terminator fprintf(MySerial, command);
clc; clear; %% Encoder & preprocessing FILEPATH = 'charact1.txt'; mode = 1; fileID = fopen(FILEPATH); char = fscanf(fileID, '%s', [64, 64]); fclose(fileID); % Dictionary-like char to number table using ASCII code char2num = [zeros(1,'0'-1), 0:9, zeros(1,'A'-'9'-1), (0:('V'-'A')) + 10]; img = char2num(char'); %% Q1 Di...
function hfigs = plot_particle_distribution(TargetID, pf,k,est,truth,plot_title) % Input: particles info pf, time index k % Output: plot ptk = pf{TargetID}.particles(:,:,k); pwk = pf{TargetID}.w(:,k); % pwk = ones(1,pf{TargetID}.Ns)./pf{TargetID}.Ns; hfig = scatter(ptk(1,:),ptk(2,:),[],pwk,'filled...
function varargout = zzbl(varargin) % ZZBL MATLAB code for zzbl.fig % ZZBL, by itself, creates a new ZZBL or raises the existing % singleton*. % % H = ZZBL returns the handle to a new ZZBL or the handle to % the existing singleton*. % % ZZBL('CALLBACK',hObject,eventData,handles,...) calls the l...
function [h] = bar2plot(M_X, s_Y) % % NAME % % function [h] = bar2plot(M_X, s_Y) % % % ARGUMENTS % INPUTS % M_X Matrix The x-axis "values" % for the two groups % s_Y struct holder for plot values % ...
function dist = euclid_dist(map, nodeInd, goalX, goalY) %euclid_dist Get the heuristic for an input node index %This hueristic will be euclidean distance from goal %Get node position [stateX,stateY] = state_from_index(map,nodeInd); %Calculate heuristic - Euclidean distance to goal dist = sqrt((...
%%%%%% experiments for ANFIS with differents input data size and training %%%%%% data. clear close all load cpuFiveMinuteInterval cpuMean = con2seq(cpuMean); inputOption = 0; % for changing input data size. OverallMape = []; % using when inputOption == 1 sizeOfStep = 100; NumberOfSteps = 1; for step = 1:NumberOfSteps %...
function [ ] = sample( datadir ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here R = mmread(strcat(datadir, '/rating')); F = mmread(strcat(datadir, '/feature')); [m,n]=size(R); fprintf('(%d,%d,%d)\n', m, n, nnz(R)); user = sum(R,2)>=10; R = R(user, :); item = find(sum(R,1)>=8); R = R(:,...
function [dist, od] = distance(pos, timax) % Get traveling distance from position(lat,lon,hgt) curve. % % Prototype: dist = distance(pos, timax) % Inputs: pos - [lat, lon, hgt, t], must be sampled at same frequency. % timax - the max calculated time interval % Outputs: dist - distances with different time inter...
function run_batch_so1(inV) % Runs one calibration on kure %{ Input is a cell array (b/c this is called by a generic startup routine using varargin) IN solverStr 'none' just compute results, no calibration 'guess' compute results from intermediate guess, after a job crashed gNo, setNo %} ...
function write_ascii_profile(scene, bands, zenith, meas, model, zmax, z, flux_up, flux_dn); for iband = 1:length(bands) if strcmp(zenith,'diffuse') illum = 'DIFFUSE'; else zen = str2num(zenith); azim = zeros(1,91); azim([56 41 76 42 60 67]+1) = [153 147 155 76 45 41]; illum = spr...
function frac = cpivSubpixel(val) % remove negative values m = min(val); k = find(m <= 0); if (~isempty(k)), m(k) = m(k) - 0.0001; % everything should be slightly positive val(:,k) = val(:,k) - repmat(m(k), [3 1]); end; lval = log(val); frac = (lval(1,:) - lval(3,:))./(2*(lval(1,:) + lval(3,:) - 2*lval(2,:)));
classdef LegPoly < handle %LEGENDRE Summary of this class goes here % Detailed explanation goes here properties leg = [] legS = [] legInt = [] legIntS = [] legIntNB = [] end methods function obj = LegPoly() %obj.order = order; end function computePolynomials(obj,order) syms x t...
%--------------------------------------------------------------------- % issosdemo1 % % Demonstration of the ISSOS function for testing if a polynomial p % is a sum of squares. This example uses ISSOS to construct an % SOS decomposition for a degree four polynomial in two variables. % See ISSOS help for more details ...
clear, close all; clc; % regularization parameter alpha = 1e-4; % construct matrix B = [1, 1, 1; 1, 2, 3]; A = B' * B + .001 * eye(3); % define true solution xtrue = [1; 2; 3]; % compute right hand side (and add random perturbation) eta = 0.05*norm( xtrue ); per = eta*randn(3,1); b = A*xtrue + per; % define initia...
x=[-10:0.1:10]; sinx=sin(x); cosx=cos(x); y=[-10:0.5:10]; plot(sinx,cosx,y);
% Descrete VS non-descrete simultation %clc; %clear all; clcl; %clc; % Initalizaiton %---------------------------------------------------------------------- compName =getComputerName; setCD(compName); type = 'forFit'; sim = Simulator; % create a new instance of type Simulator sim ...
%% Corrupt the image with noise % should we normalise the image after adding noise or not??? %% function [imageOut]=CorruptImage(imageIn,percentageInten) maxIntenOriginal=max(max(imageIn)); imageOut=percentageInten*maxIntenOriginal*randn(size(imageIn))+imageIn; end