Mean averaging separate rows using a certain section of each row.

1 次查看(过去 30 天)
I need to taken a mean average of a certain section of a row of a vector - and I need to do that for every row - giving each row's mean average.
What I have is a <300000x17> vector and when the 17 rows are plotted separately they all level off at there own approximate value - maybe by about 40% along the x-axis. Right at the very right hand edge the values seem to do a weird peak so I want to avoid the very end too.
At the end of this I'd hopefully be left with 17 values only.
Any help would be much appreciated as always!
  1 个评论
Matt Fig
Matt Fig 2012-11-2
I need to taken a mean average of a certain section of a row of a vector - and I need to do that for every row - giving each row's mean average.
What I have is a 300000x17 vector and when the 17 rows are plotted separately they all level off at there own approximate value - maybe by about 40% along the x-axis. Right at the very right hand edge the values seem to do a weird peak so I want to avoid the very end too.
At the end of this I'd hopefully be left with 17 values only.
Any help would be much appreciated as always!

请先登录,再进行评论。

采纳的回答

Honglei Chen
Honglei Chen 2012-5-24
Hi Tom, your example has 17 columns, not 17 rows. I'll assume you mean a 17x300000 matrix. It's not clear if the region for every row is the same, but I'll assume you want to take first 40% of each row, i.e., 120000 points. You can do the following:
mu = mean(x(:,1:120000),2)
This should be a good starting point.
  3 个评论
Honglei Chen
Honglei Chen 2012-5-25
Then you just need to switch the dimensions
mu = mean(x(1:120000,:),1)
You actually don't need that 1 in the end as the first dimension is the default dimension. I included it anyway to show the parallelism among the syntax.
Tom
Tom 2012-5-26
That's great thanks Honlgei - I got it working well in the end. :)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by