vector - Generating decimal values in matlab -


this question has answer here:

how generate vector of lets 5 decimal values such sum 10.

for i=1:5    d(i)=rand; end 

1)i know generates vector, how include condition? 2) can generate negative numbers well?

 d = rand(5,1);  d = d * 10 / sum(d); 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -