set x-axis in semilogx plot
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm tring to plot a graph with a logaritmic x-axis. I want the x-axis to go from zero to 10000.
However when i try the following code nothing happens. (result see attachment)
x = [10 100 2000 3400 5000];
y = [12 8 5 3 2];
semilogx(x,y);
xt = [0 1 10 100 1000 10000];
set(gca,'XTick',xt)
xlim([0 100000])
ylim([0 15])
How can i solve this?
2 commentaires
William Alberg
le 26 Mai 2020
You cannot reach 0 on a logarithmic plot.
You can do the following:
x = [10 100 2000 3400 5000];
y = [12 8 5 3 2];
semilogx(x,y);
% xt = [0.1 1 10 100 1000 10000];
% set(gca,'XTick',xt)
xlim([0.1 100000])
ylim([1 15])
Réponses (0)
Voir également
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!