Dustinsfl
- 2,217
- 5
How can I plot the different phase planes for a system of ODEs in Mathematica?
Last edited:
dwsmith said:I am pretty sure this works:
Show[StreamPlot[{(1 - x - 2 y), (1 - 2 x)}, {x, 0, 2}, {y, 0, 2},
Axes -> True]]
How can I plot the null clines simultaneously?
For the above phase plane, I used the case $a_{12},a_{21}>1$
Ackbach said:Any time you want to plot multiple plots simultaneously, you can assign a Plot command to a variable like this:
PlotOne = Plot[x^2,{x,-2,2}]
PlotTwo = Plot[Sin[x],{x,-Pi,Pi}]
Then you show them simultaneously by doing
Show[PlotOne, PlotTwo]
So, if you can plot everything you need separately, this is a way to combine it all.
dwsmith said:Plotting the nullclines for these plots don't work the same since I have y and x terms. Do you know how to overcome that?
Ackbach said:It doesn't matter how you generate a plot, you can still assign it to a variable like PlotOne, PlotTwo. You could say
PlotThree = ImplicitPlot[...]
or
PlotFour = ContourGraphics[...]
etc.
Let's back up a bit and ask this question: is your problem the problem of showing multiple plots simultaneously, or is the problem plotting one thing in the first place?
Ackbach said:Ah. So, is your system in Post # 2 correct? I'm a bit confused, since the subscripts appear to be the same everywhere. Should it be, rather,
\begin{align*}
\frac{du_1}{d\tau} & = u_1\left(1 - u_1 - a_{12}u_2\right)\\
\frac{du_2}{d\tau} & = \rho u_1\left(1 - a_{21}u_1\right)?
\end{align*}
dwsmith said:the second one should be rho u_2
Ackbach said:And what are $\rho, a_{21}$, and $a_{12}$?
Ackbach said:Well, ok, but you're going to have to have actual values in order to plot anything in Mathematica. Perhaps, if you're allowed to pick values, you could show me what commands you've used so far. The way I see it, you've got the two axes, and two other straight lines.
dwsmith said:For all my cases, I just used 2 and 1/2
Here are my phase planes and one null cline since I can't get mathematica to graph a vertical lineAckbach said:So, using those values, what commands have you used so far?
PlotOne = StreamPlot[{x(1-x-2y),y(1-2x)},{x,0,2},{y,0,2}];
PlotTwo = Plot[{(1-x)/2,{x,0,2}];
<< Graphics`ImplicitPlot`
PlotThree = ImplicitPlot[x==1,{x,0,2},{y,0,2}];
Show[PlotOne,PlotTwo,PlotThree]
Ackbach said:Try this sort of thing:
Code:PlotOne = StreamPlot[{x(1-x-2y),y(1-2x)},{x,0,2},{y,0,2}]; PlotTwo = Plot[{(1-x)/2,{x,0,2}]; << Graphics`ImplicitPlot` PlotThree = ImplicitPlot[x==1,{x,0,2},{y,0,2}]; Show[PlotOne,PlotTwo,PlotThree]
My PlotThree line probably does not have the right equation in there. You might need x == 0, or whatever. Does this solve your problem?
dwsmith said:Was the phase plan and null clines correct for that system of DEs?
That worked too thanks.
Those lines are plotted already plotted. You sent the syntax to include them all prior.Ackbach said:Have you been able to plot the three points described in Post # 18? Those ARE the null clines. If you're supposed to plot the null clines simultaneously with the stream plot, then you need to figure out how to plot individual points clearly (marked with an "x" or something).
dwsmith said:Those lines are plotted already plotted. You sent the syntax to include them all prior.