how to distribute probability randomly for generating test data in matlab?


This question already has an answer here:


You can just divide the vector by the sum of it's elements. For example, for a vector of length 4 you can do:

>> v = rand(4, 1);
>> v = v/sum(v)

v = 

>> sum(v)

ans = 


Note, I am assuming you want uniformly distributed numbers, since you don't state what distribution you want in the question.

Depending on how random you need to be, Roger Stafford takes a more stringent approach.

Need Your Help

Getting time frequency of number in array in Python?

python arrays matlab numpy

Let's say I have a time series represented in a numpy array, where every 3 seconds, I get a data point. It looks something like this (but with many more data points):

Zurb for apps fixed menu footer

ruby-on-rails haml zurb-foundation-apps

I am using the following code to try and achieve a fix menu bar at the bottom of our web app like you would commonly see in a standard iOS app. The only problem is that when the content extends the