From: Chad on
I have a data set that I want to smooth. I would like to take the every ten points and add sum them to make one point. I am unable to find a function that does this. Essentially I would like to decimate my data set but sum the points in between. Any suggestion would be helpful.
From: us on
"Chad " <cforrest(a)pas.rochester.edu> wrote in message <hvgj0k$mtp$1(a)fred.mathworks.com>...
> I have a data set that I want to smooth. I would like to take the every ten points and add sum them to make one point. I am unable to find a function that does this. Essentially I would like to decimate my data set but sum the points in between. Any suggestion would be helpful.

a hint:

help reshape;
help sum;

us
From: Dave Robinson on
"us " <us(a)neurol.unizh.ch> wrote in message <hvgk9s$emr$1(a)fred.mathworks.com>...
> "Chad " <cforrest(a)pas.rochester.edu> wrote in message <hvgj0k$mtp$1(a)fred.mathworks.com>...
> > I have a data set that I want to smooth. I would like to take the every ten points and add sum them to make one point. I am unable to find a function that does this. Essentially I would like to decimate my data set but sum the points in between. Any suggestion would be helpful.

If you have the Signal Processing Toolbox, then

help resample

will give you a very nice solution to your problem, although the 'smoothing' or lowpass filtering is done using a much more sophisticated filter than your simple block average technique.

Regards


Dave Robinson
From: John on
if x is a row vector which has a length that is a multiple of 10, then:

sum(reshape(x',10,length(x)/10))

"Chad " <cforrest(a)pas.rochester.edu> skrev i meddelelsen
news:hvgj0k$mtp$1(a)fred.mathworks.com...
>I have a data set that I want to smooth. I would like to take the every
>ten points and add sum them to make one point. I am unable to find a
>function that does this. Essentially I would like to decimate my data set
>but sum the points in between. Any suggestion would be helpful.

From: Matt J on
"Chad " <cforrest(a)pas.rochester.edu> wrote in message <hvgj0k$mtp$1(a)fred.mathworks.com>...
> I have a data set that I want to smooth. I would like to take the every ten points and add sum them to make one point. I am unable to find a function that does this. Essentially I would like to decimate my data set but sum the points in between. Any suggestion would be helpful.
=============

For large sparse data sets, downsample by matrix multiplication:

>> Data=sprand(100000,100000,.0001);

>> N=10; %downsample factor
>> A=kron(speye(size(Data,1)/N),ones(1,N)/N); %downsample matrix;

>> result=A*Data;