MATLAB: Creating random error numbers within specified range.

errormathematicsMATLABplottingrandom

Here is a table which length is 100cm. I have to measure it 100 times 1000 times and 1 million times. In each calculation there should be random error in + or -. And errror should be between 1mm and 10mm. And I have to create plots of 100times 1000times and 1 million times. How can I write that code? Our teacher recommended "randn". However, I can't create numbers between (+ -) 1 and 10.

Best Answer

Example 1: Generate values from the uniform distribution on the interval (a, b).
r = a + (b-a).*rand(100,1);