Using a for -end loop, write a program that finds the voltage (V) measured acros
ID: 2084553 • 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 40 Volts. Output the final value of the voltage 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.Explanation / Answer
clc
t=0;
R=150;
for t=0:200
i=0.02*t^2-0.3*t;
V=i*R;
if(V>40)
break;
end
end
timeatwhichvalueoccurs=t
finalvalueofthevoltage=V
results
timeatwhichvalueoccurs =
16
finalvalueofthevoltage =
48.0000
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.