Pregunta

I am a complete beginner at MATLAB and signal analysis so I don't really understand the fourier mathematics behind signal filtering. I took my Ipod Touch and used an app that records the accelerometer data (at 50Hz sampling rate) to a CSV and I loaded that CSV data into matlab. I am now trying to apply a low pass filter to the signal to get rid of the noise that occurs when from small changes in acceleration (so I am left with just the large signals of acceleration).

I read a bunch about signal filtering in matlab today and I own the signal processing toolbox, but I am still very confused on what certain variables mean. For instance the function filter(b,a,data) keeps coming up and I know that a and b are vectors of coefficients but I have no idea how these effect the filter or how to create these values based on what i know about my signal/what I want done with it.

Where should I go to learn the basics of signal processing if I don't have a strong background with Fourier analysis? And how should I go about creating my low pass filter in matlab? Thanks!

Here is the sample data I am working with.

I tried just winging it and making a=[1 -0.9] b=1 based on some other stackexchange posts bout low pass filters in matlab and it seems to have done something but it also seems to have magnified my signal 3-fold. What exactly did I do by applying a filter with those values?

¿Fue útil?

Solución

If you want to design filters with matlab, you can start by reading about them in the documentation, for instance here. If you want to just wing it then you can study the effects of different parameters using the fvtool utility. Like most tools, however, you are more likely to get something out of it if you spend a few minutes reading the user's manual. For starters you will want to have some idea of where to set a frequency cutoff.

The following figure shows the frequency response of 3 different filters. The left panel is the response of your filter and highlights why you observed an amplification: low frequency signals are scaled by a factor of ~10. The filter you used is type IIR with feedback. The middle panel shows a similar filter with a more reasonable choice of b. A simpler FIR filter that might suit your needs, shown on the right, was generated with fir1. The drawback with the IIR filter is that it does not exhibit a uniform group delay response for all frequencies, which for your particular application is probably undesirable.

enter image description here

The following figure shows the raw and filtered data obtained with an IIR and FIR filters:

enter image description here

Finally, the following shows your data in the frequency domain before and after filtration. The drop in signal above 2.5 Hz due to the filters is evident. The response to the selected FIR filter is not as smooth as for the IIR filter and gives rise to ripples, but has a more abrupt dropoff, attenuating high frequency signals more than those at lower frequency.

enter image description here

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top