How to plot a vector field with coloured arrows?

조회 수: 34 (최근 30일)
Mohit Kumar
Mohit Kumar 2020년 9월 12일
댓글: Mohit Kumar 2020년 9월 15일
I'm trying to create a vector field where the colour of the vector represents its magnitude like the one shown in the picture. Any ideas on how to do this?
I am currently using an inefficient method plotting each vector separately using two for loops.
Thanks,
Mohit
  댓글 수: 2
Adam Danz
Adam Danz 2020년 9월 12일
You forgot to attach the image.
quiver() plots a vector view with arrows but the length of the arrows represnts the magnitude. Is your goal to represent the magnitude by arrow length and color or is your goal to use the a uniform arrow length and varied color?
Mohit Kumar
Mohit Kumar 2020년 9월 15일
Ideally I wanted to plot vectors with same length and different colours based on magnitude. This was to prevent small arrows from becoming too small.
But the package I've mentioned in the comment to the answer accepted below represents the vectors' magnitude using length and colour while maintaining a good visual representation. So that's solved for now!

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

채택된 답변

KSSV
KSSV 2020년 9월 12일
  댓글 수: 1
Mohit Kumar
Mohit Kumar 2020년 9월 15일
Thanks for the answer. The package below had what I was looking for.
For some reason, I was not able to get the above ones working as I wanted them to. Thanks for pointing me in the right direction!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by