2016-03-23 6:26 AM
Hi,
I am using STM32f405, and CMSIS dsp library, to filter a signal acquired by ADS1278. The filter used is a 12th order bandpass butterworth IIR filter whose coefficients generated by matlab, and my signal is 2430Hz The problem is;When I use a filter with a pass band 2300Hz-2500Hz everything work fine. But if a use a more narrow band like 2420Hz-2440Hz filter output is not stable. It is making noise, not periodic but randomly, like 2 seconds ok then a noise, 5 seconds ok then a noise. Matlab says filter is stable for 32bit quantized coefficients, but actually there is problem. Can anyone suggest a way to findout where is the problem? #dsp-iir-filter-matlab-stm32f42016-03-23 6:55 AM
Hello,
This seems very difficult to get a right result. Are you in 32bits integer or single FP and your sample rate is not high versus the band. Some times I program the filter in Double FP to get the expected result or on 64 bits integer (more difficult and longer to execute) B.2016-03-23 7:21 AM
> Matlab says filter is stable for 32bit quantized coefficients, but actually there is problem.
If I remember correctly, Matlab does by default anything in double precision. Coefficients might be single-precision (float, 32 bit), but intermediate values not. I'm pretty sure, if you verify your IIR implementation on a PC platform using float (single precision), you get identical ('noisy') results.
2016-03-24 1:29 AM
Hi,
I am using single precisison floating point, and also tried imlementing filter in 64 bit floating point but execution time approximately 10 times greater. Is there any mathematical relation between bandwidth and the sampling rate?Because i also tried incresing sampling rate. Infact I cannot really increase the sample rate because of the software limitation in communication between ADS1278 and my STM32f4 dsp. But I extrapolate the signal by injecting zero after every sample. But ı got the same result.2016-03-24 1:33 AM
I also tried implementing this in PC, but there was no problem.
My coefficients were 32bit fp and the arithmetic was single, and I got correct result.2016-03-24 2:41 AM
> Is there any mathematical relation between bandwidth and the sampling rate?
Search for ''Nyquist theorem''. I supposed you know ...> I am using single precisison floating point, and also tried imlementing filter in 64 bit floating point but execution time approximately 10 times greater.
Ten times seems a bit much, but yes, double precision is not directly supported by the FPU, and requires emulation. I think you would need to estimate the accumulative error of your filter implementation. Single precision means only 24 bit mantissa - the more calculations, and the more complex, the further the deviation from your theoretical result. And for a reference implementation, that definitely includes reference data. When using the same 'filter' code and the same reference test data, you should get the exact same results on your target hardware, and on a PC implementation, provided you use a IEE754 floating point implementation (which is the default).
2016-03-24 3:13 AM
Hi,
I know sampling theorem, and it states that to reconstruct signal you have to sample it at least twice of signal's frequency.I was asking for is there any practical implementation states that ''if you want to have good result your sampling frequency must be for example 50x of the band width of your filter''Thanks2016-03-24 4:27 AM
I'm not an expert in digital signal processing, but there is a relation between sampling frequency and bandwidth (filter slope). Think of the correspondence between sampling frequency (time domain) and bin size (frequency domain).
Excluding other possible bugs in your implementation, your high-order filter might be numerically unstable for such a small bandwidth. However, a direct mathematical relation escapes my knowledge ...2016-03-24 4:46 AM
Thanks for your help Avatar,
I will take that in to consideration.