hi . i have n observation z1 , z2, z3 , ...... zn that is numerical value and not ordered . i need partion it to interval as following
조회 수: 1 (최근 30일)
이전 댓글 표시
z1,z2,...,zn % known data
a=min(z)
b=max(z)
k =3.322*log(n) %such that k number of interval
L= (max(z)-min(z))/k %such that L is length of each interval
i need the program display interval as following
u1=(a,a+L)
u2=(a+L,a+2*L)
.
.
.
uend=( a+end*L,b)
댓글 수: 0
채택된 답변
Image Analyst
2016년 8월 14일
Another way is to use linspace():
n = 50;
z = 1000 * rand(1, n); % Sample data
a=min(z)
b=max(z)
k =3.322*log(n) % such that k is the number of intervals
L= (max(z)-min(z))/k %such that L is length of each interval
% Here is my solution:
intK = round(k)
uMatrix = [linspace(a, b-L, intK)', linspace(a+L, b, intK)']
댓글 수: 2
Image Analyst
2016년 8월 15일
The average what ? The average interval length is L. What else is there to take the average of ?
추가 답변 (1개)
Azzi Abdelmalek
2016년 8월 14일
편집: Azzi Abdelmalek
2016년 8월 14일
Edit
a=min(z)
b=max(z)
k =3.322*log(n) %such that k number of interval
L= (max(z)-min(z))/k
m=fix((b-a)/L)
out=[cell2mat(arrayfun(@(x) [a+x*L,a+(x+1)*L],(0:m-1)','un',0));a+m*L,b]
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!