I am writing an application in X-code. It is gathering the sensor data (gyroscope) and then transforming it throw FFTW. At the end I am getting the result in an array. In the app. I am plotting the graph but there is so much peaks (see the graph in red) and i would like to smooth it.
My array:
double magnitude[S];
...
magnitude[i]=sqrt((fft_result[i][0])*(fft_result[i][0])+ (fft_result[i][1])*(fft_result[i][1]) );
An example array (for 30 samples, normally I am working with 256 samples): "0.9261901713034604", "2.436272348237486", "1.618854900218465", "1.849221286218342", "0.8495016887742839", "0.5716796354304043", "0.4229791869017677", "0.3731843430827401", "0.3254446111798023", "0.2542702545675339", "0.25237940627189", "0.2273716541964159", "0.2012780334451323", "0.2116151847259499", "0.1921943719520009", "0.1982429400169304", "0.18001770452247", "0.1982429400169304", "0.1921943719520009", "0.2116151847259499", "0.2012780334451323", "0.2273716541964159", "0.25237940627189", "0.2542702545675339", "0.3254446111798023", "0.3731843430827401", "0.4229791869017677", "0.5716796354304043", "0.8495016887742839", "1.849221286218342"
How to filter /smooth it? whats about gauss? Any idea how to begin or even giving me a sample code. Thank you for your help!
best regards
josef
Simplest way to smooth would be to replace each sample with the average of it and its 2 neighbors.