Help needed with finding an average delta value in my dataset

2 ビュー (過去 30 日間)
Uma Dixit
Uma Dixit 2020 年 2 月 28 日
回答済み: darova 2020 年 2 月 29 日
Hello,
I have a 1x200 array called "Datapoints". What I am wanting to do is take the 10 highest points and the 10 lowest points and subtract them from each other so I can get an array of 10 delta values. I know I can utilize the "diff" function for this.
I am using findpeaks(Datapoints) to get the peaks in the dataset, however when taking the negative of the dataset to find the troughs (findpeaks(-Datapoints)), it is not finding the lowest points.
Is there an easier way to do this? Please help.

採用された回答

darova
darova 2020 年 2 月 29 日
I'd just use sort for this purpose
data1 = sort(data);
highest = data(end-9:end));
lowest = data(1:10);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by