Plot a vector field from a matrix

조회 수: 19(최근 30일)
Samuel Curé
Samuel Curé 2020년 12월 15일
답변: Asad (Mehrzad) Khoddam 2020년 12월 15일
I would like to plot a field of unit vectors on a square lattice Λ of size .
Each point of the lattice is a unit vector pointing in some angle: where θ is a matrix whose entries are between 0 and .
Here is my attempt:
theta=2*pi*rand(N,N) % random for this example only
However this is not very esthetic, how could I make this vector field more readable?
(Even when I choose a configuration where all spins are aligned, it is still not readable)
Perhaps spacing the arrows and making them bigger with a longer shaft could make it more readable? I am quite new on MATLAB and I have no idea how to change this. Plotting this from my matrix theta felt already like an accomplishement.
Thank you for your help and your time.

채택된 답변

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020년 12월 15일
You can use a scale like this:
theta=2*pi*rand(N,N); % random for this example only

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by