MATLAB FFT bin size
显示 更早的评论
I am attemping to create an FFT function that allows me to set the frequency range of the FFT, the number of bins, and windowing type. For the frequnecy range, my logic is to use a low-pass filter. If I add a filter, does it make sense to have windowing? How am I able to set a distinct number of bins in the FFT, it seems that automaticcaly the number of bins is incredibly high (I am collecting data at 48 kHz for about 90 seconds). I would like the bin width to be around 1 Hz instead of ~.01 which it currently is. How can I change this? We have another program that is able to achieve this, so I know that it is possible, but is this program cutting out data to achieve this?
2 个评论
Steven Lord
2024-6-19
This sounds more like a general signal processing question than a question about MATLAB. If it is you might want to find a forum that is more targeted towards signal processing.
Or if you know what you want to do but aren't sure how to implement it in MATLAB, please show your code and ask a specific question about the section of the code where you're having doubts or uncertainty.
dpb
2024-6-19
@Steven Lord is correct in that the subject is not specific to MATLAB at all, but I'll make one comment on a specific Q? raised...
"...I would like the bin width to be around 1 Hz instead of ~.01 which it currently is. How can I change this?"
The basic relationships are
Fmax = 1/(2*dt) Nyquist criterion
T = N*dt Sample data length
df = Fmax/(N/2) --> df = 2*Fmax/N Frequency bin width
Consequently, whatever you pick for N controls the length of the sampled data stream given a fixed sampling rate (dt). Your ability to discern frequency components in the signal without aliasing is totally dependent upon sampling at at least 2X the highest frequency component in the signal, but for reliable estimates, it really ought to be more like 3-4X. The only way to ensure a signal is not aliased is that the input either simply physically cannot contain any higher frequency data or by analog filtering prior to sampling--once the data are sampled, filtering has no effect; the aliasing has already occurred.
The FFT can be computed over any number of frequency bins up to the length of the input signal; select a number for it which will give you the desired frequency resolution. This will still process the whole time series but will aggregate the energy within each frequency bin; the total energy in the signal is always the same so half the number of bins will double the energy in each bin in order to integrate to the same total.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Digital Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

