Thread Subject: Averaging and reducing

Subject: Averaging and reducing

From: Erlend Rolseth

Date: 24 Nov, 2009 09:34:03

Message: 1 of 2

Hey, I have a 40000x1 matrix which i want to reduce to a 4000x1 matrix by taking 10 and 10 numbers of the main matrix and then taking the average of these creating 1 number. How do I do this?

Subject: Averaging and reducing

From: Jos

Date: 24 Nov, 2009 11:25:22

Message: 2 of 2

"Erlend Rolseth" <erlenrol@stud.ntnu.no> wrote in message <heg9ab$j04$1@fred.mathworks.com>...
> Hey, I have a 40000x1 matrix which i want to reduce to a 4000x1 matrix by taking 10 and 10 numbers of the main matrix and then taking the average of these creating 1 number. How do I do this?

The solution shows nicely shows the power of matlab:

1) reshape your 40000-by-1 matrix into a 10-by-4000 matrix
help reshape

2) take the mean along the appropriate dimension
help mean

Tip: test the algorithm on a smaller matrix (10-by-1 -> 2-by-5)

hth
Jos

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com