필터 지우기
필터 지우기

Error when using streamline() function

조회 수: 6 (최근 30일)
Aaron
Aaron 2013년 11월 27일
답변: Mohan Mond 2019년 11월 11일
Hello,
I would like to produce a streamline plot of some data I have generated with another program. The data are of u-velocities(stream wise) and v-velocities (span wise) generated by a navier stokes solver on a 2-d mesh using Finite Volume Method.
I can get the streamline function to work with data that was generated on a square mesh with uniform cell spacing. However, when I try to use the streamline function with data that was generated on a non-square mesh with non-uniform spacing I get this error:
>> streamline(coordsx,coordsy,u(:,:,11),v(:,:,11),0.5,0.5) Error using griddedInterpolant Interpolation requires at least two sample points in each dimension.
Error in interp1 (line 191) F = griddedInterpolant(X,V,method);
Error in stream2 (line 63) sxi=interp1(xx(:),1:szu(2),sx(k));
Error in streamline (line 63) verts = stream2(x,y,u,v,sx,sy,options);
Here is what the actual data looks like on the non-square mesh using surf plot
I don't understand what this error means because when I use the function on a square, uniform mesh, it works fine.
Please note that the size of coordsx, coordsy, u(:,:,11), v(:,:,11) are 201x51 (i.e. the size of the mesh shown in the pictures).
Can anyone help me figure out why streamline is producing this error when I use perfectly good data?
Thank you.

답변 (3개)

Kasper van der Vaart
Kasper van der Vaart 2017년 2월 10일
편집: Kasper van der Vaart 2017년 2월 10일
I also stumbled upon this error. It turns out that going from: streamline(x,y,u,v,startx,starty)
to
streamline(x',y',u',v',startx,starty)
did the trick for me. Interestingly enough quiver does not seem to have a problem with this.
  댓글 수: 1
Andrew Winter
Andrew Winter 2018년 5월 18일
Thank you so much for coming back to post your solution! I was having the same problem and this saved me so much trouble. Thanks again!
Best regards, Andrew

댓글을 달려면 로그인하십시오.


Kalpit Bakal
Kalpit Bakal 2019년 2월 7일
편집: Kalpit Bakal 2019년 2월 7일
I am still facing the same problem even after doing what Kasper suggested. Can somebody help me with this.

Mohan Mond
Mohan Mond 2019년 11월 11일
Thx!!
This issue exists still in R2019b for streamslices.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by