phase portrait mathematical modelling

3 visualizzazioni (ultimi 30 giorni)
Latifah
Latifah il 6 Feb 2023
Commentato: Latifah il 7 Feb 2023
I have problem about mathematical modelling , can you help me fix this script matlab i attach with , didn't run.
this is output i want

Risposta accettata

Sam Chak
Sam Chak il 6 Feb 2023
Modificato: Sam Chak il 7 Feb 2023
I think there is one unreadable non-ANSI character (probably a math operator sign) in the lnear.m file.
I replaced that character with a plus sign. Please check the equations if they are absolutely correct.
Edit: The script is now fixed and Oil Palm tree pattern is basically plotted. However, to add a few arrowheads on the curved trajectories is slightly challenging to me. Try checking out the examples in the FileExchange to see if you can use some arrow functions there:
Some MVP experts in graphics and advanced plotting maybe able to help you.
to = 0;
tf = 30;
tspan = to:0.1:tf;
iv1 = [ 12.3 0.1 0 0.1 0.1 ] ;
[t y] = ode45(@(t, y) lnear(t, y), tspan, iv1);
plot(y(:,1), y(:,5)), hold on
iv2 = [ 12.3 0 0 0 0 ] ;
[t x] = ode45(@(t, x) lnear(t, x), tspan, iv2);
plot(x(:,1), x(:,5)),
iv3 = [ 12.65 0 0 0.1 0.1 ] ;
[t z] = ode45(@(t, z) lnear(t, z), tspan, iv3);
plot(z(:,1), z(:,5)),
iv4 = [ 12.65 0.1 0.1 0 0 ] ;
[t n] = ode45(@(t, n) lnear(t, n), tspan, iv4);
plot(n(:,1), n(:,5)),
iv5 = [ 12.485594 0 0 0 0.12 ] ;
[t w] = ode45(@(t, w) lnear(t, w), tspan, iv5);
plot(w(:,1), w(:,5)),
iv6 = [ 12.3 0.1 0 0.1 0 ] ;
[t v] = ode45(@(t, v) lnear(t, v), tspan, iv6);
plot(v(:,1), v(:,5)),
iv7 = [ 12.4 0.05 0 0.05 0 ] ;
[t s] = ode45(@(t, s) lnear(t, s), tspan, iv7);
plot(s(:,1), s(:,5)),
iv8 = [ 12.65 0.05 0 0.05 0.05 ] ;
[t p] = ode45(@(t, p) lnear(t, p), tspan, iv8);
plot(p(:,1), p(:,5)),
iv9 = [ 12.6 0.05 0 0.05 0 ] ;
[t c] = ode45(@(t, c) lnear(t, c), tspan, iv9);
plot(c(:,1), c(:,5)), grid on
xlabel('y_1'), ylabel('y_5')
function dydt = lnear(t,y)
dydt = zeros(5, 1);
e1 = 13;
g = 0.0125;
h = 0.284253;
f = 0.05;
q1 = 0;
k1 = 10;
d1 = 0.0412;
e2 = 0.0188;
j = 0.0082;
q2 = 0;
k2 = 10;
d2 = 0.0288;
b = 2;
d4 = 0.1152;
e3 = 0.166667;
a = 1.7;
q3 = 0;
k3 = 10;
d3 = 0.1152;
r = 0.5;
m = 1.02;
q4 = 0;
k4 = 10;
dydt(1) = e1 + (g*y(3)*y(1)/(h + y(3))) + (f*y(3)*y(1)) - (y(1)*(1 + ((q1/k1)*y(1)))) - (d1*y(1));
dydt(2) = e2*y(2) + (f*y(1)*y(3)) - (j*y(2)) - (y(2)*(1 + ((q2/k2)*y(2)))) - (d2*y(2));
dydt(3) = (b*e2*y(2)) - (d4*y(3));
dydt(4) = e3*y(4) + (j*y(2)) - (a*y(4)) - (y(4)*(1 + ((q3/k3)*y(4)))) - (d3*y(4));
dydt(5) = (r*y(5)*(1 - (m*y(5)))) + (a*y(4)) - y(5)*(1 + ((q4/k4)*y(5)));
end
  4 Commenti
Sam Chak
Sam Chak il 7 Feb 2023
I have edited to show the Oil Palm pattern trajectories. But I still have some difficulties to add the arrowheads nicely on the curved trajectories. With dynamics on the script is now fixed, you may post a new question on the arrowhead plotting issue. Hope the Graphic Experts can help out.
Latifah
Latifah il 7 Feb 2023
okay thankyou so much . I'm very helped

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by