I want to build a figure like the one below.
but now it's like:
My code is:
surf(X,Y,Z);
set(gca,'xtick',[4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384]);
set(gca,'ytick',[64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288]);
how can I set the distance of each tick equal to each other?

댓글 수: 2

Stephen23
Stephen23 2015년 11월 14일
편집: Stephen23 2015년 11월 16일
To get the correct binary prefixed or SI prefixed numbers you can use my FEX submissions num2bip and num2sip:
They very simple to use, and offer control over significant digits, trailing zeros and the prefix symbol/name.
Binary prefixes:
>> num2bip(10240)
ans = '10 Ki'
>> num2bip(10240,4,true)
ans = '10 kibi'
And for SI:
>> num2sip(10000)
ans = '10 k'
>> num2sip(10000,4,true)
ans = '10 kilo'
dpb
dpb 2015년 11월 15일
How nice a little utility, Stephen...

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

답변 (2개)

dpb
dpb 2015년 11월 14일
편집: dpb 2015년 11월 14일

0 개 추천

The original appears to have been plotted by creating the datapoints at the locations 2^N then plotted versus ordinal number, not the actual value. Then the ticks are labelled to reflect the numeric values.
Try
surf(Z)
instead which will plot against 1:length(x) and 1:length(y) by default. Then adjust the tick marks based on how many points you actually have to be at the correct alignment of which value corresponds; you don't say how big your two vectors are.
BTW, to write the tick labels, you can use
set(gca,'xticklabel',2.^[0:12].');
set(gca,'yticklabel',2.^[2:14].');
and Matlab will translate. You may want to be more specific in controlling formatting, though, in which case you can use num2str to force a given format (like for values such as 8192 and greater you can write as '8K', etc., as in the original).
Oh, also, to more or less duplicate the original,
set(gca,'zscale','log')
to place the vertical axis in log coordinates which will spread out the small stuff.
May also fine
axis equal
pleasing; that'll be a "see what happens" with/without sorta' thing but I'm guessing it'll help the presentation.
the cyclist
the cyclist 2015년 11월 14일

0 개 추천

I'm not 100% certain I understand your question, but I think a couple things that might help you are to change the axes to logarithmic:
set(gca,'XScale','log')
set(gca,'YScale','log')
set(gca,'ZScale','log')
and then possibly set the tick positions exactly how you want
set(gca,'XTick',[MATLAB vector of tick positions goes here])

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

질문:

2015년 11월 14일

편집:

2015년 11월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by