Write a script that prompts the user for a resistance value and tolerance then u
ID: 2080976 • Letter: W
Question
Write a script that prompts the user for a resistance value and tolerance then uses those parameters to generate and print ten random resistor values. Use the rand() function; this assumes the probability distribution is uniform. Test the script using the values 1000 and 5% tolerance.
Write a script that prompts the user for a resistance value and tolerance then uses those parameters to generate and print ten random resistor value s. Use the rando function: this assumes the probability distribution is uniform. Test the script using the values 1000 2 and 5% tolerance.Explanation / Answer
MATLAB CODE:-
clc
clear
R = input('Resistance R = ');
T = input('Tolerance in percentage T = ');
a = R-(T/100)*R;
b = R+(T/100)*R;
disp('Random values of Resistor R')
Ract = a+(b-a)*rand(10,1)
OUTPUT :-
Resistance R = 1000
Tolerance in percentage T = 5
Random values of Resistor R
Ract =
1.0e+03 *
0.9768
1.0457
0.9631
1.0210
0.9539
1.0407
1.0201
1.0042
1.0265
0.9636
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.