How to generate a vector of lets say 5 decimal values such that their sum is 10.
for i=1:5
d(i)=rand;
end
1)I know this generates the vector, but how to include the condition? 2) can I generate negative numbers as well?
How to generate a vector of lets say 5 decimal values such that their sum is 10.
for i=1:5
d(i)=rand;
end
1)I know this generates the vector, but how to include the condition? 2) can I generate negative numbers as well?