How can I determine or formulate certain intervals from a given set of data.

1 回表示 (過去 30 日間)
Assuming that I have the following data.
0.110064
0.120277
8.957109
-------
-------
8.957806
-------
-------
50.69346
50.6958
50.69846
-------
-------
up to n
I want to have about 20 groups of intervals such as,
interval(1)= 0.110064 to 0.310064
interval(2)= 0.310064 to 0.510064
-------------------------
-------------------------
interval(n)= a to b
interval(n+1)= c to d
where a, b, c, d are any values within the data. Please note a<b<c<d
At the end, I want to have something like this (where the first number is extracted from the lower range of the first interval , followed by its upper range (as the second number); and the third number being the upper range of the second interval etc), as shown below.
IntervalRange(1)= 0.110064
IntervalRange(2)= 0.310064
IntervalRange(3)= 0.510064
-------------------------
-------------------------
IntervalRange(k)= n
IntervalRange(k+1)= n+1
In fact the output should only be like the one below;
*0.110064
0.310064
0.510064
n
n+1
Thank you*

採用された回答

Matz Johansson Bergström
Matz Johansson Bergström 2014 年 7 月 26 日
編集済み: Matz Johansson Bergström 2014 年 7 月 26 日
If I understand it correctly, you want something like this?
%mock data, increasing numbers
data = 50*rand(50,1);
data = sort(data);
%The intervals
iv = linspace(data(1), data(end), 20)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by