Im trying to model prey/predator population dynamics with a range of parameters.
I have 3 scripts
(1) script with my parameters named 'preypredator_Parameters'
p.r = 0.1 ;
p.a = 0.01 ;
p.c = 0.9 ;
p.m = 0.03 ;
p.tSpan = [0 1000];
(2) script with my function named 'preypredator_ODE'
function dNdt = preypredator_ODE(t, N)
prey = N(1) ;
pred = N(2) ;
dNdt = [p.r * prey - p.a * prey * pred ; ...
p.c * p.a * prey * pred - p.m * pred] ;
(3) driver to run my ODE named 'preypredator_ODEdriver'
N0 = [10 10] ;
[t, N] = ode23s(@preypredator_ODE, p.tSpan, N0);
I would like to run the ODE with two of my parameters lets say p.m being a vector with a range of values (p.m = [0.03 0.05 0.07 0.09]) and p.r being a vector (p.r = [0.01 0.02 0.03 0.04]). As a final result I would like to produce 4 population dynamics graphs each using a different value of p.m and p.r while my other parameters stay constant, for example my first graph would use p.r(1) = 0.1, p.a = 0.01, p.c = 0.9, p.m(1) = 0.03, p.tSpan = [0 1000]; my second graph would use p.r(2) = 0.2, p.a = 0.01, p.c = 0.9, p.m(2) = 0.05, p.tSpan = [0 1000].
I know that if I was to just change the parameters to vectors there would be a 'Error using vertcat Dimensions of arrays being concatenated are not consistent.'. Im also not sure how to even produce the 4 graphs afterwards either.
In reality I have a lot more p.m and p.r values, so writing each value as a seperate parameter and creating a new ODEs each with a different set of parameters isnt too ideal.
Ive looked at several other discussions that appear to ask and answer a similar question to mine, however with my lack of experience with matlab, I cant seem to implement their sollutions to my situation.
Thanks in advance for any sort of help.