matlab plot 2 vectors
조회 수: 39 (최근 30일)
이전 댓글 표시
hello!
i have X and Y data. if i plot it i get an open curve, but want to obtain a closed curve and so i do
XX=[X(end) X];
YY=[Y(end) Y];
plot(XX,YY,'r-')
is there a more elegant way to do it? i can't find a better solution...
thank you so much!
댓글 수: 0
채택된 답변
Image Analyst
2012년 10월 4일
I don't see anything wrong with that unless you'd want to do it all in one line to prevent creating temporary variables, but the variables are so tiny (just a few hundred coordinates in these days of gigabyte RAM) it's really not worth worrying about.
plot([X(end) X], [Y(end) Y], 'r-');
추가 답변 (1개)
Azzi Abdelmalek
2012년 10월 4일
편집: Azzi Abdelmalek
2012년 10월 4일
not different from yours
plot([x x(1)],[y y(1)],'r-')
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!