How to create quiver3 for ODE45
Mostrar comentarios más antiguos
Hi, I'm new in Matlab.
I'm trying to create quiver3 for ODE45 (for phase trajectories in the space xyz, I hope I'm using the right function for this), when I runing the code I don't get the arrows in the plot.
this is my code:
f = @(t,x) [1*x(1)+x(2)-x(1)*x(3);-x(1);-0.1*x(3)+(x(1)^2);];
x0 = [0;2;3];
dt= 0.001;
tspan= dt:dt:50;
[t,x] = ode45(f,tspan,x0);
u = gradient(x(:,1));
v = gradient(x(:,2));
w = gradient(x(:,3));
quiver3(x(:,1),x(:,2),x(:,3),u,v,w)
grid on
title('Phase trajectory')
xlabel('x'), ylabel('y'), zlabel('z')
And this is the plot I got:

I would appreciate any help.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Numerical Integration and Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!