How to create a cumulative frequency array
조회 수: 14 (최근 30일)
이전 댓글 표시
I am trying to create an array to compute the cumulative frequency of array Z, which are less than or equal to the time in minutes specified by the minutes array, V.
X1= sqrt(rand(1,1000));
X2= normrnd(20,5, 1,1000);
w= rand(1,1000);
X3 = (-log(1- w));
sz = [1 1000];
X4 = unifrnd(4,15, sz);
Z=X1+X2+X3+X4; %(note: Z is an array with 1000 values in one row)
V = linspace(1, 1000, 1000); %array V
댓글 수: 0
채택된 답변
Jeff Miller
2021년 4월 28일
This is inelegant, but it works:
cumFreq = zeros(size(V));
for i=1:numel(V)
cumFreq(i) = sum(Z<V(i));
end
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Windows에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!