필터 지우기
필터 지우기

Creating random error numbers within specified range.

조회 수: 4 (최근 30일)
Mr.Chandler
Mr.Chandler 2020년 11월 9일
댓글: Mr.Chandler 2020년 11월 9일
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
Mr.Chandler
Mr.Chandler 2020년 11월 9일
Yes, I tried that way and it works. Thanks so much.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by