-
Notifications
You must be signed in to change notification settings - Fork 1
/
VolumeIntersectionSimulationRun.m
36 lines (30 loc) · 1.48 KB
/
VolumeIntersectionSimulationRun.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
%% Name: Volume Intersection Simulation Run
% Description: runs volume intersection simulations for a range of initial
% bend velocities, a range of times remaining, and single
% propulsive velocity
% Author: Kiran Bhattacharyya ([email protected])
%%
clear
addpath('data/', 'functions/');
%% generate parameters for simulation
nSim = 5; % number of initial bend velocities to simulate
load('InitialBendVelocities.mat') % load in measured initial bend velocties in deg/ms
initBendVelo = datasample(initBendVelocities, nSim, 'Replace', true); % sample measured velocities
% with replacement
load('avgPropVelocities.mat') % load propulsive velocities during escape
propVelocity = mean(avgPropVelocities); % mean propulsive velcity in mm/ms
timeRemain = [7, 15, 20, 25, 35, 50]; % times remaining at escape to simulate fish motor volume
for ii = 1:nSim
disp(['SIMULATING ANGULAR VELOCITY ' num2str(ii) ' OF ' num2str(nSim) '.'])
[attackAzim, attackElev, intersectionProps] = VolumeIntersectionFunction(initBendVelo(ii), propVelocity, timeRemain, 0);
intersectionMeans(ii,:) = 1 - mean(intersectionProps);
end
%% plot results
figure
errorbar(timeRemain, mean(intersectionMeans), std(intersectionMeans), 'o-')
axis([0 60 0 1])
pbaspect([1 1 1])
xticks(0:10:60)
xlabel('Time remaining (ms)')
ylabel('Not-engulfed proportion')
title('Volume intersection')