2D streamline
I am trying to draw 2D streamline from a vector field with matlab software, but I got spiral shape, which is not right. Is there any way to avoid that.
a=3; n=30; xt = linspace(a, a, n); yt = linspace(a, a, n); [x,y] = meshgrid(xt, yt); quiver(x,y,y,x,5) axis image hold h=streamline(stream2(x,y,y,x,2,0)); set(h, 'Color', 'red'); hold 
Re: 2D streamline
I run your code and I think every think is OK.
The stream lines seems to be tangent to the vector field. Why do you say that the spiral shape is wrong? 
Re: 2D streamline
What I expect was a closed circle.

Re: 2D streamline
Right. Stream lines cannot spiral in 2D unless there is a source or sink. They must close on themselves, or begin and end on a boundary. In this case they must be circles.

I got it
I got it by using stream function

All times are GMT 4. The time now is 00:51. 