1
$\begingroup$

I am doing some system identification using different signals such as single tone, multi tone, chirp and so on. These days I was trying to get an FFT of a chirp signal and I found a nice code here on Stack Exchange. I am pretty satisfied with the results except that I would like the resolution to be better between f0 and f1, the initial and end frequency. I have tried different methods of interpolating the FFT results, interpolating the magnitude (which is fine more or less but doesn't give me anything on the phase).

To give you a better idea of what I'm talking about, please take a look at the plot. Chirp and FFT Chirp and FFT - zoom

Would you know a way to get a better resolution?

Also the code:

%% Test script
close all
clear all
clc
% create timevector
% get fs
fs =  10e4;
% create timevector
t = linspace(0,0.2,fs);
f0 = 1000;
f1 = 2000;
% 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 = str2double(num2str(1/(nfft / fs)));
%deltaf = 1 / ( nfft / fs);
ffft = ((0:(halfn-1)) * deltaf)/t(end);
% 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)
semilogx(ffft,20*log10(magni1)),hold on
$\endgroup$
1
  • $\begingroup$ As a side note, why do you convert the calculated $df$ from a number, to a string and back to a number again? The subsequent use of num2str an str2double seems somewhat pointless. $\endgroup$
    – user883521
    Commented Dec 7, 2017 at 19:20

2 Answers 2

1
$\begingroup$

Zero-padding before the FFT (which is equivalent to Sinc interpolation after the FFT) will give you a higher resolution plot. Symmetric zero-padding (centered or both edges) will give you similar FFT phase results to the original FFT.

$\endgroup$
1
$\begingroup$

As an alternative to @hotpaw2 ‘s answer. The frequency domain resolution $df$ equals $1/T$, with $T = NFFT / f_s$ the length of your FFT block in seconds. So, in order to increase the resolution between $f_0$ and $f_1$, you could also increase the length of your signal.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.