Quiver plot - vector direction
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
I am trying to plot quiver plot of 2d data and the generated quiver plot is not pointing in the direction of second dataset (x2,y2) from first dataset (x1,y1). Please let me the error I am committing in displaying the plot.
Thanks,
Vignesh
x1 = [5 5.5 6 6.5 7 7 7 6.5 6 5.5 5 5 5 ];
y1= [5 5 5 5 5 5.5 6 6 6 6 6 5.5 5];
plot (x1,y1)
hold on
xlim([-20 20])
ylim([-20 20])
x2 = [4.19 5.26 6.00 6.74 7.81 7.96 7.81 6.74 6.00 5.26 4.19 4.04 4.19];
y2 = [4.19 4.05 4.08 4.05 4.19 5.50 6.81 6.95 6.92 6.95 6.81 5.50 4.19];
plot(x2,y2)
hold on
quiver(x1,y1,x2,y2)
댓글 수: 0
채택된 답변
Cris LaPierre
2024년 2월 5일
Your U and V values are all positive, so all quivers will point up and to the right.
I think you want U and V to be the difference between 2 and 1, and not the location of 2.
x1 = [5 5.5 6 6.5 7 7 7 6.5 6 5.5 5 5 5 ];
y1= [5 5 5 5 5 5.5 6 6 6 6 6 5.5 5];
plot (x1,y1)
hold on
x2 = [4.19 5.26 6.00 6.74 7.81 7.96 7.81 6.74 6.00 5.26 4.19 4.04 4.19];
y2 = [4.19 4.05 4.08 4.05 4.19 5.50 6.81 6.95 6.92 6.95 6.81 5.50 4.19];
plot(x2,y2)
quiver(x1, y1,x2-x1,y2-y1)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Vector Fields에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!