Weighted Average of Data with Irregular Range and Missing Data

조회 수: 1 (최근 30일)
Melissa
Melissa 2015년 1월 12일
댓글: Melissa 2015년 1월 28일
Hello,
I have a 555x5 matrix
A = [Lat Lon Bm Lower Upper]
Bm represents biomass data. Lower and Upper represent the lower and upper boundaries of the depths (cm) from which the data was procured. This data is in situ. I want to be able to compare this data to a model output of depth of 5cm, 25cm, and 75cm
I want to take the weighted average of the depth interval relative to the depth of comparison.
Therefore, for each latxlon, I want to create a code that will look at the Lower and Upper depth boundaries and weigh the Bm with respect to the 5, 25, and 75cm depths so that it will represent the biomass AT THAT VALUE of 5cm.
I have attached the data so you can have a better idea of what I'm working with I have no idea how I should approach this, so any help would be greatly appreciated!
Thank you,
Melissa
  댓글 수: 2
Guillaume
Guillaume 2015년 1월 12일
Can you give more details on what you want to obtain? For example, given the first line of your matrix
-77.63 162.87 0.66 0 10
what Bm should result?
Also, the maximum depth in your matrix is 30, so where does the 75 cm depth figures?
Melissa
Melissa 2015년 1월 28일
Hi Guillaume,
I'm looking to calculate the coefficient for each datapoint that correlates to the weight of the datapoint within depth intervals.
I want to split up my data into two different weighted depths: one at 5cm, and one at 25 cm. For the 5cm, I want to contain all weighted datapoints between 0 and 15cm For the 25cm, I want to contain all weighted datapoints between 15cm and 30cm
With the coefficient for each datapoint, I can calculate the weight of the measurement within the two separate intervals I need
EX:
-77.63 162.87 0.66 0 10 -> COEFF = 1.0
-37.78 175.32 61.967 0 20 -> COEFF = 0.75
The first line's coefficient is 1 because 100% of the measurement is contained within the interval of 0 and 15cm The second line's coefficient is 0.75 because only 75% of the measurement is contained within the interval of 0 and 15cm
This example only shows what I would like to have for my 5cm comparison, but I would also like to do the same for the 30cm comparison with the intervals between 15 and 30cm.
After I have those coefficients, I would like to get the weighted average by multiplying the coefficient with the biomass measurement, and then create two new matrix that contains latitude, longitude, and biomass (555x3), one for the 5cm depth, and one for the 25cm depth.
But for the most part, I am having trouble trying to come up with a loop or code that will accomplish the coefficient calculation. The rest is pretty straightforward I feel.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Map Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by