Log log plot

조회 수: 37 (최근 30일)
Marin
Marin 2012년 1월 17일
I have a set of data wich I want to plot in a log scale, not with the base 10, but with the base 2. How can I do that?

채택된 답변

Grzegorz Knor
Grzegorz Knor 2012년 1월 17일
Try this code:
plot(log2(rand(100,1)*128))
ytick = get(gca, 'YTick')
str = cellstr( num2str(ytick(:),'2^{%d}') )
format_ticks(gca,' ',str)
format_ticks function you can download from:

추가 답변 (1개)

C.J. Harris
C.J. Harris 2012년 1월 17일
  댓글 수: 2
Marin
Marin 2012년 1월 17일
yeah, I did that, severaltimes, but I haven't found the solution there. it just doesn't say anything about changing the log base. am I missing it maybe?
C.J. Harris
C.J. Harris 2012년 1월 17일
log10/log2 is a constant, so can't you simply modify the axis labels?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by