text
stringlengths
8
6.12M
function [] = nspend(N,g,k,nsteps) T=20*pi/sqrt(g); x0=[zeros(N,1);pi/2*ones(N,1)]; v0=zeros(2*N,1); u=[x0,v0]; figure(1); r=u(1:N,1); th=u(N+1:2*N,1); z=[0;-1i*cumsum((1+r).*exp(1i*th))/N]; hp=plot(real(z),imag(z),'.-b'); xlim([-2,2]); ylim([-2,1]); axis manual; pbaspect([1 1 1]); t=linspace(0,T,nsteps); h=t(2)-t(1); ...
function savetextarchive(tag,P,A,M) % % savetextarchive(tag,P,A,M) % fname = [tag 'pam.txt'] ; f = fopen(fname,'wt') ; if f<=0, fprintf('Error: unable to open file %s\n',fname) ; return end P = [P,A,M] ; fprintf(f,'%4.3f, %1.5f, %1.5f, %1.5f, %2.4f, %2.4f, %2.4f\n',P') ; fclose(f) ;
% predict missing entries in the real datasets % coded by Eugene Seo (seoe@oregonstate.edu) clear;clc;close all; addpath(genpath(pwd)) %% load datasets Y_true = importdata('dataset/Y.csv',','); [I,J] = size(Y_true); A = importdata('dataset/A.csv',','); % Availability matrix Y_true(isnan(A)) = nan; % let unknown...
%Script to calculate the effect of different numbers of data years on the calculation of tau. %Makes line plots of forest type-level statistics and maps. % %Dependencies: % - *.mat files from hansen_disturb_int_calc_1deg_lu_v4_lossyear.m % calculated with a range of different values for lossyear % - hansen_forested_fra...
function tone = makeTone(f,Fs,tsec) % function tone = makeTone(f,Fs,tsec) % creates a musical tone which can be played back using soundsc % Inputs: % f: desired frequency in Hz. A concert is 440 Hz; middle C is 261 Hz % Fs: sampling rate in Hz. 8000 is a good choice % tsec: length of tone, in seconds % some n...
function r = forcingd3fdxdp2(t,fd_cell,p,more) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % forcingd3fdxdp2 % % forcing function estimation % % third derivative with respect to smooth and forcing coefficents (twice). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
% Andrew Brown Homework 2 Problem 6 clc clear % Epidemic Part 1 %Part 1.1 %Initial Values a=10; %the contact rate: the average # of people a person comes in contact with. b=1.25; %the amount of time in days that a person is infectious S0=0:500:2000; %Susceptibles, those who have never had the illness and can catch ...
function output = getIndicesOfPointInVolume(obj,point) output = round((point - obj.origin)./obj.resolution) + [1 1 1]; end
classdef QLearningAgent %QLEARNING This is a class that will generate an object with an %environment, agent, and perform Q Learning to develop a policy for the %agent to learn to choose an ideal action for a given state in the %environment. properties QMatrix gamma learningRate ...
function rawAddr=getTmpdiff128Addr(x,y,pol); %function rawAddr=getTmpdiff128Addr(x,y,pol); % returns a raw address for Tmpdiff128 for a pixel with x,y location and % pol polarity with pol=0 for OFF and 1 for ON rawAddr=(y)*256+(127-x)*2+pol; %extractor.getAddressFromCell(x,y,pol);
%% Calculation of Net Rotation function rotation=net_rotation(probable_independent_slip_system,collect_shear,strain_increment) %% Forming 3x3 matrix by calculating diadic prodcut for counter9=1:1:size(probable_independent_slip_system,1) three_by_three(:,:,counter9) = [probable_independent_slip_system(counter9,4);proba...
function [t2,y2] = eulermod(tmax, y01,y02,h) n = floor(tmax/h); % Metoda Rungego Kutty 2 rzedu y2=zeros(2,n); t2=zeros(1,n); y2(1,1)=y01; y2(2,1)=y02; for i = 1:n-1 y2(:,i+1) = y2(:,i) + h*(rownania(t2(i)+h/2,y2(:,i))+rownania(t2(i),y2(:,i))*h/2); t2(i+1)=t2(i)+h; end
function out = OXY_HRF(s,x,Fr) % OXY_HRF -- Use Analytic Methods to compute HRF functions of the observed % changes in oxygen signals based on the assumption that the % oxygen response to locomotion is a linear, time-invariant system. % % USAGE: % h = OXY_HRF(s,x,Fs); ...
function okrag % okrag x^2+y^2=r^2 w ukladzie wsp. x=-4:0.1:4, y=[-4 ] r=2; % promien x=-4:0.1:4; % zakres zmiennosci x y1p=sqrt(-x.^2+r^2); % 1-szy polokrag x1okrag=x; x1okrag(imag(y1p)~=0) = []; % dla braku punktow okregu y1p(imag(y1p)~=0) = []; % bez czesci urojonych y1m=-y1p; % 2gi polokrag plot(x1okrag,y1p, '-b',...
function [ I] = getLetterFeatureAndSetClass( region ) %GETCGVFEATURES Summary of this function goes here % Detailed explanation goes here % For key input for making datasets YES = 121; NO = 110; ALL_NO = 113; ALL_YES = 13; QUIT = 27; % If no text in region skip_region = false...
function img = XuSegmentAndSave(file_name,s_jsonc_fbp,s_jsonc_bone_corr,s_jsonc_preprocessing) %status = XuSegmentAndSave(file_name,s_jsonc_fbp,s_jsonc_bone_corr,,s_jsonc_preprocessing) %s_jsonc_preprocessing is optional if nargin == 3 preprocessing_para.A=0; else preprocessing_para = XuReadJsonc(s_jsonc_prepr...
classdef Matrice properties n; m; value; end methods function r = total(obj) r = sum(sum(obj.value)); end function r = norm(obj) r = sqrt(sum(sum(obj.value.^2))); end end end
function [intersectionCylindreExiste, positionIntersectionCylindre, normaleIntersectionCylindre] = CollisionCylindre(droite, positionDepart, cylindre) intersectionCylindreExiste = false; positionIntersectionCylindre = Vecteur(0, 0, 0); normaleIntersectionCylindre = Vecteur(0, 0, 0); [intersecti...
%% cleaning clear; close all; set(groot, 'DefaultTextInterpreter', 'Latex'); set(groot, 'DefaultLegendInterpreter', 'Latex'); % set(groot, 'DefaultAxesFontSize', 14); set(groot, 'DefaultLineLineWidth', 2); figindex = 1; %% load rawdata = csvread('../../build/out.csv'); index = 1; t = rawdata(:, index); index = index +...
%Andrew Brown Homework 9 Problem 4 clc clear close all %Teacup Part 5 % Read them back in again - put this in the top of your script xsys = dlmread('TeacupPts.txt'); % Get x and y points back out xs = xsys(1,:); ys = xsys(2,:); pts = [xs;ys;ones(1,length(xs))]; % Plot the points from the original sketch at the ori...
close all; clear all; load('main') squirrel1.task_id = 0 squirrel1.move2Pos(food(16).loc-[15,15],100) input('continue') squirrel1.task_id = 1 squirrel1.move2Pos(food(16).loc-[5,-5],100) c_id = nearestCache([squirrel1.pos.x,squirrel1.pos.y]) squirrel1.pickFood([str2num(squirrel1.temp_input{2}),[c_id;c_id]],100)
function LoadWeatherData(filename) global nummins starttime formatIn formatIn2 formatIn3 inc_min_step offset_time current current_end min_quality global search_region max_search_time prev_time dataset newdataset step_behind global indFrictionValue indFrictionQuality ind1PrevDistFriction ind1PrevTimeFricti...
function microsacc_gui(saccades, eyepos, samplerate, velocity, velocity_threshold, acceleration, staridx) %-------------------INPUTS---------------------- % saccades numtrials by 1 cell array. Each cell contains a % numsaccades by 7 matrix of the identified microsaccades % ...
function [U, V] = calUV(dato,deltax,deltay, options) %function [U, V] = calUV(dato,deltax,deltay, options) % % Weight calculation % Uses the fringe pattern gradient % % U(:, end) and V(end, :) are forced to zero % this condition is requiered for unwct3 calculations EPS0 = options.eps0; P2 = dato; P2(:,1:end-1) = dato...
function allPaths = getShortestPaths(skel, treeIdx) % allPaths = skel.getShortestPaths(treeIdx) % Computes the length of the shortest path between each pair % of nodes in the tree specified by treeIdx. % % treeIdx % Scalar. Linear index of tree. % % allPaths % Sparse and symmetric NxN matrix. Entry allPaths(i, ...
%% setup imageSize = [100, 100, 3]; display = displayCreate('CRT12BitDisplay'); prior = load('sparsePrior.mat'); renderMtx = load('periRender.mat'); renderMtx = renderMtx.renderMtx; %% show image load('inputLinear.mat'); figure(); for idx = 1 : size(inputLinear, 1) subplot(2, 5, idx); image = reshape(inputLi...
% Initialization of table variables execut_time1 = zeros(9,1); execut_time2 = zeros(9,1); timestep1 = zeros(9,1); timestep2 = zeros(9,1); timesize1 = zeros(9,1); timesize2 = zeros(9,1); advect_tsz = zeros(9,1); diffus_tsz = zeros(9,1); N = [11,21,41,81,161,321,641, 1281, 2561]'; for i = 1:9 [timesize...
function MatrixInverseBenchmark( testName, doV ) nTrial =10; if strcmp( testName, 'invSX' ) runinvSX( 250000, [10,20,40,80,160], nTrial, doV ); elseif strcmp( testName, 'invSXT' ) runinvSXT( 250000, [10,20,40,80,160], nTrial, doV ); elseif strcmp( testName, 'invcholSX') runinvcholSX( 250000, [10,20,40,80,1...
function tf=gradientCheck(subjectgradient) % performs a check to make sure the subject was accurate in the test phase % cat A= 0; B=1; % turn gradient into a vector subjectgradient=reshape(rot90(subjectgradient,3),numel(subjectgradient),1); egs=[1;2;9;10;55;56;63;64]; num=length(egs)/2; %egs per cat errorCount=...
function [x, Lerr, smat, xarr]=CddPreKernel(clv,x) % CDDPREKERNEL computes from (v,x) a pre-kernel element. % Inspired by Jean Derks, see email from 26/05/2010. % Source: Meinhardt, 2010. % % % Usage: [x Lerr smat xarr]=CddPreKernel(clv,x) % % Define variables: % output: % x -- Pre-Kernel element (output) % ...
% STA5107 HW7 % Menghan Lin % 3/12/2021 %% Q1 ------- % (a) Simulate processes xk and yk A = [1 1;0 1]; B = [1 0]; Gamma = 0.1 * diag([1,1]); K = 100; Q = eye(2); Lambda = 0.1; x(:,1) = zeros(2,1); for j = 1:3 for i = 2:K u = mvnrnd([0,0],diag([1,1])); w = normrnd(0,0.01); x(:,i) = A *...
function [pose] = build_linear_system(pose, radii) num_points = pose.num_points; num_centers = pose.num_centers; I = pose.I; points = pose.points; centers = pose.centers; f = zeros(num_points, 1); Jc = zeros(num_points, num_centers * 2); Jr = zeros(num_points, num_centers); correspondences = cell(num_points, 1); f...
%% ELLIPSE - XY coordinate of a parametrically specified ellipse. % % [X Y] = ELLIPSE(Z, A, B, ALPHA, NPTS) returns the ellipse coordinates specified % by Z, A, B, ALPHA (as returned by FITELLIPSE) with NPTS points % (default: 100). % % A, B are positive scalars, Z a 2x1 column vector, and % A...
function [ out_img ] = highfreqemphasis_cvip (input_img, filter_type, block_size,cutoff, alfa, keep_DC, order) % HIGHFREQEMPHASIS_CVIP - Performs high frequency emphasis filtering. % % syntax : % -------- % [ out_img ] = highfreqemphasis_cvip (input_img, filter_type, block_size,cutoff, alfa, keep_DC,order) % % ...
function [ extrap, normtable ] = richardson( A1s, kis, t, exact ) % Perform Richardson extrapolation on approximations A1s. % % Input: A1s - Row vector of initial approximation data: % A1s(1) = A_{1}(h) % A1s(2) = A_{1}(h/t) % A1s(3) = A_{1}(h/t**2)...
function h=vectarrow(p0,p1,handle,color_line,color_head) %Arrowline 3-D vector plot. % vectarrow(p0,p1) plots a line vector with arrow pointing from point p0 % to point p1. The function can plot both 2D and 3D vector with arrow % depending on the dimension of the input % % Example: % 3D vector % p0 ...
%DEMO_GEOM2D_IRIS Demonstrate some geom2d functions on Fisher's iris data. % % output = demo_geom2d_iris(input) % % Example % demo_geom2d_iris % % See also % % ------ % Author: David Legland % e-mail: david.legland@inrae.fr % INRAE - BIA Research Unit - BIBS Platform (Nantes) % Created: 2023-04-04, using M...
% Test for WIENER % Wy = tf(1, [1 1]); % υΣΤΑΧΛΑ % Wn = tf(0.2, 1); % πΟΝΕΘΑ % Wo = tf(1, 1); % οΒίΕΛΤ % Wt = WIENER(Wy, Wn, Wo); % => Wt = tf(0.8198, [0.2 1.02]); Wy = tf(1, [1 1]); % υΣΤΑΧΛΑ Wn = tf(0.2, 1); % πΟΝΕΘΑ Wo = tf(1, 1); % οΒίΕΛΤ Wt = tfnorm(wiener(Wy, Wn, Wo)); Wt disp('Must be'); Q...
function trstoploss(t,p,pos,th,ph,thresh) % trailing stop loss function. % t,p = time and price sampled half hourly % pos = position from marisa with N=220, M=25 % th,ph, time and price sampled minutely % thresh is the stoploss threshold in ticks N=length(ph); % make a long vector or positions at the minute ti...
function fighandle = sazwdisplayprogress(fighandle, figuretitle, systemstate, constants, performancehistory) % USAGE: fighandle = sazwdisplayprogress(fighandle, figuretitle, systemstate, constants, performancehistory) %----------------------------------------------------------------------------- %FOUNDATIONS OF STATIS...
function addata = stdfidmanip(data,dpts,ph0,ap_type,ap_p1,ap_p2,ap_p3) %Memory hog. Generates a filter matrix the size of the data set. %Performs a series of standard manipulations to the data. (no transforms) % data -> the raw data %Simple manipulations (Performed first) % dpts -> drops this number of points from the...
function VEC = ReadMeasurementVector(filename) % fid = fopen(filename,'r'); line = fgetl(fid); fprintf('Reading vector %s',line); temp = fscanf(fid,'%i',[1 1]); fprintf(' of size %i\n',temp); DATA = fscanf(fid,'%f',[3 temp]).'; fclose(fid); VEC(DATA(:,1),1) = DATA(:,2)+1i*DATA(:,3);
function y = fdd(x) y = 6 * x;
function drag_patch %DRAG_PATCH Demo to show how to create patches that can be moved around % % Example: % drag_patch; % runs the code % % Author: Joseph Kirk % Email: jdkirk630@gmail.com % Release: 1.0 % Release Date: 12/6/07 figure('WindowButtonMotionFcn',@figButtonMotion); ax = axes; np = 25; %...
function y=Check_Diagonal_Dominanace(A) %Check_Diagonal_Dominanace of rows [m,n] = size(A); if m ~= n error("not squared matrix"); end for i = 1:m if abs(A(i,i)) < sum(abs(A(i,:))) - abs(A(i,i)) y=0; return end end y=1;
%% clc clear close all %% Consants K2a = 0.01; %Nm/A K3a = 0.01; %V/rad/s Ra = 1; %ohm La = 0.5;%H Ja = 500; %kgm^2 ba = 0.1; %Nms K2e = 0.01; %Nm/A K3e = 0.01; %V/rad/s Re = 1; %ohm Le = 0.5;%H Je = 600; %kgm^2 be = 0.1;%Nms %educated guess: M_e = 60; %kg Len_e = sqrt(300); %m g = 9.81; %m/s^2 %% State v...
clc clear all close all X = linspace(-20,20,50); Y = linspace(-20,20,50); f = @(R,THETA) (-exp(-R)*(R.^2+6.*R+18+24./R)+1./R+(0.5*(3.*cos(THETA)-1))*exp(-R)*(5.*R.^2 +30.*R+360./R+720./R.^2+720./R.^3)-6./R.^3); [X,Y] = meshgrid(X,Y); R = sqrt(X.^2+Y.^2); THETA = atan(Y./X); V = f (R, THETA); surf (R.*sin(THETA), R...
function editbox = uispanedit(varargin) % Edit box user control with fixed height but spanning width. % % This user control automatically takes all available space for width but % maintains a fixed height when resizing. % Copyright 2010 Levente Hunyadi ix = 1; if nargin >= ix && ishandle(varargin{ix}) parent = va...
function devlist = getbpmlistbyrack(argin); %GETIDPMLIST - Return devicelist of BPM in a given cell % % OUTPUT % 1. rack number % % % Written by Laurent S. Nadolski cellNumber = argin; elem = family2elem('BPMx'); switch cellNumber case 1 elem = elem(1:7); case 2 elem = elem(8:15); cas...
function [result] = fitness1(vertices, edge, alpha, beta, gamma, xytilde) % This function uses to evaluate the fitness function % compute theta x = vertices(:,1); y = vertices(:,2); n_v = length(x); n_e = length(edge); xtilde = xytilde(1:size(x)); ytilde = xytilde(size(x)+1:end); theta = zeros(size(n_e)); for i = 1:n...
function [ signal_to_noise ] = single_pulse_snr(probability_of_detection, probability_of_false_alarm) % Calculate the required signal to noise ratio given a probability of detection and probability of false alarm. % :param probability_of_detection: The probability of detection. % :param probability_of_false_ala...
function [Projection_Matrix] = proj(f) %相机坐标投影(projection)成图像坐标 %输入参数 % f 相机焦距(数,cm) %输出参数 % Projection_Matrix 投影成像(矩阵) Projection_Matrix = [f 0 0 0; 0 f 0 0; 0 0 1 0]; return
close all; clear all; %load('mat/glm_bic_bms_controls.mat'); %load('mat/glm_bic_bms_nocontrols.mat'); %glm_ix = [1 2 3 4 8]; %load('mat/glm_bic_bms_single_controls.mat'); %load('mat/glm_bic_bms_glm=102_con=theory_change_flag_Num=1_sphere=10.0mm_multiplex.mat'); %load('mat/glm_bic_bms_glm=102_con=theory_change_flag_N...
%% stk_read_raw_coverage_data2.m %this function reads in the cvaa coverage access files prodced in stk. %The input to this function is the filename *.cvaa %The output is a cell of cells. One cell for each grid point and each cell %within contains the lat | lon | access start | access stop | access duration functi...
clc clear close all %% OPTIONS options %% INPUT VALUES % HUB/TIP RATIO lambda = 0.62; % ROTATIONAL SPEED n = 5300; %rpm % ROTOR INLET RELATIVE MACH NUMBER @ TIP M_R1_t = 0.99; % STATOR FLOW DEFLECTION V2Tm_V1Tm = 0.5; % Put 0 for axial velocity at stator outlet % SOLIDITIES sigma_R_m_design = 1.3; sigma_S_m_des...
% Script recording started at : 15-Jan-2016 17:14:03 fullPath = which('pveCorrection'); [BASE, name, ext] = fileparts( fullPath); TESTDATA = [ BASE filesep 'test_data' filesep]; INPUTS = Parameters( {[ TESTDATA 'Test_puck_gaussian3D_FWHM=11.75mm.mat']} ); imlook4d_current_handle = Open(INPUTS{1}); % Handle to ...
function q = qinv(p) % QINV quaternion inverse % % Q = QINV(P) returns a quaternion Q which is the quaternion inverse of % quaternion P. % - P is a quaternion. It is a 4-vector or a 4*N array (column i % represents quaternion i) where N is the number of quaternions. % - Q is the quaternio...
function [f, g, h] = reg_LL(data, x, C, theta) % computes objective function and it's gradient with % given parameters. % objective function = - (log-likelihood - regularizer) % like probability = sigma(theta1*s + theta2*a + theta3) m = length(data); f = 0; g = zeros(size(x)); h = zeros(si...
% for minimum reflux ratio global yA_arr xe = 0:0.01:1; ye = yA_arr; % up, Bottom and Feed mole fractions are equal to 85 % mol, 5 % mol % and 30 % mol respectively. xu = input('up mole fraction'); xb = input('bottom mole fraction'); zf = input('feed mole fraction'); R = input('Reflux ratio'); % Reflux ratio is equ...
function [A] = adjacency_radius(xy,r) %-------------------------------------------------------------------------- % % Copyright (c) 2009-2011 Jeffrey Byrne % %-------------------------------------------------------------------------- %% Neighborhood radius n = size(xy,1); d = sqrt(sqdist(xy',xy')); % lightspeed A = z...
data=X'; thr=15; L=25; censoredornot=0; %=1 if you want censoring otherwise set it to 0 t=1; msteps=10; stepsize=0.2; begin=0; [logsigma,dim_norm] = diffusion_map_kt(data,censoredornot,thr,thr,thr+L,begin,msteps,stepsize); [dim_max,id]=max(dim_norm); %find local maxima sigma=10^(logsigma(id)); %%%%%%%%%%%%%%%%%%%%%...
function [c, cPol, cellSize] = createCellOffsets(type,gn,gr,support) %CREATECELLOFFSETS Create cell offsets switch type case 'square window' x = 0:2*gn:gr(2)/2-3*gn-2; x = [-x(end:-1:2) x]; y = 0:2*gn:gr(1)/2-3*gn-2; y = [-y(end:-1:2) y]; c = [repmat(x,[numel(y) 1]) repmat(y...
function [HH,MM,SS]=GMST(yy,mm,dd,hh,min,sec) GM=mod(18.697374558+24.06570982441908*... (G2JD(yy,mm,dd,hh,min,sec)-G2JD(2000,1,1,12,0,0)),24); HH=floor(GM); FM=(GM-HH)*60.0; MM=floor(FM); SS=(FM-MM)*60.0; end
function tSignal = GetMeasuredRadiationSignal( tConverter, strFilepath ) % aafRawData = load( strFilepath ); % tSignalsIDs = Signal.GetSignalsIDs(); tDevicesIDs = Signal.GetDevicesIDs(); % tSignal = Signal(); tSignal.Set( ... tDevicesIDs.iSLBWeatherForecast, ... tSignalsIDs.iExternal...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function [outPixels, meanDiff, stdRatio] = recolorReinhard(srcPixels, tgtPixels, doLab, alphaMean, alphaVar) % Recolors an object put inside an image according to the recoloring technique by Reinhard et al. % Lab space used instead of origi...
clear all, close all addpath('Batch 11') addpath('Batch 12') addpath('Batch 13') addpath('Batch 14') num = 196; [fPrior, prefs, context, samples] = humanFeedbackRobotHandover(); disp(['context: ', num2str(context(num-16))]) jani = dlmread([num2str(num), '.txt']); posX = jani(:, 15); posY = jani(:, 16); posZ = jani(:, ...
%% CVEP SPELLER % runs the cvep speller simulation in 3 configurations: % 1) original beta stopping cvep speller % 2) modified predicted gaze prior + beta stopping cvep speller % 3) modified idealized gaze prior + beta stopping cvep speller %% RESET + LOAD LIBS restoredefaultpath; clear variables; close...
function [r1,r2] = squarecube(x,y); r1=x*x; r2=y^3;
function [] = writevtk3D(X,Y,Z,Ux,Uy,Uz,Pr,filename) % writevtk3D saves a 3D vector/scalar array in VTK structured format. [Nxt,Nyt,Nzt]=size(X); fid = fopen(filename,'w'); fprintf(fid,'# vtk DataFile Version 3.0\n# Velocity/pressure data\nASCII\n'); fprintf(fid,'DATASET STRUCTUR...
function [avPh, Ka] = AvancePhaseBode1(FTBO, PMd, wgd, marge) % Retourne le compensateur avance de phase pour la fonction de transfert % FTBO % param: FTBO - la fonction de transfert à compenser % param: PMd - la marge de phase désirée % param: wgd - la fréquence de traverse en gain désiré % param: marge - l...
function tf = checkPixelRes(lp) if isfield(lp,'pixelRes') tf = lp.pixelRes; else tf = 0; end
clear clc close all filename = '100g_5cycles_parallel_no_header.csv'; num100p = csvread(filename); time_100p_raw = num100p(:,1); disp_100p_raw = num100p(:,2); %this is in mm rot_100p_raw = disp_100p_raw/3*180/pi; temp_amb_100p_raw = num100p(:,3); temp_100p_raw = num100p(:,4); %This gets all the data on 0.01 dt time_...
% This script takes your SST output and checks to make sure there are no % strange responses. You will get a bunch of output files of the form N x R % (N subjects, R runs) telling you how many go trials per run (should always be % the same number, say, 96) how many stop trials (should be 32) % and importantly: % how ...
function [] = sphereworld_plot(world, xGoal) %Plot the Obstacles in world (uses the definition of world defined in HW) %world - Structure defined in HW, contains fields rSphereAll, xSphereAll, %and rInfluenceAll. %Plot the obstacles sphere_plot(world.xSphereAll,world.rSphereAll) %Plot the sphere of influence of each ...
function procpar_vars = load_procpar(fid_dir) % load_procpar.m % msb dec 5 2006 % loads variables from procpar into two cell arrays of structures. % each cell contains a name and an array of cells of values. % Some of the vars are numeric and some are strings, % so the data structure has to hold arrays of nums ...
function potential_func = make_potential_BoB(center_point, radius, point_spacing) % Construct the potential field for the BoB base = @(x, y) log(sqrt(x.^2 + y.^2)); potential_func = @(x, y) 0; for theta = linspace(0, 2*pi, round(2*pi*radius / point_spacing)) x_point = radius*cos(theta...
function varargout = UserDataForm(varargin) % Last Modified by GUIDE v2.5 09-May-2017 20:59:44 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @UserDataForm_Ope...
function [dispers]=dispersionCalc(vP1,vS1,d1,vP2,vS2,d2,vP3,vS3,freq,layers) % % Solves for Ralyeigh wave dispersion curve given a set of P and S wave % velocities and depths for two or three layer models. % % [dispers]=dispersionCalc(vP1,vS1,d1,vP2,vS2,d2,vP3,vS3,freq,layers) % Solve for Rayleigh wave phase velo...
% function printsrcdata(srcdata,srcfile) % % Prints all input-cards from the source-struct in matlab % to ASCII-file in Polca-input format % function printsrcdata(srcdata,srcfile) [cards file]=getcardsbwr(); fid1=fopen(['reac_',srcfile],'w'); fid2=fopen(['fuel_',srcfile],'w'); for i=1:size(cards,1); card=rembla...
mynewton('f_ex57', 'df_ex57', 2, 1e-12, 10) mynewton('f6', 'df6', 1.2, 1e-12, 10)
function Cd_nose = C_d_nose(mach_num, vehicle) if mach_num < 1 Cd_nose = 0; else Cd_nose = 3.6/(vehicle.AR_N*(mach_num-1)+3); end end
function C = covMatrix(sig,L,dx,n) C = zeros(n); for kk =1:n for ii=kk:n C(ii,kk) = sig^2*exp(-0.5*((ii-kk)*dx/L)^2); C(kk,ii) = C(ii,kk); end end
function state = plotPop(options,state,flag) ax=gca; ax.YTickLabel={'1','2','3'}; ax.YTick=[1.5 2.5 3.5]; ax.XTickLabel={'1','2','3','4'}; ax.XTick=[1.5 2.5 3.5 4.5]; grid on; scatter(state.Population(:,2),state.Population(:,1)) xlim([0.5 4.5]); ylim([0.5 3.5]); title(['Generation:',num2str(state.Generation)]); % s...
function [correlation] = average_correlation(var_1, var_2, weighted) % This function finds the average correlation between two variables within local clusters. % By default it computes the average weighted by the number of observations in each cluster. % % Input: % ------------ % - var_1 % a cell array of the...
%% 2D Interpolation % two independent variables and one (or multiple) dependent variables. In % general we can interpolate multidimensional data. % unlike 1D interpolation where the spaceing between data didn't matter, as % long as it was strictly monotonic, for the built in "interp2" funcion, % **all of the dat...
clc; clear all; x=[.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7]; y=[173,284,310,439,485,520,605,699,728,735,790,801,840,850]; [theta,theta1] = meshgrid(-1000:1:1000); for i = 1:2001 for j = 1:2001 Z(i,j)=sum((theta(i,j)+theta1(i,j)*x-y).^2)/(2*length(x)); end end figure(1) ; mesh(theta,theta1,Z)...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Eigenfaces: TEST CODE % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Based on the formulation of the eigenfaces method presented in [1] % % Use the Yale database % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
function [labels] = gmm_cluster(X, Priors, Mu, Sigma, type, softThresholds) %GMM_CLUSTER Computes the cluster labels for the data points given the GMM % % input ----------------------------------------------------------------- % % o X : (N x M), a data set with M samples each being of dimension N. % ...
%% Set-up close all % clear all % try % parpool(); % catch % end props = java.lang.System.getProperties; props.setProperty('mail.smtp.port', '587'); props.setProperty('mail.smtp.auth','true'); props.setProperty('mail.smtp.starttls.enable','true'); setpref('Internet','E_mail','mprossmatlab@gmail.com'); setpref('I...
function result = InverseEllipticNome( Q ) %INVERSEELLIPTICNOME Elliptic modulus function. % INVERSEELLIPTICNOME(Q) is the elliptic modulus of the elements of % nome Q. Elements of Q must all be real and are limited to the % interval [0,1]. % % INVERSEELLIPTICNOME is a wrapper function which mimics the ele...
function metrics = get_all_metrics(score_mat, tst_lbl_mat, inv_prop) %{ Author: Yashoteja Prabhu ( yashoteja.prabhu@gmail.com ) %} %% Inputs: %% score_file: test label scores matrix file in sparse format %% tst_lbl_file: test label ground truth matrix file in sparse format %% sizes of matrices in score_file and ...
% Chapter 2: Figure 1 % Model scenarios of Estonia and Spain, under natural conditions and with % supplemented feeding clearvars options = odeset('Refine',1, 'RelTol',1e-5,'AbsTol',1e-5,'NonNegative',1:8); %Ode solver tolerances and restrictions y0 = [0.796, 1.2, 0.002, 0.002...
function info = make_info(depid,tagtype,species,owner) % info = make_info(depid,tagtype,species,owner) % make an info structure % or % make_info % shows a list of recognized tags, species and researchers % % Valid: Matlab, Octave % markjohnson@st-andrews.ac.uk % Last modified: 2 March 2018 %...
function data_der=invder(data) % data_der=invder(data) % inverse 2nd derivative for making data2 matrix for simplisma % written by K.Artyushkova %7/7/1999 [n,m]=size(data); [data2,cm] = savgol(data,17,3,2); data_der=(-1)*data2; for i=1:n for j=1:m if data_der(i,j)<=0, data_der(i,j)=0; ...
%% %% %% %% function init_species = InitSpecies(); %% %% m = 3/5; % 3/5 InitGi = m * 15 ; InitD2R = m * InitGi ./30 ; InitGbc = m * 10; InitAC = m * InitGi ./30 /2 ; InitRGS = m * (InitGbc+InitGi) / 2 /5; InitGolf = 0.8; % InitGolf = 1.0; %% % InitGolf = 0.5; % InitRGS = InitRGS ./ 3...
%MPB: A modified Poisson blending technique %Read the paper: http://link.springer.com/article/10.1007/s41095-015-0027-z %Citation: %@article{ %year={2015}, %issn={2096-0433}, %journal={Computational Visual Media}, %doi={10.1007/s41095-015-0027-z}, %title={MPB: A modified Poisson blending technique}, %url={ht...
%%%%%% Example graph 1 dataset1_path = "datasets/example1.dat"; % keigenvector(dataset1_path, 2); % keigenvector(dataset1_path, 3); keigenvector(dataset1_path, 4); % keigenvector(dataset1_path, 5); % keigenvector(dataset1_path, 6); %%%%%% Example graph 2 dataset2_path = "datasets/example2.dat"; keigenvector(dataset2_p...
function prob = getGlobalLBProbList( p, segCubeIdx ) %GETGLOBALLBPROBLIST Load lb probabilities. % INPUT p: Segmentation parameter struct. % segCubeIdx: (Optional) Integer vector of segmentation cube linear % indices for which the edge list is loaded. % (Default: All cubes in p...
function fval = pendulumFitFunction(t,y,params) % pendulumFitFunction : returns the fit value of pendulum model to % experimental data (t,y) % Copyright 2008-2009 The MathWorks, Inc. % Predicted motion [tout, yout] = pendulumDE(t,params(1),params(2)); % Fitness value fval = norm(y - yout(:,1));
function process_data() % clc; % close all; % clear; set_matlab_utils_path(); load('data/data.mat','Data'); N = length(Data); N_kernels = 10; a_z = 16; b_z = a_z/4; train_method = 'LWR'; dt = 0.01; canClockPtr = LinCanonicalClock(); Data_sim = cell(N,1); for n=1:N data = Data{n}; Timed = data....