Effacer les filtres
Effacer les filtres

Shift plot indexing

2 vues (au cours des 30 derniers jours)
Matt
Matt le 7 Juil 2011
I want to plot, for example, population sizes versus time, with t=0 being the first point. How do I get something like
A = [10 9 7 8 4 2 5 1 0;
10 12 6 8 3 3 4 2 0];
plot(A');
to have the x-axis go from 0 to 8 instead of 1 to 9 (i.e., shift the entire plot to the left 1 unit)?

Réponse acceptée

Paulo Silva
Paulo Silva le 7 Juil 2011
A = [10 9 7 8 4 2 5 1 0;
10 12 6 8 3 3 4 2 0];
plot(0:size(A,2)-1,A');

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by