MATLAB: Plot of ODE Model

differential equationsmodelodeplotsystem

Hello, I am trying to create the plot of this model (ODE Model):
With these parameters: r=0.8, ro=0.1, K=2e11, beta=0.0014, gamma=300, a=0.0693, mu=0.693
we have:
diff(x) == (0.8*x + delta*y)*(1 – ((x + y)/(2e11))) – ((0.0014*v*x)/(x + y));
diff(y) == 0.1*y*(1 – ((x + y)/(2e11))) + (0.0014*v*x)/(x + y) – 0.0693*y;
diff(v) == 300*y – 0.693*v;
.
The plot should be like this:
I use MATLAB R2010a. Can anybody help me to create this plot of my ODE Model?
Thank you very much for the help, best regards.

Best Answer

There were a few problems.
  1. You need non-zero initial conditions. Changing them from zero to eps will give you meaningful output,
  2. The default interval value for the colon operator is 1, so when ‘delta’ incremented after the first loop, it was satisfied because 1>0.05; changing the increment corrected this,
  3. I changed your title call to use sprintf because the matrix concatenation did not work
This runs:
g = @(t,x,delta)[(0.8*x(1) + delta*x(2))*(1 - ((x(1) + x(2))/(2e11))) - ((0.0014*x(3)*x(1))/(x(1) + x(2)));
0.1*x(2)*(1 - ((x(1) + x(2))/(2e11))) + (0.0014*x(3)*x(1))/(x(1) + x(2)) - 0.0693*x(2);
300*x(2) - 0.693*x(3)];
for delta = 0 : 0.01 : 0.05
[t,xa] = ode45(@(t,x) g(t,x,delta),[0 2],[1 1 1]*eps);
figure
plot(t, xa(:,2))
title(sprintf('y(t) for delta = %.2f', delta))
end
You need to determine if it gives you the correct answers.
Related Question