Filtering "Smoothing" an array of numbers in C -
I am writing an application in the X-code. I am collecting this sensor data (gyroscope) and then throwing it Is thrown in. Finally I'm getting results in an array. In the app I am plotting the graph, but a lot of peaks (see the graph in red) and I would like to smooth it.
My array:
dual 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, I am normally working with 256 samples): ".9261901713034604", "2.436272348237486", "1.618854900218465", "1.849221286218342" ".8495016887742839", "0.5226796354304043" ".4229791869017677", ".3731843430827401", ".3254446111798023", ".2542702545675339", ".25237940627189", ".2273716541964159", ".2012780334451323", ".2116151847259499", ". 1921943719520009 "," .1882429400169304 "," .18001770452247 "," .1982429400169304 "," .1921943719520009 "," .2116151847259499 "," .2012780334451323 "," .2273716541964159 "," .25237940627189 "," .2542702545675339 ",". 3254446111798023 "," .3731843430827401 "," .4229791869017677 "," .5716796354304043 "," .8495016887742839 "," 1.849221286218342 "
How to filter / smooth it? What about Gauss? How to start any ideas or even give me a sample code Thank you for your help!
Regards
Joseph
Simple way to smooth Each sample has to be replaced with the average of its and its neighbors.
Comments
Post a Comment