X-axis Labeling
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I am a new user of MATLAB. I managed to read a large excel sheet on Matlab, sorted the data and plotted the graph of the wanted data. The problem that I am experiencing is that I am trying to make the values of x-axis as a percentage. I have a variable of around 1000 integer which may increase as I add data. I have assigned a variable to check the length of variable so that I do not have to change it manually. The problem is that I need to assign the x-axis in terms of 10%, 20%... 100%. How can I do that without reducing data for the y-axis?
Regards
Réponses (1)
Wick
le 2 Mai 2018
I think the problem has to do with the fact that when there are 1000 elements in an array, there are only 999 gaps between those values. So the way you're constructing things nothing ever ends up at eactly 100.
Does this do what you want?
x = 100*(0:(length(data)-1)) / (length(data)-1);
plot(x,data)
0 commentaires
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!