I am a beginner to using MATLAB, and I need a lot of help to understand what to do here.
I would like to plot multiple curves using different initial conditions to my system of ODEs.
Here is my code:
f = @(t,x) [-1*x(1)-x(3)*x(3);2*x(2);x(3)-x(2)*x(2)];
[t,xa] = ode45(f,[0 5],[-1 0 0]);
plot3(xa(:,1),xa(:,2),xa(:,3));
grid on
title('Solution curve')
Does anybody know how I could do this?
It would make plotting phase planes a lot easier.
As far as I've understood, you have problems with plotting multiple trajectories. Here is your modified code for the case of two trajectories:
However, it's better to use loops when you have many trajectories.