Plot step function with y-axis in log-scale
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Rayne
el 9 de Abr. de 2016
Comentada: Rayne
el 9 de Abr. de 2016
Hi,
How can I plot something like this?
I can only either use semilogy to plot the graph in log scale (without step function), or plot the step function (using "stairs" function) but with the y-axis in terms of the exponential (by taking the log of the y-values first).
How do I do both?
Thank you.
2 comentarios
Respuesta aceptada
Walter Roberson
el 9 de Abr. de 2016
If you are trying to get one line to be in log y scale and another to be in linear y scale, then you should plotyy() and set one of the axes to 'yscale' 'log'
If you are having problems that somehow stairs() does not look right with semilogy, then I do not seem to reproduce that in R2014a.
But if you happen to need some code to reproduce stairs() in terms of plot(), then:
plot( [x(1),kron(x(2:end),[1 1])], [kron(y(1:end-1),[1 1]),y(end)] )
Más respuestas (0)
Ver también
Categorías
Más información sobre Two y-axis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!