Can I set a range for spectrogram Analysis
Show older comments
Hi All,
my signal data has a variable frequency(around 50HZ). Can I set a frequency range for spectrogram analysis?
I want to determine the exact frequency according to time
My code is listed below.
Thank you ALL!
Ivy
clear all;
clc;
Fs=1000;
T=1/Fs;
L=1000;
t=(0:L-1)*T;
for i=1:1:10000 %variable frquency signal.
x(i)=0.7*sin(2*pi*(50+rand)*T*(i-1));
end
NFFT =1024;
[S,F,T,P] = spectrogram(x,1024,1000,1024,1E3);
[c,index]=max(P);
surf(T,F,10*log10(P),'edgecolor','none'); axis tight;
view(0,90);
Accepted Answer
More Answers (1)
Daniel Shub
on 1 Aug 2011
1 vote
You cannot set the frequency range for spectrogram analysis using the spectrogram function. You can, however, perform a short-time Fourier analysis with the freqz function. The freqz function lets you focus your NFFT frequency bins where you want them, as opposed to uniformly throughout the entire frequency range. This approach would require you to write code for the windowing of your signal.
Categories
Find more on Time-Frequency Analysis 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!