Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote