text
stringlengths
8
6.12M
function [im , image_meas] = fx_LIFT_Recon2D(Calib_Res, image_line, lambda_reg, options) % takes the UTP system information [Calib_Res] and input measurement 1D image % to reconstruct image [x,y] in focus mode operation % Calib_Res: the system calibration results % image_line: the 1D image % labmda_TV: TV regularizat...
clear all; load_params_resonantLoad; SS_LRQ_commonStart; %% Assignment 2.4.1 (basic LQR) % design parameter r = 1/3000; %3850 % symmetric root locus sysG = ss(A,B,C,D); sysGp = ss(-A, -B, C, D); % plot root locus % rlocus(sysG*sysGp); % hold on % % rl_poles = rlocus(sysG*sysGp, 1/r); % plot(real(rl_poles), imag(r...
function g = sigmoid(z) %returns the sigmoid value or logistic regression g = zeros(size(z)); g = 1./(1+exp(-z)); end %==================== test cases =================== % sigmoid(-5) %ans = 0.0066929 % sigmoid(0) %ans = 0.50000 % sigmoid(5) %ans = 0.99331 % sigmoid([4 5 6]) %ans = % 0.98201 0.99331 0...
function [pos1, idx] = posdistance(pos, dist) % Extract postions between two successive points over some distance. % % Prototype: [pos1, idx] = posdistance(pos, dist) % Input: pos - postions % dist - distance setting % Output: pos1 - postions over the distance % idx - extract index % % See also vn2dpos....
% Answers task 3 in Assignment 3 in TMR4240, Fall 2019 % % Author: Simen Oevereng %%% Define rudder angle / ship heading transfer function with given constants K = 1; T = 1; P = tf([K],[T 1 0]); %%% Continous-time domain controller transfer function G = 4*tf([1 1],[1 2]); %%% Define the cont. CL system and simplify....
%% Performing sensitivity analysis using Morris method %% global script executing the workflow in Morris method %% Gurkan Sin DTU Chemical Engineeirng %% June 24, 2015 DTU Lyngby close all clear clc %%Step 1: perform Morris sampling disp('Step 1: perform Morris sampling') morrissampling %save output fl =strcat('Morri...
clc %M=zeros(20,1); %for i=1:20 n=4; format long h=1/n; sy=ones(n,1); S_y=sqrt(h)*diag(sy); sx=ones(n+1,1); S_x=(1/sqrt(h))*(-diag(sx)+diag(sy,1)); B=-diag(sx)+diag(sy,1); B(n+1,:)=[]; Sigma=inv(S_y)*B*inv(S_x); s=svd(Sigma); s_min=min(s); %M(i,1)=s_min; %end %plot(1:20, M)
function ppandrpt(wellname) set(0,'defaultLineLineWidth',3) set(0,'DefaultAxesFontSize',15); %load 'thermal_history_wells.mat' kb_ST168=130; wd_ST168=70; lat_ST168=28.57276479; bht_depths=[17060;17552;19361]; bht_depths=[0;bht_depths-(wd_ST168+kb_ST168)]; Tswi_ST168=tswi_calc(lat_ST168,wd_ST168); bht_ST168=[265;280;3...
% POLARNET plots a net of lines, like a globe on an already existing sphere, % for better spatial orientation. POLARNET is based on the function % 'sphere', but uses a higher resolution, for better drawing approximation. % The lines have an angle distance of 15° in azimuth and elevation %...
% conv2demo.m % demonstration of 2D convolution using the same example as shown in the % lecture note system.ppt % (C) 2006 by Yu Hen Hu % created: 9/11/2006 clear all; close all x=[1 0 0 1 0 0 1 1 0 1 1 0 1 1 1], h=ones(3), y=conv2(x,h),
function updateWind(choice) WindPower = evalin('base','WindAvg'); switch choice case 1 turb = sum(sum(evalin('base','Plot1Info')== 11))* 1; turb = sum(sum(evalin('base','Plot1Info')== 12))* 1 + turb; turb = sum(sum(evalin('base','Plot1Info')== 13))* 1 + turb...
function flag = isequal(this, that) % isequal Compare two tseries objects. % % Syntax % ======= % % Flag = isequal(X1, X2) % % % Input arguments % ================ % % * `X1`, `X2` [ tseries ] - Two tseries objects that will be compared. % % % Output arguments % ================= % % * `Flag` [ `true` | `false` ] ...
function configMoteD(paramArr,moteID) % configMoteD(paramArr,moteID) % Allows for command line configuration of motes, using global Defaults. % % paramArr array of parameters to set into the fields % a value of -1 means keep the global default, which % is stored in APPS.MAGMHOPRPT % [reportTh...
function preprocess(brainData) %PREPROCESS % % Written by Josh Grooms on 20131208 %% Initialize % Pull volume & mask data from the data object, or generate a mask if one isn't available volumeData = brainData.Data.Anatomical; if ~isempty(brainData.Data.Mask) maskData = brainData.Data.Mask; else % Generate a...
% Juan Carlos Martinez % Last modified: 3/18/2015 % This function plots the data. function [] = sensorplots(sensor,timestr,timeindex) date='26-Nov-2014 '; n=1; while ~(strcmpi(timestr(n,1:12),date)) n=n+1; end c=n; while strcmpi(timestr(c,1:12),date) c=c+1; end timeindex=timeindex(n:c-1); figure (1) pl...
function Mddq_out = getMddq(x,p) q = x(1:p.numJ,1).'; dq = x(p.numJ+1:2*p.numJ,1).'; u = x(p.numJ*2+1:3*p.numJ,1).'; fext_toe = [x(p.numJ*3+1:p.numJ*3+2,1).',0,0,0,0]; fext_heel= [x(p.numJ*3+3:p.numJ*3+4,1).',0,0,0,0]; G = six_G(q(1),q(2),q(3),q(4),q(5),q(6)); V = six_V(q(2),q(3),q(4),q(5),q(6),dq(1),dq(2),dq(3),dq...
function [payoff] = payoff_IF_long(S) % S 是一个序列 % 看涨沪深三百指数期权 % payoff 为三种情况:涨幅< 5% payoff = 0; % 涨幅为5%~15%: payoff = 5%; % 涨幅为15%以上:payoff = 15%; upper = 1; middle = 0.3333; S0 = 1; K1 = 1.05; K2 = 1.15; ST = S(:, end); payoff = zeros(size(ST)); payoff(ST >= K1) = middle; payoff(ST >= K2) = upper; end
function [b,e] = makeBarPlotError(X,err,labs,cmap) if size(X,1)>1 b = bar(1:size(X,1),X); hold on for ib = 1:size(X,2) b(ib).FaceColor = 'flat'; b(ib).CData = repmat(cmap(ib,:),size(X,1),1); end else b = bar(X); for g = 1:size(X,2) b(1).FaceColor = 'flat'; b(1).CData(...
function [ geom ] = loadProjectionGeometryShortScan( p, scanAngle, offsetAngle ) % Load short scan system geometry % inputs: % p - configuration parameters % scanAnge - total short scan angle (in degree) % offsetAngle - offset of the starting angle (default 0) % output: % geom - geometer...
%% Note: Run extractKpsKITTI.m before running this script %% Group the detections by image, for easy visualization % Current index (of image in sequence) curImgIdx = 0; % Current index (of detection in image) curDetIdx = 0; % Filename corresponding to the previous image being processed prevFileName = ''; % Cell t...
function [c] = config_getdefaultheuristic() c = segmentation_configuration(); % 1== github, 2==denis, 3==lindmik c.dataset = 1; % these are the best heuristic parameters % try driving this with % config_optimdrive(config_optimdrivebounds_randomstart()) % 1: sumIB /in [0,1] % 2: sum_contribution /in [0,2] % 3:...
function S = THRrec_Marcel(dev, EXP, ToneFreq, BurstDur, MinSPL, MaxSPL, StartSPL, StepSPL, DAchan, SpikeCrit, MaxNpres, SPL, Attenuations, LinAmp, GUI) % THRrec - adaptive measurement of tonal threshold for one frequency % Usage: % THRrec(dev, EXP, ToneFreq, BurstDur, MinSPL, MaxSPL, StartSPL, StepSPL, DAchan, MaxNp...
function [outputData,outputLabel] = processTestData( inputData,inputLabel,means,standardDeviations ) [numRows,numCols]=size(inputData); outputData=zeros(numRows,numCols); for col=1:numCols outputData(:,col)=(inputData(:,col)-means(col))/standardDeviations(col); end outputLabel=inputLab...
function [ matrizInv ] = inversa( matriz ) auxA = adjunta(matriz); auxB = transpuesta(auxA); auxC = det(matriz); matrizInv = auxB/auxC; end
clear clc close all N=6; M=6; size = model_inputRghtMatrix(M,N);
classdef CellDeriv < handle %CELLDERIV stores the information of all other nodes derivatives at the %node this instance lives in properties B; % Stored Derivatives of all nodes (nx2) Cloud; % Data Handle for the Point Cloud Voron; % Data Handle for this Nodes Voroni Cell ...
function clearSkyGHI = irradianceRobledoSoler(zenithAngle) clearSkyGHI = 1159.24.*(cosd(zenithAngle).^1.179) .* exp(-0.0019.*(90-zenithAngle)); clearSkyGHI(clearSkyGHI<0)=0; end
%%reading the files of dataset % %%PRE-PROCESSING%% % filesC = dir('*00.txt'); %reading control data files that ends with 00 in the directory fileC = filesC'; filesP = dir('*11.txt'); %reading patient data files that ends with 11 in the directory fileP = fil...
function index = cord2index(cord) % Function to convert coordinate values to index values % INPUT: cord, matrix with two columns, whose rows are the coordinates of % points. % OUTPUT: index, matrix of corresponding indices. % By Chiyu 'Max' Jiang, March 5, 2016 index = size(cord); for i = 1:size(cord,1) ind...
clear all, close all, clc qC = [1,0,0,0];qD = [1,0,0,0];qA = [1,0,0,0];qB = [1,0,0,0];qE = [1,0,0,0]; %COM Port details delete(instrfind({'Port'},{'COM15'})) ser = serial('COM15','BaudRate',115200,'InputBufferSize',100); ser.ReadAsyncMode = 'continuous'; fopen(ser); while true if ser.BytesAvailable [qA,...
function energy = R(d, d0) % registry-dependent potential energy = exp(-(d0-3.44)*3.444) * (Rj(sqrt(d^2-d0^2))) - (d/4.68)^(-6) + exp(-(d-4.00)*4.19);
% Definition der Stichprobe: Spannungsvektor gekürzt T = 0:10:100; U = [2.7660 2.8626 ... 4.1887 4.1659]; % Regressionsfunktion der Ordnung 1 mit Konfidenz- und Prognosebereich [P,s] = polyfit(T,U,1); [Ureg,delmean] = polyconf(P,T,s,'alpha',0.05,'predopt','curve'); [Ureg,delprog] = polyconf(P,T,s,'alpha',0.05,'pr...
% Title: Reaction Loads % Version: 1.0 % Date: 27.09.2017 % Description: % Calculate reaction loads when grasping a debris with mass Md and moment % of inertia Id, with angular momentum w and relative velocity v in a % time Dt and bringing it to rest. % Author: Eric Brunner % 1.0 Con...
function plotDataJC clear all; close all; format short e; %ep = [0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 ]; %epdot = [1.0e-6 1.0e-4 1.0e-2 1.0e0 1.0e1 1.0e2 1.0e4 1.0e6]; %T = [200 300 500 700 900 1100 1300 1600]; color = [[0.9 0.1 0.1];[0.1 0.9 0.1];[0.1 0.1...
function [radius] = MaxReach(robot1,robot2) %% Plot UR3 Operation Volume & Max Reach Radius stepRadius = deg2rad(15); stepVolume = deg2rad(60); qlim = robot1.qlim; %joint limits are the same for both robots %Pre-allocated memory for point cloud plotting robot1PointCloudeSize = prod(floor((qlim(1:5,2)-qlim...
clear all; close all; clc %% Projekt č. 10 Detekce na normalizovaných datech pomocí lícování Shoda = 0; Neshoda = 0; for i = 1:224 for n =1:4 %Načítání obrazů if i < 10 I1 = imread(['00',num2str(i),'_',num2str(n),'.bmp']); elseif i < 100 I1 = imread(['0',num2...
%%ANYELECCONFIG_ROTATEDNEURITE_4L % ANYELECCONFIG_ROTATEDNEURITE_4L Simulates the epiretinal stimulation of % retinal ganglion cell axons in the NFL (axons of passage) and in the % ganglion cell layer (axon initial segments). % % This script defines the: % * Simulation numerics (i.e. spatial and temporal extent, sam...
%{ 2017.05.21 BDP Assignment_5 %} function main import_data = importdata('trainingset.txt'); data = import_data.data(:, [1 2 3]); % plot(data(:, 1), data(:, 2),'.'); % hold on; test_data = importdata('testset.txt'); dataT = test_data.data(:, [1 2 3]); tic; KNN(data, 9, dataT); %KNN Algorithm toc; end functi...
function output = modal_residual_test(mics, order, winsize, mscale, mshift, directory, rep, alpha) if directory(length(directory)) != "/" directory = [directory, "/"]; end [vec, lambdas, f, z, w, r] = modesynth(mics, order, winsize, mscale, mshift); [evec, eval] = modesolver_reg(vec, mics, order, winsize-order-1, alp...
close all, clear all, clc % Simulation Variables t_end = 5; % 10 second simulation t_step = 0.01; % Simulation Update Time Steps x_bounds = [0,1]; y_bounds = [-0.4,0.4]; t = [0:t_step:t_end]; const_bearing = 0; %const_bearing = 20; delay = 2; % PID Tunings Kp = 5; Ki = 0; Kd = 0; % 50 works well % Target Trajectory ...
function varargout = gui_(varargin) gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @gui__OpeningFcn, ... 'gui_OutputFcn', @gui__OutputFcn, ... 'gui_LayoutFcn', []...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % To plot DIC solved strain components on the original DIC images % 1) strain exx % 2) strain exy % 3) strain eyy % 4) principal strain max % 5) principal strain min % 6) max shear % 7) equivalent von Mises strain % % Author: Jin Yang % Last...
function homeq clc; axis([-8, 8, -8, 8]); hold on; grid on; [x0, y0] = ginput(1); plot(x0, y0, 'm*'); if x0 * y0 < 0 text(x0 + 0.1, y0, 'no solution') else y = dsolve('Dy = y *(1 + log(y/x))/x', 'y(x0) = y0', 'x'); x = -8:0.1:8 plot(x, eval(...
function [ result ] = matchSTR( cell_array, str, varargin ) %matchStr to identify string within cell array % Created for textscan output if iscell(cell_array) while(iscell(cell_array{1})) if isempty(cell_array{1}) result = false; return; end cell_array = cell_array...
function [opThis] = add_specs(opThis,indivs,studyPatches,t,npatch,SNP1,SNP2,n_L2,seedi) if size(indivs,1) == 0 error('population went extinct, add_specs') end if ~isnan(SNP1) newOP = zeros(length(studyPatches),6); gk = indivs(:,SNP1)+indivs(:,SNP2); % 2 = homozyg recessive elim = ((sum(gk)/(2*size(ind...
clear all close all hidden clc warning("off") %% Input data parameters: path to folder containing %% the analytical data and to folder containing %% the operational data. query = "R5"; ssize = "750"; configuration_to_predict = 2; %R1-250 done %avg_time_query_vector = [79316.55 63576.45 49026.8 42215.55]; %R1-500 do...
B=diag([1;1;-1]); detB = det(B); adjBp = adj3(B'); adjBp2 = tr3(adjBp*adjBp'); BBp = B*B'; B2 = tr3(BBp); sB2p2adjBp = sqrt(B2+2*sqrt(adjBp2)); sB2n2adjBp = sqrt(B2-2*sqrt(adjBp2)); lambda = sqrt(3*B2); for k = 1:100 kappa = (lambda^2-B2)/2; zeta = kappa*lambda - detB; Psi...
function val = Group_3_log_prior(theta_tilde) % Log prior function for the parameters of the reparameterised % GARCH model, derived in the solutions. % theta_tilde - row or column vector of length 3 tt_1 = theta_tilde(1); % \tilde{theta}_1 tt_2 = theta_tilde(2); % \tilde{theta}_2 val = -log(2*pi...
function [d_r] = FEMgrad(u, mesh) %Compute derivatives of FEM equation system r = K*Y - F w.r.t. Lambda_e %ONLY VALID FOR ISOTROPIC HEAT CONDUCTIVITY MATRIX D!!! % u: PDE response vector % mesh: mesh object % (d/d Lambda_e) k^(e) = (1/Lambda_e) k^(e) as k^(e) linear in Lambda_e d_r = reshape(mesh.d_glob_stiff*s...
function [dx,dy] = UpdateFlow_pipeline1(data_in_1,data_in_2,data_in_3,data_in_4,data_in_5) %-------------------------------------------- g11 = data_in_1; g12 = data_in_2; g22 = data_in_3; h1 = data_in_4; h2 = data_in_5; idet = 1/(g11*g22 - g12*g12 + 0.001); dx = (g11*h2-g12*h1)*idet; dy = (g22*h1-g12*h2)*idet; end
% [x,fs]=audioread('yikdata.m4a'); [x,fs]=audioread('penny2.m4a'); % fs=200; t=0:1/fs:1; f1=100; f2=200; k=3; % x=sin(3*pi*f1*t)+k*sin(pi*f2*t)+randn(1,length(t)); % x=sin(3*pi*f1*t)+k*sin(pi*f2*t); % x=sin(2*pi*f1*t); pwelch(x,1940,970,[],fs,'onesided')
% find colormap which colors the distance from zero - zero is always white % and the larger distance from zero, the darker color, up to black function ColMap = MyCoolMapRed(bottom, top) %% checks if bottom>=top error('bottom must be smaller than top') end %% objects range = (top - bottom); ncols = ...
function [ ] = plotMaxPLossD(obj) %PLOTMAXPLOSS Summary of this function goes here % Detailed explanation goes here % ÅËÆä³¬£¬20140709£¬V1.0 obj.prune(); pnl = obj.data(:,obj.pnlI); maxLoss = obj.data(:,obj.maxLossI); pnl = pnl(1:2:obj.rcdNum); maxLoss = maxLoss(1:2:obj.rcdNum); maxLoss = abs(maxLoss); winIdx = pn...
function [N, X, R, cumR] = localHist(obj, stk, etk, type, grids) %LOCALHIST 画stk:etk局部的Histogram,若有输出就不画图(类似hist) % 格式: [N, X, R, cumR] = localHist(obj, stk, etk, type, grids) % 输入: % stk, etk 起始、终止tick号 % type 数据类型,'last'(默认),'bid','ask' % grids 分格划分, 默认为 min : tickValue : max % 输出: % ...
function flow = ComputeOpticalFlow(l) i=0; opticFlow = opticalFlowLK('NoiseThreshold',0.009); % Estimate and display the optical flow of objects in the video. for i=1:length(l.im_list) frameRGB = imread("Test/Images/"+l.im_list(i)+".jpg"); frameGray = rgb2gray(frameRGB); flow(i) = estima...
classdef conv1d < ndg_lib.phys.phys1d %CONV1D Summary of this class goes here % Detailed explanation goes here properties(Constant) Nfield = 1 end properties(SetAccess = protected) cfl % CFL 数 ftime % 计算终止时间 dt % 计算时间步长 u % 速度场 ...
load ref4_scene4.mat; size(reflectances); load illum_6500.mat; radiances_6500 = zeros(size(reflectances)); % initialize array for i = 1:33, radiances_6500(:,:,i) = reflectances(:,:,i)*illum_6500(i); end a = radiances_6500; [r c w] = size(a); a = reshape(a, r*c, w); load xyzbar.mat; XYZ = (xyzbar'*a')';
function centerline = extractCenterline(reconstruction, binaryStack, centerlineAlgorithm, options, t, ch) % Direct import from .mat file if needed if nargin == 0 close all [~, name] = system('hostname'); name = strtrim(name); % remove white space if strcmp(name, 'C7Paje...
clear; clc close all load('StaggeredGridFD4.mat') figure;imagesc(vp(45:end-45,45:end-45)) xlabel('x/dx') ylabel('z/dz') h = colorbar; set(get(h,'title'),'string','m/s'); figure;imagesc(vs(45:end-45,45:end-45)) xlabel('x/dx') ylabel('z/dz') h = colorbar; set(get(h,'title'),'string','m/s');
function varargout=add_OIB_to_ATL11(varargin) if nargout>0 [varargout{1:nargout}]=feval( varargin{:}); else feval(varargin{:}); end %------------------------------------------------------------------ function [D11, D200]=generate_corrections(filename) disp(filename); [D11, ~, params_11]=read_ATL11_h5(filena...
model = 0; mod = []; tmp=load('D:\writing\MF_dev\data_for_figs\model_parameters.mat'); load('D:\writing\MF_dev\data_for_figs\part_num.mat') participant_list=tmp.model_parameters(:,1)'; %% Models DEV K6 %%%%%%%%%%%% % Thompson % %%%%%%%%%%%% % 9 model = model+1; mod.file_name{model} = 'D:\MaggiesFarm\...
%% Surrogate model selection plots % Script for analysing GP covariance function dependence on data sampled % from DTS-CMA-ES run over the noiseless part of the BBOB framework. % Script also creates graphs and tables. % %% % load data % checkout file containing all loaded data tmpFName = fullfile('/tmp', 'smsp_dat...
function MDM_master(observer) % clc; % clear; %% 0. Addpath datapath = 'Y:\Aging\Medical Decision Making\Medical_DM_aging\data'; functionpath = 'Y:\Aging\Medical Decision Making\Medical_DM_aging\Function'; addpath(genpath(datapath)) addpath(genpath(functionpath)) %% 1. Caliberation TrackerCaliberation; %% 2. What order...
clear all; close all; clc; % Kinetic Analysis for Jay's study % November 3rd 2017 %% ---------------------------------------------------------------------------------------------------------------------------------------% system = 'WIN'; if strcmp(system,'OS') path = '\\Mac\Home\Google Drive\3-Research\2...
%identifyPhoneTone we are return -1 if we are not found a number from the %pad. function [number] = identifyPhoneTone(x, fs) %% definitions %% f_row = [697 770 852 941]; f_column = [1209 1336 1477]; phonePad = [ [1 2 3]; [4 5 6]; [7 8 9]; [10 0 11] ]; %% plot graph for Frequ...
function nb = LoiBinomiale(n, p) % p compris entre 0 et 1 nb = 0; for k = 1:n nb = nb + LoiBernoulli(p); end end
%% important info % plot only hoop at left and right frames % m06: left 415 +- 15; right 815 +- 15 % m01: left 375 +- 15; right 855 +- 10 % if errors happen with prev_centers, change the threshold in 'track the % body' part to 0.5 / 0.6 x_left = 415; l_oscillate = 15; x_right = 815; r_oscillate = 15; %% variables % us...
%% HURRREAD reads the hurricane data from the file 'hurricanes.data' %% 1. Open hurricanes.data file. edit('hurricanes.data') %% 2. Import column headers from hurricanes.data file. fid = fopen('hurricanes.data','rt'); headers = textscan(fid,repmat('%s',1,10),1,'headerlines',10); %% 3. Make use of CollectOutput opt...
function tf = inputyn(str,varargin) %INPUTYN Asks a yes or no question and returns true or false. % % function tf = inputyn(str,default) % Returns true if the user types anything with a 'y' or 'Y' in it % Returns default if the user doesn't type anything. % Default is optional and defaults to true. % % Mercurial revis...
%% HURRSCALE -- Correlation of wind speed against pressure for hurricanes % % The Saffir-Simpson scale is used to categorize hurricanes. Often both % center pressure and maximum sustained wind speed are given even though % categorization is based only on wind speed. This script % demonstrates that the two measure...
clear; % Task 2: % 0.08+0.42-0.5, expected = 0, actual = 0 r1 = 0.08+0.42-0.5; % 0.42-0.5+0.08, expected = 0, actual = -1.3878 * 10^-17 r2 = 0.42-0.5+0.08; % MATLAB Arbeitet Standartmässig mit floating point Datentypen => double % keine der Varianten ist merklich besser. r2 = round(r2, 2); % Task 3: a = 0:14; % Zahl...
function Lfdobj = int2Lfd(m) %INT2LFD converts a nonnegative integer to a linear differential % operator object that is equivalent to D^m. The range of the % functional data object in any cell is set to [0,1], and is % not actually used when a linear differential operator object % of this nature is applied. % I...
%DEMO_HARMONIC % This function evaluates the harmonic sum \sum_{i=1}^{\infty} 1/i % in different arithmetics and with different rounding modes. rng(1) fprintf('Format Round mode Sum No. terms\n') fprintf('------------------------------------------\n') for p = 0:4 clear options switch p ...
function desired_heading=f_traj3(V_in2) global par x = V_in2(1); y = V_in2(2); phi = V_in2(3); par.psi = V_in2(4); u = V_in2(5); v = V_in2(6); p = V_in2(7); r = V_in2(8); lastLocation = [x;y]; % desired_heading = 0; [l, c] = size(par.waypoints); if(c ~= 0) if (par.distanciaAlvo < 10) if...
function [B] = calcularBdelLoop(a,b,x,y,z,I,n) % función encargada de calcular el campo B dado un punto en el espacio. %-------------------------------------------------------------------------- %---Parameters settings--- id_cable = 1; mu_0 = 4*pi*1e-7; % Permeabilidad magnética del aire. B = zeros(1,3); %-----------...
% mfile belonging to the documentation file % % o history % Daniel Klawitter % 24-02-2010 - 10:04 created % % o summary % All algorithms presented in the documentation are implemented here. % Examples are shown. You can step through the code while working % through the documentation % % o TODO: % ...
%% 讀取CTD資料夾裡的所有檔案 clear;clc;clf cd('.\CTD') % 設定檔案路徑 a=dir; %% 用CTD資料夾讀取沒有S開頭的資料,把資料讀進Matlab % load 1-1.cnv for i = 3:10 filename = a(i).name; fid = fopen(filename,'r') %讀檔 while strcmp(fgetl(fid),'*END*') == 0 %一行一行讀取資料,直到讀取到'*END*'字串為止 isEND = feof(fid); %測試檔案是否以讀取到末端(是回應1,否回應0) end c...
function phi_n = PhaseTruncate(phi,levels) %Maps continuous phase values of -pi to pi to quantized values of %0 to 2*pi (where levels is the number of quantized values between 0 to %2*pi) phi(phi < 0) = phi(phi < 0) + 2*pi; phi(phi > 2*pi) = rem(phi(phi > 2*pi),2*pi); round_phi = [0:2*pi/levels:2...
X2 = zeros([1,200]) x1 = linspace(1.5,2.5,200) for i = 1:200 X2(i) = findx2(x1(i)); end
function [structureoutput]=electromagnetic_field_xyz(xyz,nm,ab,pq,cd,relindex,tol) % electromagnetic_field_xyz.m : Calculates the fields of any of the % incident, scattered or internal % beam shape coefficients. % % Usage: % % [structureoutput]=electromagnet...
function [acc,area,thres,points] = drawROC(output, ts_label, disp, query_flms) % author lvjiangjing % email: lvjiangjing12@gmail.com % data: 2013/10/11 if ~exist('disp','var') disp = 1; end output = output(:); ts_label = ts_label(:); [x,idx] = sort(output); y = ts_label(idx); y(y~=1) = 0; % make su...
clear all; close all; moving_data1 = load('matlab_testCV1.txt','-ascii'); [moving_num1, dummy] = size(moving_data1) moving_data2 = load('matlab_testCV2.txt','-ascii'); [moving_num2, dummy] = size(moving_data2) m1x = moving_data1(:,1); m1y = moving_data1(:,2); m1z = moving_data1(:,3); m2x = moving_data2(:,1); m2y = ...
function y=Aufgabe_2a(t_start,y_start) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Aufgabe 2a % Aufruf: ergebnis = Aufgabe_2a(t_start,y_start) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% t=t_start; y=y_start; h=0.25; laufvariable = 1 % Euler while(t<=10), t1_gesamt(laufvariable) = ...
% example: learnNNWeights(['traces-fourraydistance/trace-m0-SmartRandomAgent-nnet.txt';'traces-fourraydistance/trace-m1-SmartRandomAgent-nnet.txt'],8,5) % example: [IW,LW,B1,B2,ranges] = learnNNWeights(['traces-fourraydistance/trace-m0-SmartRandomExplorerAgent-nnet.txt';'traces-fourraydistance/trace-m1-SmartRandomExplo...
function [ output_args ] = rayFocus( input_args ) %RAYFOCUS Function to focus a ray incident in a lens % Detailed explanation goes here end
%% LiTrack constants global MEV2GEV MM2M; MEV2GEV=0.001; MM2M=0.001; global DESIGN EXTANT; DESIGN=0; EXTANT=1; % File handline global PARTICLEFILEEXT PARAMFILEEXT FILEEXISTS; FILEEXISTS=2; % exist function return code for regular file that exists PARTICLEFILEEXT='.zd'; % File extention of LiTrck particle file PARAM...
% WRITE YOU CODE HERE!!! function myplotarea(str,n) % read the file into a cell cellarray = textscan(fopen(str,'r'),'%s %f %s %f'); x=cellarray{2}; y=cellarray{4}; % check for l=value of n to be smaller than length of data if n<=length(x) % area plot area(x(1:n),y(1:n)); hold on; ...
% rotate about line in 3D % function rot = rotateAboutLinePdP(p, a, axis, theta) % p = points % a = point in 3D % axis = direction of line % theta = rotation angle function rot = rotateAboutLinePdP(p, a, axis, theta) matrix = vrrotvec2mat([axis theta]); rot = bsxfun(@plus, matrix*bsxfun(@minus,p,a'), a'); end
function X = create_design_matrix(numberOfObs, x, y, z, q) %CREATE_DESIGN_MATRIX Creates a design matrix for % linear regression % Use a linear model in 2 variables % Y ~ b0 + x*b1 + y*b2 = X*beta = B*beta if nargin == 5 % Second to fifth input is a column vector, one input for each % covariate % Co...
%load cactus_q5 %delta0=5.99/1.2 %load crowd_q6 %delta0=5.99 clear qcoef %load cactus_96frames; a=single(a); %load crowdrun_96frames; a=single(a)/4; %a=a(1:512,1:512,33:64); ar=ar(1:512,1:512,33:64); %a=a(:,:,33:64); ar=ar(:,:,33:64); e=a-ar; e0=e; e=e.*e; e=sum(sum(sum(e))); e=sqrt(e/numel(a)); SNR=20*log10(256...
function res = g_dy(x, y) res = 1;
function [fitresult, gof] = singlesnr(y2fit, z2fit) %CREATEFIT1(Y2D5,Z2D5) % Create a fit. % % Data for 'untitled fit 1' fit: % X Input : y2d5 % Y Output: z2d5 % Output: % fitresult : a fit object representing the fit. % gof : structure with goodness-of fit info. % % See also FIT, CFIT, SFIT. %...
file_name{1} = '/home/alex/Desktop/Kernels/Ronnie/P13/data/sep_kernel_adjbeta'; list_n{1} = [2 3 7]; file_name{2} = '/home/alex/Desktop/Kernels/Ronnie/P06/data/sep_kernel_adjbeta'; list_n{2} = [2 3 4]; file_name{3} = '/home/alex/Desktop/Kernels/Derry/P08/data/sep_kernel_adjbeta'; list_n{3} = [3 13]; file_name{4} = '/ho...
function [x,y]=ellipse_p_add(a,b,p,Qx,Qy,Px,Py) % Define O=(p,p) if Qx==p & Qy==p x=Px; y=Py; elseif Px==p & Py==p x=Qx; y=Qy; else flagx=mod(Qx+Px,p); flagy=mod(Qy+Py,p); if flagx==0 & flagy==0 x=p; y=p; else [x,y]=ellipse_p_add_noequal(a,b,p,Qx,Qy,Px,Py); end end en...
% ........................................................................ % My template Matlab codes for Linear Regression with multiple variables % Algorithm: Gradient Descent % gradientDescent.m % Navid Salami Pargoo % 2020 % ........................................................................ % gradientDesce...
function h1d= WLD_new(image,radius,neighbors) % ==========================Parameters Setting========================= alpha = 3; beta = 5; EPSILON = 0.0000001; if nargin<4 Ebin = 6; Obin = 8; Sbin = 20; end %====================================================================== %% ====================Diff...
B = fopen('Full_Medium.txt', 'r'); s = 1; i=0; while ~eof(B) line=fgetl(B); if text(s)== '~' text1(s)=','; i=i+1; else text1(s)=text(s); end s=s+1; end A=fopen('Full_Medium_CSV.csv', 'w'); fwrite(A,text1); fclose(A);
function ControlExpFitJAN25 %run July 23 2017 %Control Exponential fit, current as of January 25 2018 clearvars close all clc desiredwells = [22 70]; figure1 = figure; cmap = cbrewer('qual','Set1',numel(desiredwells),'cubic'); colorcounter = 1; for j = desiredwells filename = sprintf('w%d_d...
function [xs, nverts, tets, ntets, nverts_level, ntets_level, parent_id, parent_coeff]=mul_level_uref_tetmesh_deg2o3(xs, nverts, tets, ntets, sibhfs, degs_level) if nargin==0 xs=[1 0 0;... 0 1 0;... 0 0 0;... 0 0 1;... 0 0 -1]; nverts =size(xs,1); nv_orig=5; tets=[1 2 3 4;2 1 3 5]; ntets...
function [ M_1_V, Tm_1_V, Psi_h_1_v ] = Hao_3d_Partial_Derivatives_DSR_Extra(a,h,Tm,Sm,Sm_1_Mx,Sm_1_My,Sm_1_Tm,Sm_2_MxMx,Sm_2_MyMy,Sm_2_TmTm,Sm_2_MxMy,Sm_2_MxTm,Sm_2_MyTm,Sm_1_V,Sm_2_vTm,Psi_M,Psi_h) %Derive the Partial derivatives for the Double Square Root Equation. % ---input: ---- % a, h, psi_M: 2x1 vector % Tm : ...