Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Average every three points
Replies: 1   Last Post: Nov 15, 2012 11:09 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Loren Shure

Posts: 991
Registered: 12/7/04
Re: Average every three points
Posted: Nov 15, 2012 11:09 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


"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/




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.