On Dec 16, 11:27 pm, "Sebastian Gatzka"
<sebastian.gatzka.NOS...@stud.tudarmstadt.de> wrote:
> Hello World.
>
> I'm trying to create a spectrogram which output amplitude is identical to the output of the classical fourier transformation.
>
> I don't need the PSD (which I'm not familiar with) but tried to manipluate the short time fourier ouput.
>
> If I do a FFT I divide the output of the fft with the length of the original signal to get the correct amplitude I will find in the signal.
>
> With the spectrogram I'm not sure how to do this because it's not clear to me how to dertermine how many samples are actually contained in the spectrogram output when using shorttime windowing and overlap.
>
> My FFT looks like this:
>
> fs = 100e3; % sampling frequency
> m = size(signal,2);
> n = 2^nextpow2(m);
> y = fft(signalmean(signal),n);
> y = y/m;
> a = abs(y);
> f = (0:n/21)*(fs/n);
> plot(f,2*a(1:n/2));
>
> and the spectorgam like this (so far):
>
> [S,F,T,P] = spectrogram(signalmean(signal),hamming(hammingWindowSize),hammingWindowSize*0.5,[],fs);
>
> So again: How do I have to mainipulate the matrix S to contain elements which do have the same amplitude as the elements in 2*a from the FFT?
>
> Hope anyone can help.
> Sebastian
I think this line:
y = y/m;
should be:
y = y/n;
because FFT knows nothing about the length of your signal, only the
length you enter into fft.
And, BTW, you don't need to use dyadic numbers, so you can dispense
with nextpow2 and just use m in the fft.
But in any case, you can check using Parseval's Theorem which says
that the variance of the signal i.e. var(signal padded with zeros if
necessary) must equal the sum of squares of the amplitudes sum(a.^2)
