semilogx() - x-axis - Increase scaling for lower frequencies - compress higher frequencies
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, maybe someone can help me out here?
I am plotting 6 filtered sequences which works fine so far.
My Problem is the scaling on the x-axis:

I just can't figure out how to adjust the scaling on the x-axis for the frequencies so that all six sequences have the same size.
The limits are fine but the scaling is off: My target plot should look like this where each filtered signal has the same width.

In my first Plot the scaling works perfectly! But I cant get it to work on my filtered spectrum

In both cases I am using semilogx()
Here is a small snippet (somewhere I have to scale, but where?)
Sorry for the simple and dumb question but I just downloaded matlab2023 this night and never touched it before.
And yes I searched for quite a while for an answer... :)
frequencies = (0:N-1) * frequency_resolution;
...
magnitudes_dB = cellfun(@(x) 20 * log10(abs(x) / N), filtered_signals, 'UniformOutput', false);
...
mask = (frequencies >= 20) & (frequencies <= 6000);
...
figure;
hold on; % Enable plotting multiple lines on the same graph
for i = 1:numel(rcf_filters)
semilogx(frequencies(mask), magnitudes_dB{i}(mask), 'DisplayName', labels{i});
end
0 commentaires
Réponse acceptée
dpb
le 26 Août 2023
The issue isn't the plotting scaling; it's the data content. Each of the triangular-looking traces in the reference plot goes from a range that is 2X upper/lower range of previous offset by 10^n, n=0,1,2,... Hence, each trace is essentially the same except offset.
Your six traces vary in width by 2x rather than having the same frequency range from min to max. The three largest that can read are 2-6K, 1-3K, 0.5-1.5K, ... each range 2X the previous. That's just not the same as the desired.
You didn't give how were derived, but the problem isn't in the plotting but how the signals were generated if were to mimic the other figure.
2 commentaires
dpb
le 26 Août 2023
Yes, those appear to be offset by 2F with the width about the center frequency also scaled to match...
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Plot Customization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
