Log log plot

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
See:
doc loglog

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?
log10/log2 is a constant, so can't you simply modify the axis labels?

请先登录,再进行评论。

类别

在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by