The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Averaging of 8 successive values in array
Replies: 1   Last Post: Sep 24, 2013 11:24 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Surendhra Goli

Posts: 3
Registered: 7/8/13
Averaging of 8 successive values in array
Posted: Sep 24, 2013 10:57 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I have my Value array which is for unknown number of values

Value =
78 74 77 75 75 78 75 77 76 81 76 92 98

I want to calculate the moving average of first 8 values (i.e (78 74 77 75 75 78 75 77)/8 =76.125) and need to store in Average 1st value and after i need to calculate next 8 values (i.e (74 77 75 75 78 75 77 76)/8=75.875 )and need to store in Average 2nd value

for this i wrote a program but its result showing only the first value of Value is average for entire series ....

for i=1:length(Value);
if j<=i+7;
% if Average==0;
% Average=Average/8;
% end

But I am not sure whether it?s a correct command to be used or not. I appreciate any comment that you give on first how to calculate.

thanks & regards


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.