Adding more x axis tick marks on graph

64 次查看(过去 30 天)
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by