MATLAB: Generation of random numbers

generation of random numbers

Hi to all the Users, I have B = linspace(2,0,10); we have B = 2.0000 1.7778 1.5556 1.3333 1.1111 0.8889 0.6667 0.4444 0.2222 0 I want to generate random angle between 0 to 180 for each value of B in ascending order.first and last value should be 0 and 180
Thanking in anticipation

Best Answer

If I understand your Question correctly, this will do what you want:
B = [2.0000 1.7778 1.5556 1.3333 1.1111 0.8889 0.6667 0.4444 0.2222 0];
Angles = [0 sort(randi([1 179], 1, size(B,2)-2)) 180];