Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

Topic: Real Streamlines in matlab
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Felipe

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

Hello,

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
clc

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"
end
end

figure(1)
quiver(x,y,U,V); %Vector field
figure(2)
streamslice(x,y,U,V);

%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]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.