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

Star Strider
Star Strider 2016년 4월 21일
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.

댓글을 달려면 로그인하십시오.

답변 (2개)

Image Analyst
Image Analyst 2016년 4월 20일

0 개 추천

On the right side of this page I see references to File Exchange submissions. Did you look at those?
Star Strider
Star Strider 2016년 4월 21일

0 개 추천

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

Image Analyst
Image Analyst 2016년 4월 21일
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.

댓글을 달려면 로그인하십시오.

카테고리

질문:

2016년 4월 20일

댓글:

2016년 4월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by