how to plot 2D Vector field of a 3D ode

1 view (last 30 days)
ahed salman
ahed salman on 8 Dec 2019
Commented: ahed salman on 11 Dec 2019
Hello, I need a help please. Since i have ploted the vector field of my problem in 3D but unfortunetally i can not conclude the vector field around specific points. How can i plot 2D Vector field of a 3D ode?
Here is my code:
clear all; close all; clc
r=2;
b=150;
beta=1;
rho= 1.5;
delta= 0.3;
m= 2;
f=@(t,s)[r*(s(1)+s(2))-1/b*s(1)*(s(1)+s(2))-beta*s(1)*s(3)/(1+beta*s(1))-s(1)*(1+s(3)*s(2))/(1+s(3)) ;
s(1)*(1+s(3)*s(2))/(1+s(3))-1/b*s(2)*(s(1)+s(2))-rho*beta*s(2)*s(3)/(1+beta*s(2));
delta*s(1)*s(3)/(1+beta*s(1))+rho*delta*s(2)*s(3)/(1+beta*s(2))-m*s(3)];
[x1,y1,z1] = meshgrid(-2:2:10,-2:2:10,-2:2:10);
u = zeros(size(x1));
v = zeros(size(y1));
w = zeros(size(z1));
t=1;
for i = 1:numel(x1)
Yprime = f(t,[x1(i); y1(i); z1(i)]);
u(i) = Yprime(1);
v(i) = Yprime(2);
w(i) = Yprime(3);
end
q=quiver3(x1,y1,z1,u,v,w ,2); figure(gcf);

Answers (1)

Star Strider
Star Strider on 8 Dec 2019
The easiest way is to just change the view direction:
figure
q=quiver3(x1,y1,z1,u,v,w ,2); figure(gcf);
view(0, 90)
Make appropriate changes to get the result you want.
  2 Comments
ahed salman
ahed salman on 11 Dec 2019
Thank you very much for answering. but i have tried the way you answered me but it still does not capture the behavior clearly. Your answer give me thispppp.jpg
ahed salman
ahed salman on 11 Dec 2019
and what i need is something like this SharedScreenshot,,,,,,,.jpg

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!