Help with Chirp FFT
14 次查看(过去 30 天)
显示 更早的评论
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]);
![power vs. freq..jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/220629/power%20vs.%20freq..jpeg)
1 个评论
Hieu Nguyen
2019-11-21
I have the same problem; the bandwidth seems to double its length. Also, sweeping up and down have different results
回答(1 个)
Daniel M
2019-11-21
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 个评论
Daniel M
2019-11-21
I also recommend increasing your sampling rate because it is not sufficient to fully represent this signal. At least 60 MHz should be OK.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!