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

Answers (0)

Categories

Asked:

on 19 May 2013

Community Treasure Hunt

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

Start Hunting!