From: isha ram on
can anybody tell how to calculate the moving average at a lag of 10 of about 65000 data
thanks in advance
ex:
t = [0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10]
Q=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]
when t = 5; Q = average(1:10)
t = 10; Q=average(11:20)
From: ImageAnalyst on
Use the conv() function. Write back if you can't figure it out.
From: Loren Shure on
In article <hqa1k4$7b3$1(a)fred.mathworks.com>, roshni_balan(a)hotmail.com
says...
> can anybody tell how to calculate the moving average at a lag of 10 of about 65000 data
> thanks in advance
> ex:
> t = [0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10]
> Q=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]
> when t = 5; Q = average(1:10)
> t = 10; Q=average(11:20)
>

Check out the function filter. b = ones(1,10)/10 and a = 1 perhaps.

--
Loren
http://blogs.mathworks.com/loren
http://matlabwiki.mathworks.com/MATLAB_FAQ
From: isha ram on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <a6ef3aba-1bf0-4836-a09d-edfb33e9eabb(a)u34g2000yqu.googlegroups.com>...
> Use the conv() function. Write back if you can't figure it out.
Ex:

for t=1:n %% t = [0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10]
Q=f(n); %%Q=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]
if t==5
R= average(Q) up to t==5 %%here (R=average(1:10))
if t==10
R=average(Q) %%here (R=average(11:20))
and so on
From: ImageAnalyst on
On Apr 16, 3:19 pm, "isha ram" <roshni_ba...(a)hotmail.com> wrote:
> ImageAnalyst <imageanal...(a)mailinator.com> wrote in message <a6ef3aba-1bf0-4836-a09d-edfb33e9e...(a)u34g2000yqu.googlegroups.com>...
> > Use the conv() function.  Write back if you can't figure it out.
>
> Ex:
>
> for t=1:n         %% t = [0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10]
> Q=f(n);                       %%Q=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]
> if t==5
> R= average(Q) up to t==5      %%here (R=average(1:10))
> if t==10
> R=average(Q)                        %%here (R=average(11:20))
> and so on

-----------------------------------------------
Uh, ok. And what is this?