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 CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by