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.

 Réponse acceptée

Walter Roberson
Walter Roberson le 17 Déc 2022

1 vote

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 commentaire

linoy Ban David
linoy Ban David le 17 Déc 2022
Hi Walter,
I changed the values in 'tspan', thank you so much(:

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Numerical Integration and 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!

Translated by