spectrogram understanding amplitude and normalised frequency

9 views (last 30 days)
KE BR
KE BR on 11 Aug 2020
Commented: hosein Javan on 11 Aug 2020
Hi experts
I am trying to understand how the amplitude and frequency is expressed with the 'spectrogram' command in matlab. I have the following code:
Fs = 500;
t = 0:1/Fs:10-1/Fs;
x1 = 10*cos(2*pi*50*t);
x2 = cos(2*pi*60*t + 45*(pi/180));
x3 = cos(2*pi*70*t+ 10*(pi/180));
x = x1+x2+x3;
[s,f,t]=spectrogram(x)
am = abs(s);
tol = 280;
s(abs(s) < tol) = 0;
ph = angle(s);
figure
subplot(2,1,1)
plot(f,am(:,1))
subplot(2,1,2)
plot(f,ph(:,1)*(180/pi))
S gives me a complex matrix wich i can calculate the amplitude and phase with abs(S) and angle(S). When i plot the spectrum in amplitude-frequency domain for a certain time i get the following:
  • First of all i have 3 components on 50Hz, 60Hz and 70Hz. I alreay looked up what normalized frequency means and if im right the normalised frequency is /calculated as: f/fNyquist. So with a sample frequency of 500Hz the nyquist freq is 250Hz. Shouldnt this give 50/250=0.2, 60/250=0.24 and 70/250=0.28 as normalised frequency? instead i get 0.62, 0.75 and 0.88. What could be the problem here?
  • My second question is how the amplitude is expressed? For x1 = 10*cos(2*pi*50*t); i get an amplitude of 2970 and for x2 = cos(2*pi*60*t + 45*(pi/180)); i get an amplitude of 295. What does this exactly mean? an amplitude of 1 in time domain corresponds with 300... in frequency domain.
  • phase plot fft (strange)values here my problem with the phase was fixed but now i see a similar problem wich i dont quite know how to fix. When i use a normal fft i get the phases that i want.
Kind regards
  1 Comment
hosein Javan
hosein Javan on 11 Aug 2020
if you are measuring a power signal, I say instead of using spectrogram, use fft. spectrogram uses window function. if you can estime your signal frequency, you can cut a piece of your signal and perform an fft analysis. it's very simple though.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!