Why does a sine bandwidth decrease with 1/dur, dur beeing the signal duration
Show older comments
Dear community, recently i was interested in the bandwidth of spectra. That's why i did some plots for signals with a single frequency at once but for different amplitude, duration and frequency. I saw, that the amplitude and frequency and amplitude does not influence the bandwidth in this case but signal duration does. can someone tell me why and why it is like a constant divided by the duration (~1/x). The constant changes a bit if a analyze the power spectrum instead of PSD, but the behavior stays the same. the behavior also stays the same if take the way over fft function and a linspaced frequency vector here a sample script; for anyone who is confused about the many loops can just set the ampNr and f0 value to one number only.
close all;
fs=8000;
dur=0.1:0.1:2;
cl=lines(6);
amp=1:6;
tiledlayout('flow');
for ampNr=amp
nexttile();
for f0=100:100:1000
myBW=nan(size(dur));
for durNr=1:numel(dur)
t1=0:1/fs:dur(durNr)-1/fs;
s1=sin(2*pi*f0*t1);
s1=s1+rand(size(s1))-0.5;
[spec,fSpec,tSpec,p]=spectrogram(s1,length(s1),[],[],fs);
[val,~,bw]=findpeaks(abs(spec),fSpec,'MinPeakHeight',0.9*max(p));
[~,idx]=max(val);
bw=bw(idx);
myBW(durNr)=bw;
end
end
plot(dur,myBW,'Color',cl(ampNr,:)); hold on;
xlabel('sine duration (s)');
ylabel('bandwidth (Hz)');
title(['sine amplitude ' num2str(ampNr)])
plot(dur,1.76./dur,'--k');
end
linkaxes()
best regards
Jonas
Accepted Answer
More Answers (1)
I don't have enough time at the moment to look at your code in depth, but I'm suspecting that you are experiencing "leakage" effects by not having an integral number of periods of the signal. So the truncation of your signal causes some extra energy outside of the pure sine frequency.
I suggest that you try changing your duration, but always keep the total duration an integral multiple of the sine wave's period and see if the behavior changes.
4 Comments
Jonas
on 17 Dec 2021
Jonas
on 17 Dec 2021
Sorry, I have not used the spectrogram function, and am not that familiar with the theory behind it In general though, it is aimed at giving you some time resolution of how the frequencies in a time varying signal evolve with time.
This doesn't seem to be directly applicable to your situation where you have pure sine waves.
Obviously a pure sine wave should have only a single frequency in its spectrum. I think if you plot the magnitude of the fft of these signals you will see that.
I think the fact that the peak of the spectrogram, with the parameters that you specified has some finite bandwidth is an artifact of the overlap and add used to compute the spectrogram. It is probably correct, I just don't know how to interpret it without digging deeper.
Hopefully someone else with more expertise on spectrograms can add more on this.
Jonas
on 18 Dec 2021
Categories
Find more on Parametric Spectral Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
