how to create new cumulative frequency array from two existing arrays
2 views (last 30 days)
Show older comments
I would like to make an array from logic between two other arrays
So for code below when i want to make an array using a while loop for when logic Y <= v is fulfilled then new array being created will give me cumulative frequency.
for example:
Y= [ 5 5 3 4 5]
v = [ 4 3 3 4 6]
for Y <= X new array should be:
CumFreq = [ 0 0 1 2 3]
so frequency keeps compounding.
below are the two arrays i am trying to perform while loop on with Y<=v
mu = 50
sigma = 10
Y = normrnd(mu, sigma, 1,1000);
v = linspace(1,1000, 1000);
0 Comments
Answers (1)
David Goodmanson
on 29 Apr 2021
Hi BW,
mu = 50
sigma = 10
Y = normrnd(mu, sigma, 1,1000);
v = linspace(1,1000, 1000);
a = cumsum(Y<=v)
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!