How can I generate the Radom number between two set of floating point number?

조회 수: 2 (최근 30일)
I have number such that
Gain = 0.0000250002787160545;
Bias =-0.124315307973192;
Now, I want to generate the 160 number of gain and bias within +-9% uncertanity.
such that
Gain = 0.0000250002787160545+-9% ;
Bias =-0.124315307973192+-9% ;
Total number of gain should be 160 and bias should be 160.
How can I do this? Would you please suggest me?

채택된 답변

Jan
Jan 2023년 1월 17일
편집: Jan 2023년 1월 17일
Gain0 = 0.0000250002787160545;
Bias0 = -0.124315307973192;
Gain = Gain0 + Gain0 * 0.18 * (rand(1, 160) - 0.5);
Bias = Bias0 + Bias0 * 0.18 * (rand(1, 160) - 0.5);
mean(Gain) - Gain0 % Of course this differs from 0:
ans = 1.1225e-07
min(Gain - Gain0) / Gain0 % Less than 9%:
ans = -0.0890
max(Gain - Gain0) / Gain0
ans = 0.0871

추가 답변 (1개)

Meghraj Kc
Meghraj Kc 2023년 1월 17일
You have multiplied with 0.18, Is this because of 9%?
If it is 7% then, we need to multiply by 0.14?

카테고리

Help CenterFile Exchange에서 Electromechanical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by