Exercise 2: Enhanced Simulation Program (40%)
Session 11: Week 22/23: Simulating an RC
Session 11: Week 22/23: Simulating an RC
Develop a program which will "simulate" the behaviour of a simple RC circuit, in the sense of providing predictions of how the charge on the capacitor will vary over time.
The program should prompt for and read in values for the following parameters from the user:
: Resistance (in
).
: Capacitance (in F).
: Initial value of q (in C).
: The duration (in s) of one time "step".
(In practise, choose
to be a small fraction -
less than 1% say - of the circuit time constant, which
will be given by
.)
: The value of t at which the program should stop.
When the program is executed, it should print one line on the screen for each time step. Each line should show the time and the calculated value for q(t) at that time.
Exercise 2: Enhanced Simulation Program (40%)
Session 11: Week 22/23: Simulating an RC
Session 11: Week 22/23: Simulating an RC