How can I plot a diagonal line on a log-log scale plot?
16 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 12 Mai 2020
Réponse apportée : MathWorks Support Team
le 27 Mai 2020
I have a "loglog" plot of data and I want to plot a diagonal line from corner to corner. How can I do this?
Réponse acceptée
MathWorks Support Team
le 12 Mai 2020
The most straight forward way to do this is to "loglog" plot a "logspace" array across the bounds that you are working with. For example:
x = logspace(0,15);
scatter(x,x)
grid on
hold on
loglog(x,x)
hold off
Alternatively, you can call "plot" with a "linspace" array as both the "x" and "y" arguments.
x = logspace(0,15);
scatter(x,x)
grid on
hold on
y = linspace(1,1e15);
plot(y,y)
hold off
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices 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!