How do you plot arrows in the streamline function ?

26 次查看(过去 30 天)
I want get arrows in this streamlines, but I can't use the streamSLICE function because I have only 2d variables, e.g.: only U and V, X and Y. What I have to do ?
I've tried all the possibilities, could you helpe me ? The variables are in the attach file!!
*>> streamline(lon,lat,uwnd,vwnd, startx,starty);*
Error using griddedInterpolant Interpolation requires at least two sample points in each dimension.
Error in interp1 (line 183) F = griddedInterpolant(X,V,method);
Error in stream2 (line 62) sxi=interp1(xx(:),1:szu(2),sx(k));
Error in streamline (line 62) verts = stream2(x,y,u,v,sx,sy,options);
*>> streamslice(lon, lat, uwnd,vwnd, startx,starty,'arrowsmode')*
Error using streamslice (line 137) U,V,W must all be a 3D arrays.
*>> streamslice(lon, lat, uwnd,vwnd,'arrowsmode')*
Error using griddedInterpolant Interpolation requires at least two sample points in each dimension.
Error in interp1 (line 183) F = griddedInterpolant(X,V,method);
Error in stream2 (line 62) sxi=interp1(xx(:),1:szu(2),sx(k));
Error in streamslice>nicestreams (line 297) vertsf = stream2(x,y, u, v,xstart,ystart,streamoptions);
Error in streamslice (line 133) [vertsout, avertsout] = nicestreams(x,y,u,v,density,arrows);
  3 个评论
Star Strider
Star Strider 2014-10-26
The variables.mat file will help. If it does not contain ‘stream2.m’, it would also help if you uploaded and attached your ‘stream2.m’ file. It will tell us what you are doing and will put the errors into context.

请先登录,再进行评论。

回答(1 个)

Chad Greene
Chad Greene 2014-10-29
If the problem is that streamslice wants data in 3D and you only have 2D data, why not make up some fake z data?
z = ones(size(lon));
w = zeros(size(z);
Or, a couple of submissions on FEX might be close to what you're looking for. StreakArrow and Curvvec, for example?

类别

Help CenterFile Exchange 中查找有关 Vector Fields 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by