How can I plot Streamline from a stream function?

Hello,
I have a stream function psi = 1.2X^2 + y^2. I have to plot streamline. How can I plot it by using MATLAB?
Thank you.

 Akzeptierte Antwort

Cris LaPierre
Cris LaPierre am 2 Apr. 2021

0 Stimmen

10 Kommentare

Thank you for your reply. I have tried it but it is not working for the above function. :(
We could probably be of more help if you showed us what you have tried. At a minimum, copy.paste the code as well as any error message it is creating (all the red text).
[x,y] = meshgrid(-3:.5:3,-3:.5:3);
u = 2*y;
v = -2.4*x;
figure
quiver(x,y,u,v)
startx = -3:0.5:3;
starty = ones(size(startx));
streamline(x,y,u,v,startx,starty)
[x,y] = meshgrid(-3:.5:3,-3:.5:3);
u = x;
v = -y;
figure
quiver(x,y,u,v)
startx = -3:0.5:3;
starty = ones(size(startx));
streamline(x,y,u,v,startx,starty)
Looks like you got it working. Do you still have a question?
How can I remove vector field from this plot? Want to plot only streamline.
Don't include the code that creates them (quiver)
[x,y] = meshgrid(-3:.5:3,-3:.5:3);
u = x;
v = -y;
figure
startx = -3:0.5:3;
starty = ones(size(startx));
streamline(x,y,u,v,startx,starty)
Thank you

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Kategorien

Mehr zu Vector Fields finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by