Calculate median at every interval

1 次查看(过去 30 天)
IMC
IMC 2021-7-15
My data comprises of 2 variables X (25x1) and Y(25x1). I want to calculate X median at each interval of Y and then plot it. Kindly suggest me how to perform this task? Thank you.
X = [16.01, 19.23, 18.47, 4.84, 35, 27.75, 21.4, 33.6, 38.77, 35.26, 34.28, 16.01, 32.93, 12.65, 47.14, 47.42, 15.68, 31.88, 23.6, 29.3, 27.75, 27.91, 30.1, 29.3]
Y = [-2.12, -13.41, -30.29, -23.64, -10.11, -17.22, 13, 10, -2.12, 11, -4.65, -34.12, -12.11, 10, 14, -23.64, -13.41, -50.53, -64.12, -17.22, -2.12, 13, 17, -21.99, -9.78]

回答(1 个)

Cris LaPierre
Cris LaPierre 2021-7-15
Consider using either movmean or movmedian. The result will be the same when you are looking at pairs of numbers.

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by