Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: Average every three points
Posted:
Nov 15, 2012 11:09 AM
|
|
"Akram Nour" <akramonour@hotmail.com> wrote in message news:k82v0a$c7c$1@newscl01ah.mathworks.com... > I would like a sufficient way rather than using loop to average between > every element with the previous and the following elements (neglecting the > first and last elements); for instance: > If I have as an input (a) with a size of (12x1) > a= [ 3; 6; 4; 1; 3; 6; 7; 8; 5; 3; 2; 1]; > > the output should be (b) with a size of (10x1) as follows b=[ 4.33; 3.66; > 2.66; 3.33; 5.33; 7.00; 6.66; 5.33; 3.33; 2.00] > > Thanks in advance for your cooperation
Look into the function filter. Your filter would be b = [1 1 1]/3, a = 1
-- Loren http://blogs.mathworks.com/loren/ http://www.mathworks.com/matlabcentral/
|
|
|
|