Plotting 3D graph with ODEs
Afficher commentaires plus anciens
Hello there, I am looking for a possible way to plot 3D surface/graphs/plot from the data set I get from a system of ODEs that I created and solved using ode45, but I am unsure of how to get it.
Lets say I have the function files of the system of ODEs,and each time I run, I manipulate the parameters one by one to see their effect on the ans I get. For eg, I started off with the parameter A=0, and B = 3, which allows me to get population(t). Then I changed one of the parameter each time, A = 0, 20, 40, 60, 80 100 respectively. For each value of A, I also changed the B= 3, 6, 9, 12. respectively. Isit possible for me to plot a combined 3D plot of A, B and the population(t) and is there a better way/less tedious way to program this? If so, what is the suggested steps that I should take or do?
Thanks in advance!
Réponses (1)
J. Alex Lee
le 21 Août 2020
0 votes
If your ODE result "population(t)" a scalar value, then yes, you can use surf() if your [A,B] is defined using meshgrid.
5 commentaires
Clement Koh
le 21 Août 2020
J. Alex Lee
le 21 Août 2020
[A,B] = meshgrid((0:20:100),(3:3:12))
PT = nan(size(A)); % preallocate
for k = 1:numel(A)
PT(k) = % whatever number to extract from your ODE solution
end
Does it help?
If you are saying "population(t)" is actually a list of values, not just a number, then you should think harder about what it means to draw the plot you are thinking of.
Clement Koh
le 21 Août 2020
Modifié(e) : Clement Koh
le 21 Août 2020
J. Alex Lee
le 21 Août 2020
In a 3D plot, you have available 3 coordinates, x,y,z. You are using up (x,y) with your A and B values. You can represent a "point" at that (x,y) with another single value z. How do you expect a plot to look if you want multiple values of z stacked onto each other at that single (x,y)? Even if you did do that, how would you interpret the interrelation among those multiple stacked points (their relation in time, e.g.)?
Clement Koh
le 21 Août 2020
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!