-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfishingfreewebdriverExample.m
88 lines (72 loc) · 2.3 KB
/
fishingfreewebdriverExample.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
%% fishingfreewebdriverLocal.m
%% Author --------------------------------------------------------------
% name: Valentin Cocco
% mail: [email protected]
% creation: 4-2-2018
%% Description ---------------------------------------------------------
% Using the 1100-foodweb-structure stock, run simulations for 4000 timesteps without fishing effort locally.
% This serves as an example of the ecological dynamics of the aquatic
% networks without fishing.
% Calls:
% - webproperties.m
% - setup_default.m
% - differential.m
%% Updates -----------------------------------------------------------------
% when: 8-14-2019
% who: Paul Glaum ([email protected])
% what: used to run simulations without fishing effort for 500 different foodweb structures.
%% 1. UPLOADING OF THE NETWORK STRUCTURES
%Change to Data folder to load the Food-Web networks 'Webs1100.mat' file
cd('Data')
load('Webs1100.mat')
cd('..')
nSim=1; %number of simulations
spe=30; %number of species
t1=4000; %last timestep
tspan=0:t1;
k=randi(500);
sprintf('Simulation %d/%d',k,nSim)
web=webs{k,1};
fish=webs{k,2};
B0=webs{k,3};
%% 2. CALCULATION OF THE INITIAL STRUCTURAL PROPERTIES
[tmp, T]=webproperties(web);
Fish=nnz(fish)/spe;
properties=[tmp,Fish];
%% 3. SET THE BIOLOGICAL PARAMETERS
[r,K,y,e,Bs,c,h,ax_ar,Z,po,Bext]=setup_default(web,fish);
x=ax_ar.*(Z.^(-po.*(T-1)));
%% 4. ECONOMIC PARAMETERS
mu=0;
co=1;
ca=0.01;
a=1;
b=0;
price='linear';
%% 5. ATN MODEL
E0=[];
harv=false(spe,1);
X0=[B0,E0];
options=odeset('RelTol',10^-8,'AbsTol',10^-8);
[t,X] = ode45(@(t,X) differential(t,X,x,y,r,K,e,h,c,Bs,web,harv,mu,co,ca,a,b,price,Bext),tspan,X0,options);
B=X(:,1:spe);
E=X(:,spe+1:end);
B(B<Bext)=0;
E(E<0)=0;
X=[B,E];
%% 6. Plot Results
figure
set(gcf,'color','w');
%Time series of all trophic species
subplot(2,2,1)
plot(X(:,:));
%Time series of all trophic species that survive to end of simulation
subplot(2,2,2)
plot(X(:,~ext));
%Time series of harvested species, empty in this fishing free initial
%simulation
subplot(2,2,3)
plot(X(:,harv))
%Time series of all labeled fish species
subplot(2,2,4)
plot(X(:,fish))