Creating random error numbers within specified range.

13 次查看(过去 30 天)
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.

采纳的回答

Mathieu NOE
Mathieu NOE 2020-11-9
Example 1: Generate values from the uniform distribution on the interval (a, b).
r = a + (b-a).*rand(100,1);
  3 个评论
Mathieu NOE
Mathieu NOE 2020-11-9
well, then you shoud create two stes of random numbers , one in the -10 to -1 range and the second in the 1 to 10 range and merge the two vectors in one

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by