add frequency scale for mesh

12 ビュー (過去 30 日間)
MOHAMMED AL-DALLAL
MOHAMMED AL-DALLAL 2016 年 5 月 23 日
コメント済み: Star Strider 2016 年 5 月 23 日
I want to display the frequency scale ( 0:1:10 ) on y-axis for the following code:
x=peaks;
f=10; % freq
fval=0:1:f;
mesh(x)
set(gca,'Ydir','reverse')
ylabel('freq. Hz')
xlabel('Samples')
zlabel('Amp.')

採用された回答

Star Strider
Star Strider 2016 年 5 月 23 日
This works:
x=peaks;
f=10; % freq
fval=0:1:f;
mesh(x)
set(gca,'Ydir','reverse')
ylabel('freq. Hz')
xlabel('Samples')
zlabel('Amp.')
yt = get(gca,'YLim'); % Get Y-Limits Values
dyt = 0:10; % Desired Y-Tick Values
set(gca, 'YTick',linspace(min(yt),max(yt),length(dyt)), 'YTickLabel', dyt) % Set New Labels
  4 件のコメント
MOHAMMED AL-DALLAL
MOHAMMED AL-DALLAL 2016 年 5 月 23 日
編集済み: MOHAMMED AL-DALLAL 2016 年 5 月 23 日
its perfect thank you very much , last asking if i want to change the scale for x-axis ? as example x scale from 0 to 20 ?
is it correct xv = linspace(0, 20, size(x,2));
Star Strider
Star Strider 2016 年 5 月 23 日
My pleasure. (Sorry, had to be away for a bit running errands. Life intrudes.)
You ‘xv’ assignment will work as you wrote it, and will do what you want in the meshgrid call:
xv = linspace(0, 20, size(x,2));

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by