# How to scale the amplitude of an FFT of a chirp signal

I'm analysing some accelerometer data. The accelerometer was placed on a mechanical shaker and on this shaker a frequency sweep was performed.

When I look at the amplitudes of single sine waves they see to fit in the time and frequency domain. However, if I perform a sweep, the amplitudes are wrong.

The accelerometer data should be scaled right, I think it has to be some MATLAB fft specific stuff. The following code was used to perform the FFT:

nfft= length(signalToAnalyse);
%generate the freqvec
halfn = floor(nfft / 2)+1;
deltaf = 1 / ( nfft / Fs);
freq = (0:(halfn-1)) * deltaf;
% perform FFT
fftRawResult = fft(signalToAnalyse,nfft);
% convert from 2 sided spectrum to 1 sided
magnitude(1) = abs(fftRawResult (1)) ./ (nfft);
magnitude(2:(halfn-1)) = abs(fftRawResult (2:(halfn-1))) ./ (nfft / 2);
magnitude(halfn) = abs(fftRawResult (halfn)) ./ (nfft);


Anybode some Ideas?

Below is the signal in time domain and frequency domain.

• Did you check that delta f of measurement data is the same with theory data? – KKS Sep 23 '16 at 2:18
• Hi I just checked it, it was not the same but i fixed it and it did not change anything. But thank you very much for your input! – razac Sep 23 '16 at 7:01
• Second, unit of measurement data is the same with that of theory data? – KKS Sep 23 '16 at 7:23
• Yes everything is scaled into mg. I suspect that the power of my signal gets somehow scaled with the fft, because i have so many different frequencys. – razac Sep 23 '16 at 7:46
• Can I ask, what would you expect to see in the frequency domain? – A_A Sep 24 '16 at 10:38

First, thanks for all your inputs. I did some research and I found my mistake. The spectrum of a linear chirp can, according to Wikipedia (search for: "chirp spectrum wiki") be analytical described in the frequency domain. The formula for the amplitude

gave me the hint. I just used the constant factor and a factor of samplingfrequency/numberofsamples to match the FFT. I do not know exactly why, but it seems to fit.

Following Picture shows the result:

Following code can be used to simulate it:

    %% Test script
close all
clear all
clc
% create timevector
L =1000 ;
aux = 0:1:(L)-1;  % indexvector
% get fs
fs = 1000;
% create timevector
t = (1/fs)*aux;
f0 = 1;
f1 = 100;
% chirp in timedomain
SignalChirp = chirp(t,f0,max(t),f1);
% Window length
nfft= length(SignalChirp);
%generate the vector of frequencies
halfn = floor(nfft / 2)+1;
deltaf = 1 / ( nfft / fs);
ffft = (0:(halfn-1)) * deltaf;
% perform FFT
X = fft(SignalChirp,nfft);
magni1(1) = abs(X(1)) ./ (nfft);
magni1(2:(halfn-1)) = abs(X(2:(halfn-1))) ./ (nfft / 2);
magni1(halfn) = abs(X(halfn)) ./ (nfft);

figure(1)
subplot(2,1,1)
plot(t,SignalChirp,'k');
title(['Chirp Signal']);
xlabel('Time(s)');
ylabel('Amplitude');
subplot(2,1,2)
plot(ffft,magni1),hold on
duration = max(t);
c = (fs/L);
% https://en.wikipedia.org/wiki/Chirp_spectrum
scalingLinChirp = sqrt(duration/((f1-f0)));
plot(ffft,ones([length(ffft) 1])*scalingLinChirp*c), hold on
xlabel('Freq(Hz)');
legend('FFT Result' ,'Calculated Amplitude' )
ylabel('Amplitude');


If I use this scale factor to my FFT of my accelerometer data it matches the calculated theory much better than before. Sadly I can’t show you guys another picture due my low rep.