Problem with x axis
Afficher commentaires plus anciens
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

Réponses (1)
Honglei Chen
le 30 Oct 2013
Modifié(e) : Honglei Chen
le 30 Oct 2013
You need to do
plot(ad,A)
otherwise the x axis is just the indices of elements in A
1 commentaire
Pedro
le 30 Oct 2013
Catégories
En savoir plus sur Line Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!