Plot step function with y-axis in log-scale
조회 수: 9 (최근 30일)
이전 댓글 표시
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.
채택된 답변
Walter Roberson
2016년 4월 9일
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)] )
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Two y-axis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!