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

Walter Roberson
Walter Roberson el 17 de Dic. de 2022

1 voto

The gradient components are much smaller than the coordinates.
You are using a small step size, and the function just isn't very steep compared to the step size

1 comentario

linoy Ban David
linoy Ban David el 17 de Dic. de 2022
Hi Walter,
I changed the values in 'tspan', thank you so much(:

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Numerical Integration and Differential Equations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 17 de Dic. de 2022

Comentada:

el 17 de Dic. de 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by