Calculate median at every interval

2 visualizzazioni (ultimi 30 giorni)
IMC
IMC il 15 Lug 2021
Risposto: Cris LaPierre il 15 Lug 2021
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]

Risposte (1)

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

Categorie

Scopri di più su Data Preprocessing in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by