Problem with origin and plotting axes
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi, I've been having problems with the plotting axes when it comes to plotting 2D points in MatLab (r2010a).
On a simple test program like:
W=[[0 0]' [0 1]' [1 0]' [1 1]'];
for i=1:4;
plot(W(:,i));
end
The origin is translated to (0,1). I've of course tried all the "normal" ways of setting axes, but the problem is still there. Anyone had similar problems, or may know of some default variables I could change to solve this rather irritating time spender?
Thanks for any help!
댓글 수: 0
채택된 답변
Brett Shoelson
2011년 2월 10일
Is this what you're looking for?
>> x = [-0.5 0.5 0.5 -0.5];
>> y = [-0.5 -0.5 0.5 0.5];
>> plot(x,y,'ro')
>> axis([-1 1 -1 1]); %OR: set(gca,'xlim',[-1 1],'ylim',[-1 1])
Cheers,
Brett
댓글 수: 0
추가 답변 (1개)
Davide Ferraro
2011년 2월 10일
Your code is basically:
plot([1 1]');
and is represented by a line with first point(1,1) and second point (2,1) (giving only y values, the x are placed automatically incrementally from 1).
If you want to display also the (0,0) coordinate you can simply use the AXIS command:
axis([0 2 0 2])
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!