Put arrows on a continuous line plot to show direction of evolution

91 ビュー (過去 30 日間)
Roderick
Roderick 2021 年 7 月 22 日
編集済み: KSSV 2021 年 7 月 23 日
Hello everybody
What I am trying to do is yo show, through, for example, the quiver function, the direction of evolution of my data points. My data point is given in the following file, "Quiver_Data.txt". Since I would like the arrowhead to appear every certain number of elements in the arrays due to the density of points, I have tried this approach in line with what is exposed in this post: Is it possible to connect points on a scatter plot with arrows instead of a line?
array=load('C:\...\Quiver_Data.txt');
dx=diff(array(:,1));
dy=diff(array(:,2));
u1=figure(1)
plot(array(:,1),array(:,2).*((10^(-12))),'-b','LineWidth',2)
hold on
quiver(array(1:100:end-1,1),array(1:100:end-1,2),dx(1:100:end),dy(1:100:end),0)
However, the result is far from being the desired one, as you can see when plotting that.
Any ideas?

回答 (1 件)

KSSV
KSSV 2021 年 7 月 22 日
編集済み: KSSV 2021 年 7 月 23 日
Try this:
data = importdata('Quiver_Data.txt') ;
x = data(:,1) ;
y = data(:,2) ;
dx = gradient(x) ;
dy = gradient(y) ;
quiver(x,y,dx,dy,10^-11)

カテゴリ

Help Center および File ExchangeVector Fields についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by