The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Real Streamlines in matlab
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  

Posts: 1
From: Munich
Registered: 2/21/13
Real Streamlines in matlab
Posted: Feb 21, 2013 8:28 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


I'm having problems trying to represent the streamlines of vector field represented by (u,v).

"u" is a function of -y, so u(y)=-y;
"v" is a function of x, so v(x)=x.

If you draw this vector field, you can easily see that the streamlines of the flow field need to be represented by perfect circules. But that doesn't happen when I use streamline in matlab, if you copy my code below, you can see that the streamlines are drawn with imperfect circules. Below you can see the code I've written. It would be really helpful if you could do the correct streamfiled, guys! Thanks!

close all
clear all

L=1; % total lenght of where the vectors are going to be plotted
u =@(y) -y; % function for the horizontal component of the velocity Ksi(u,v)
v =@(x) x; % function for the vertical component of the velocity Ksi(u,v)
n=5; % number of control volumes
x=linspace(L/2*(1/n-1),L/2*(1-1/n),n); %discretization of the control volumes position in x
y=linspace(L/2*(1/n-1),L/2*(1-1/n),n); %discretization of the control volumes position in y

for i=1:n
for j=1:n
U(i,j)=u(y(i)); %Horizontal vetor "u" in the positions of "y"
V(i,j)=v(x(j)); %Vertical vetor "v" in the positions of "x"

quiver(x,y,U,V); %Vector field

%The figure(2) should have given the real streamline,
%but you can see the that the circules
%generated are not perfect.
%And as the vectors (u(y),v(x)) have the same lenght
%in a consant radius, it should have been the case
%that the streamlines representing the flow filed
%needed to be perfect circules!

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.