PPLVM because because innit niit

I have been struggling to find simpler examples to put into matlab. I want to make athat looks like this: /D and y=A/B
i know there is an ode method and Euler's
any method will do aslong as its broken down please
:D

1 comentario

Star Strider
Star Strider el 21 de Abr. de 2016
All you need to do is to put my code into a for loop, changing the values of the coefficients each time to get the results you want. I would store the output in a cell array if you want to use them later in your code.
For the plot, use the hold function to plot all the phase plots on one axis, if that is what you want to do.

Iniciar sesión para comentar.

Respuestas (2)

Image Analyst
Image Analyst el 20 de Abr. de 2016

0 votos

On the right side of this page I see references to File Exchange submissions. Did you look at those?
Star Strider
Star Strider el 21 de Abr. de 2016
Try this:
% dx/dt = Ax - Bxy
% dy/dt = -Cy + Dxy.
A = 4;
B = 1;
C = 4;
D = 1;
% MAPPING: x = xy(1), y = xy(2)
LV_Eqns = @(t,xy, A,B,C,D) [A.*xy(1) - B.*xy(1).*xy(2); -C.*xy(2) + D.*xy(1).*xy(2)];
tspan = linspace(0, 2);
[T,XY] = ode45(@(t,xy) LV_Eqns(t,xy, A,B,C,D), tspan, [1 1]);
figure(1)
plot(T, XY)
grid
legend('Prey', 'Predator')
title('Time Domain Plot')
figure(2)
plot(XY(:,1), XY(:,2))
grid
axis equal
title('Phase Plane Plot')
xlabel('X')
ylabel('Y')
You may need a loop for different values of ‘A’ and ‘C’. This code works for one set of constants, so I leave it to you to write the code for the rest of the constants. You may need a cell array to efficiently store the output of the ode45 call, since that would probably be easier than storing them in a numeric array. I will also leave the other plots to you.

1 comentario

Image Analyst
Image Analyst el 21 de Abr. de 2016
Star doesn't have the Crystal Ball Toolbox (yet), so you're going to have to show the loop you've created. Also explain in detail what "doesnt seem to work" means to you.

Iniciar sesión para comentar.

Preguntada:

el 20 de Abr. de 2016

Comentada:

el 21 de Abr. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by