Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

contour of streamfunction for fluid flow

Asked by Ignatius Fernandes on 19 May 2013

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 Comments

Ignatius Fernandes

Products

No products are associated with this question.

0 Answers

Contact us