Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Felipe
Posts:
1
From:
Munich
Registered:
2/21/13


Real Streamlines in matlab
Posted:
Feb 21, 2013 8:28 PM


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/n1),L/2*(11/n),n); %discretization of the control volumes position in x y=linspace(L/2*(1/n1),L/2*(11/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!



