Writing exponent in pplane for Matlab
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm trying to use the pplane code to generate a phase portrait for
dn/dt=n^(2/3)*(1−n)−en
but the graph will not acknowledge 2/3 as a full exponent.I keep getting things that look like this when I type n^(2/3):
Or when I type n^2/3 it'll make a graph using (n^2)/3.
How can I fix this? Or rewrite the equation in pplane to graph the correct form of the equation?
Thank you
0 commentaires
Réponses (1)
John D'Errico
le 8 Nov 2021
Modifié(e) : John D'Errico
le 9 Nov 2021
pplane is not part of MATLAB, so it must be a package from the file exchange, or some other source. You might want to contact the author with questions.
You raise a number to a fractional power like this:
n^(2/3)
Why? Exponentiation has a higher order of precedence than division. So when you wrote n^2/3, MATLAB sees n^2, and recgnizes that exponentation comes first in the list. So it squares n, and THEN divides the result by 3.
Since you want MATLAB to raise it to the (2/3) power, just use parens as I show.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
