Using a for-end loop, write a program that finds the voltage (V) measured across
ID: 3807022 • Letter: U
Question
Using a for-end loop, write a program that finds the voltage (V) measured across a resistor of resistance (R) when a variable current (i) is applied to the resistor. Use values of time ranging from 0 to 200 seconds in increments of 1 second. However, the loop should stop when the voltage exceeds 4 Volts. Output the final value of the resistance and the time at which this value occurs. The current is a function of time, given by the following equation, i(t) = .02t^2 - .3t where i is measured in Amperes and t is measured in seconds. The voltage across the resistor is given by Ohm's Law, V = iR. The resistor has a constant value of R = 150 Ohm.Explanation / Answer
t=0;
R=150;
for t=0:200
i=0.02*t^2 - 0.3*t;
v=i*R;
if(v>4)
break;
end
end
time=t
finalvalueofresistance=v/i
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.