フィルターのクリア

Adding more x axis tick marks on graph

50 ビュー (過去 30 日間)
JoshT_student
JoshT_student 2018 年 10 月 5 日
コメント済み: Star Strider 2018 年 10 月 5 日
Hello. I am trying to add more x axis ticks marks on my graph. My frequency (x values) are going from 5000 to 50,000, so it would be nice to have a tick mark with the number from the beginning at 5,000 and then it increments by 5000. I tried using the xticks code but it did not work. The code I have is below, you'll see that I only have one label at the moment, which is not good.
c=0.022*10^(-6);
frequency = 5000:5000:50000;
omega = 2.*pi.*frequency;
transfer = ((omega.*300.*c)./sqrt(1+(omega.*300.*c).^2)).*(1./sqrt(1+(omega.*220.*c).^2));
HN=20.*log10(transfer);
figure
semilogx(frequency, HN);
xlabel('frequency (Hz) in log scale');
ylabel('transfer function');
title('transfer function vs. frequency in log scale');
Thank you for the help.

採用された回答

Star Strider
Star Strider 2018 年 10 月 5 日
Try this:
c=0.022E-6;
frequency = 5000:5000:50000;
omega = 2.*pi.*frequency;
transfer = ((omega.*300.*c)./sqrt(1+(omega.*300.*c).^2)).*(1./sqrt(1+(omega.*220.*c).^2));
HN=20.*log10(transfer);
figure
semilogx(frequency, HN);
xlabel('frequency (Hz) in log scale');
ylabel('transfer function');
title('transfer function vs. frequency in log scale');
Ax = gca;
set(gca, 'XTick', frequency, 'XTickLabelRotation', 30)
  2 件のコメント
JoshT_student
JoshT_student 2018 年 10 月 5 日
Thank you Star Strider.
Star Strider
Star Strider 2018 年 10 月 5 日
As always, my pleasure.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by