Problem with x axis
이전 댓글 표시
Greetings! I'm having some trouble understanding the reason why my x-axis in a matlab plot appears the way it does. I've defined a limit for the x-axis variable(from -2 to 2) and in the plot it shows values from 0 to 4000.
This is my code:
clc;
clear all;
clf;
r=1;
ad=-2*r:0.001:2*r;
d=abs(ad);
Ai=2*r*acos(d./(2*r))-(d/2).*((4*r^2)-d.^2).^0.5;
A=Ai/(pi*r^2);
plot(A);
grid

답변 (1개)
Honglei Chen
2013년 10월 30일
편집: Honglei Chen
2013년 10월 30일
You need to do
plot(ad,A)
otherwise the x axis is just the indices of elements in A
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!