Prev: brushless
Next: Connecting MATLAB to Web
From: Fraser Dickson on 20 Nov 2009 04:01 Hi, I want to try implement a moving average function on my array of data the data ranges from 0 -128 but values that are wrapped around so that data at 128 is of similar order to that of 1 if you know what i mean. I need to perform a moving average function on my data set but evrything that i have come across so far treats the data as 1 and 128 being completley opposite ends of the scale and therefore the moving average filter gets very confused How can i set up a function to deal with the fact that my values wrap around at the limits. p.s it was just a simple filter2 fucntion iw as using before Thanks
From: Jan Simon on 20 Nov 2009 05:36 Dear Fraser! > I want to try implement a moving average function on my array of data > the data ranges from 0 -128 but values that are wrapped around so that data at 128 is of similar order to that of 1 if you know what i mean. > > I need to perform a moving average function on my data set but evrything that i have come across so far treats the data as 1 and 128 being completley opposite ends of the scale and therefore the moving average filter gets very confused You can pad your data: add some final value to the start and initial value to the end. After filtering, remove the extra values. If your array is not too large, this would be efficient enough. For huge data (>> 100 MB) or very frequent access of the function, a C-Mex could handle this fast without explicite padding. Kind regards, Jan
From: Matt Fetterman on 20 Nov 2009 10:18 "Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <he5rei$2c2$1(a)fred.mathworks.com>... > Dear Fraser! > > > I want to try implement a moving average function on my array of data > > the data ranges from 0 -128 but values that are wrapped around so that data at 128 is of similar order to that of 1 if you know what i mean. > > > > I need to perform a moving average function on my data set but evrything that i have come across so far treats the data as 1 and 128 being completley opposite ends of the scale and therefore the moving average filter gets very confused > > You can pad your data: add some final value to the start and initial value to the end. After filtering, remove the extra values. > If your array is not too large, this would be efficient enough. For huge data (>> 100 MB) or very frequent access of the function, a C-Mex could handle this fast without explicite padding. > > Kind regards, Jan Here is another suggestion. Lets say I label a circle with the values 0 through 10 going around the circle. Then I assign (x,y) coordinates to each point in the circle. Then map the data onto the circle. Then average over (x,y) coordinates. Then take the inverse mapping function. A little weird but I think it captures the periodic nature of the data. If you think it is interesting approach I could suggest the coding. Regards! Matt
|
Pages: 1 Prev: brushless Next: Connecting MATLAB to Web |