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

1 vue (au cours des 30 derniers jours)
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*

Réponse acceptée

Matz Johansson Bergström
Matz Johansson Bergström le 26 Juil 2014
Modifié(e) : Matz Johansson Bergström le 26 Juil 2014
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)

Plus de réponses (0)

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by