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.

 Réponse acceptée

Cris LaPierre
Cris LaPierre le 2 Avr 2021

0 votes

10 commentaires

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

Connectez-vous pour commenter.

Plus de réponses (1)

Catégories

En savoir plus sur Vector Fields 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