Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

average

Asked by Lisa Justin on 6 Feb 2012
Latest activity Edited by Matt J on 1 Oct 2013

i have a 42*16384. how do i average it so that i get a new matrix of size 42*2048 (if N=2048 represents one revolution and N=16384 represents 8 revolutions).

0 Comments

Lisa Justin

Tags

Products

No products are associated with this question.

1 Answer

Answer by Andrei Bobrov on 6 Feb 2012
Accepted answer

data - your array [42x16384]

EDIT

out = mean(reshape(data,size(data,1),[],8),3);

eg:

data - your array [55x72000]

out = mean(reshape(data,size(data,1),[],3),3);

or

out = squeeze(mean(reshape(data,size(data,1),3,[]),2)) ;

5 Comments

Lisa Justin on 6 Feb 2012

i get an error message
??? Error using ==> reshape
Product of known dimensions, 216000, not divisible into total number of elements,
3960000.

Lisa Justin on 6 Feb 2012

I am still getting the same error message with
out = squeeze(mean(reshape(data.',size(data,2),8,[]),2)).'

Andrei Bobrov on 6 Feb 2012

see EDIT

Andrei Bobrov

Contact us