contour of streamfunction for fluid flow

Hi all! I am a bit new to matlab; I am trying to plot contour of streamfunction and tried following steps:
1. first created a m-function as follows:
function [ psi ] = flowfun( u,v )
for i=2:n-1;j=2:m-1;
u(i,j)=-(psi(i,j+1)-psi(i,j-1))/(2*dy);
v(i,j)=(psi(i+1,j)-psi(i-1,j))/(2*dx);
end
end
2. tried plotting the streamlines using contour as follows:
z = psi(1:n,1:m);
x = linspace(0,1,size(z,2));
y = linspace(0,1,size(z,1));
contour(x,y,z,20);
but did not get any contour.. just wanted to know whether I am doing it correctly. if not, what will be the best way to plot streamlines of fluid flow.
any comments will be of great help. thank you

답변 (0개)

카테고리

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

질문:

2013년 5월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by