Clear Filters
Clear Filters

Adding more x axis tick marks on graph

50 views (last 30 days)
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.

Accepted Answer

Star Strider
Star Strider on 5 Oct 2018
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)

More Answers (0)

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!