Problem with x axis
2 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Honglei Chen
on 30 Oct 2013
Edited: Honglei Chen
on 30 Oct 2013
You need to do
plot(ad,A)
otherwise the x axis is just the indices of elements in A
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!