How to plot data along a path in the x-y plane?
조회 수: 4 (최근 30일)
이전 댓글 표시
I am trying to create a 2D plot of a set of data points along a path in the x-y plane given by the coordinates (0,0) to (pi,0) to (pi,pi) to (0,0). This would mean plotting along the line y = 0 where x varies from 0 to pi first, then plotting along the line x = pi where y varies from 0 to pi second, and finally plotting along the line y = x where both x and y go from pi to 0. Is there a way to do this?
What I am essentially looking for is to do something like this:
for r=1:Nsites
plot(k,Vfull(r,:),'.b')
end
where
Vfull(r,:)
specifies the row r containing the data points. I would like
k
to be the array of points along the specified path.
댓글 수: 0
답변 (1개)
KSSV
2017년 11월 14일
N = 100 ;
th = linspace(0,pi,N)' ;
L1 = [th zeros(size(th))] ;
L2 = [pi*ones(size(th)) th] ;
L3 = [flipud(th) flipud(th)] ;
L = [L1 ; L2 ; L3] ;
figure
plot(L(:,1),L(:,2))
figure
hold on
plot(L1(:,1),L1(:,2))
plot(L2(:,1),L2(:,2))
plot(L3(:,1),L3(:,2))
legend('L1','L2','L3')
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!