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.

 채택된 답변

Cris LaPierre
Cris LaPierre 2021년 4월 2일

0 개 추천

댓글 수: 10

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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

vishal
vishal 2025년 4월 15일

0 개 추천

U=Kx V=-Ky

카테고리

도움말 센터File Exchange에서 Vector Fields에 대해 자세히 알아보기

질문:

2021년 4월 1일

댓글:

2025년 4월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by