필터 지우기
필터 지우기

better visualization of quiver()

조회 수: 69 (최근 30일)
Ivan Volodin
Ivan Volodin 2017년 5월 28일
댓글: Jacob Ivanov 2023년 5월 20일
Hello!
I have some velocity-field, which I am trying to visualize by this code:
quiver(x,y,Vx,Vy);
Vx and Vy are arrays of 102x102 demensions. It all worked, but I get this:
If maximaze it by 8 and zoom to right up corner then the field seems to be possible to analyze:
So, how to spread evenly it all on coordinate plane, how to make arrays less and increase distance between them in order to achieve better understanding of the whole picture at once?
Thank you in advance!

채택된 답변

Star Strider
Star Strider 2017년 5월 28일
Without knowing more about what you are doing, one option would be:
quiver(x(1:5:end), yx(1:5:end), Vxx(1:5:end), Vyx(1:5:end), 0)
This plots fewer points (and arrows), and the ‘0’ turns off all arrow scaling. Delete the ‘0’ and replace with another number to keep the scaling and set the arrow length.
  댓글 수: 3
Star Strider
Star Strider 2017년 5월 28일
My pleasure!
One option is to increase the step size from 5 to a larger value:
sv = 10; % ‘Step’ Value
quiver(x(1:sv:end), yx(1:sv:end), Vxx(1:sv:end), Vyx(1:sv:end), 0)
Another way would be to set the scaling factor (that you have already done), turn autoscaling off, and several other options.
See Quiver Properties (link) for a list of everything about the arrows you can customise.
A third option would be to add a contour plot, so you could present the same information and require fewer arrows. See the documentation on Combine Contour Plot and Quiver Plot (link).
Jacob Ivanov
Jacob Ivanov 2023년 5월 20일
If you, like I was sitting here wondering why this wasn't working, and you got an error similar to
Error using quiver. The size of X must match the size of U or the number of columns of U.
Make sure that if you are using an x, y array that are one-dimensional, whereas u, v are two-dimensional arrays, you do something similar to this:
quiver(x(1:16:end), y(1:16:end), u(1:16:end, 1:16:end), v(1:16:end, 1:16:end))

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

추가 답변 (0개)

카테고리

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