Hi
Can sb help me please?
I should draw 3D-Plot for a first order differential system, but I could find just one example which was very complicated for me to learn!
a=1; b=2; c=a*(b^2-1/(b^2));
f = @(t,x)[x(2)*x(3)-a*x(1)
x(1)*(x(3)-c)-a*x(2)
1-x(1)*x(2)];
t=linspace(0,50);
[t,x]=ode45(f,t,[1 0 1]);
now I should draw the 3D trajectory (x1-x2-x3 diagram) and also indicate them in the course of time !
can someone help with it?
Thank you very much in advance

4 comentarios

madhan ravi
madhan ravi el 6 de Abr. de 2019
In 3D plane what does x1 ,x2, x3 & t what do they represent? Only three variables can be represented in x,y & z plane.
Saeed Ahmadzadeh
Saeed Ahmadzadeh el 7 de Abr. de 2019
Yes, you are right.
I put the parameter time aside, and want to draw just x1 and x2 and x3 in a 3D space.
But what is the code/command to draw x1-x2-x3 in a differential system?
madhan ravi
madhan ravi el 7 de Abr. de 2019
simply use plot3()
Saeed Ahmadzadeh
Saeed Ahmadzadeh el 7 de Abr. de 2019
Thanks a lot

Iniciar sesión para comentar.

 Respuesta aceptada

Star Strider
Star Strider el 6 de Abr. de 2019

1 voto

In our universe, there are three large dimensions (although string theory posits 11 in all). That means that you can only plot three spatial coordinates, and if you want to plot time as well, the only way is to add colour to the various regions.
This slight variation on your code does that:
a=1; b=2; c=a*(b^2-1/(b^2));
f = @(t,x)[x(2)*x(3)-a*x(1)
x(1)*(x(3)-c)-a*x(2)
1-x(1)*x(2)];
t=linspace(0,50,1000);
[t,x]=ode45(f,t,[1 0 1]);
cm = jet(numel(t));
figure
hold all
for k = 1:size(x,1)-1
hl = plot3([x(k,1),x(k+1,1)], [x(k,2),x(k+1,2)], [x(k,3),x(k+1,3)]);
set(hl, 'LineStyle','-.', 'Color',cm(k,:));
end
hold off
grid on
view(50, 30)
The jet (link) colormap (link) (that some object to using) colours the times here from earliest (blue) to latest (red). You can use any map (link) you want. Substitute that name into the ‘cm’ assignment to change it. I am not aware of any other way to depict time in a 3D plot that does not include time as an independent variable on one of the axes.

3 comentarios

Saeed Ahmadzadeh
Saeed Ahmadzadeh el 7 de Abr. de 2019
oh thank you very much!
Now I can analyse and change the commands step by step to see what happens and learn it.
Thank you a lot again
darova
darova el 7 de Abr. de 2019
accept the answer then
Star Strider
Star Strider el 7 de Abr. de 2019
@Saeed Ahmadzadeh — As always, my pleasure!
@darova — Thank you!

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 6 de Abr. de 2019

Comentada:

el 7 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by