Help with Chirp FFT
27 views (last 30 days)
Show older comments
I am trying to make a fft for a chirp signal with a frequency range of 15-25 MHz over a period of 10 micro seconds. When I attempt to plot the power vs. the frequency, I end up with a "square"-like wave from 15 MHz to 25 MHz and another one from 25 MHz to 35 MHz. I only need to generate the one wave that is from 15-25 MHz. Please find attached the plot and I have included the code below:
SPF=50e6;
frames = 16;
nfft = SPF/frames;
f_max = 25e6;
f_min = 15e6;
start_time=2e-6;
end_time=12e-6;
d_chirp = 10e-6;
Fs=2*f_max;
hchirp = dsp.Chirp('InitialFrequency',f_min,'TargetFrequency',f_max,...
'TargetTime', d_chirp,'SweepTime', d_chirp, 'SampleRate', SPF, 'SamplesPerFrame', nfft);
chirpData = (step(hchirp))';
freq_chirp=fft(chirpData,nfft);
power=abs(freq_chirp);
freq =(0:nfft-1)*Fs/nfft;
figure();
plot(freq,power);
xlabel('Frequency (Hz)');
ylabel('Power');
xlim([0 50e6]);
1 Comment
Hieu Nguyen
on 21 Nov 2019
I have the same problem; the bandwidth seems to double its length. Also, sweeping up and down have different results
Answers (1)
Daniel M
on 21 Nov 2019
You are plotting the incorrect frequency vector. fft() does not return the frequencies in order from most negative to most positive. Follow the example in the documentation for more information.
Change your freq and power vectors to:
freq2 = (0:(nfft-1)/2)*Fs/nfft;
power2 = power(1:(nfft/2));
Also note that this isn't typically what is considered the power. This is just the energy. Power is energy squared. You would also have to divide by nfft to scale properly.
1 Comment
Daniel M
on 21 Nov 2019
I also recommend increasing your sampling rate because it is not sufficient to fully represent this signal. At least 60 MHz should be OK.
See Also
Categories
Find more on Fourier Analysis and Filtering 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!