How to plot a vector field with coloured arrows?

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 个评论

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?
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!

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File 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