Consider the following circuit;
The step response of this circuit may be expressed as follows;
where t=time (in seconds)
Write a function to calculate and return the value of Vout when given; the input voltage, the resistor values, capacitor value and time.
#include<math.h>
double circuit(double vin, double r1, double r2, double c, double t) {
double r1_r2 = r1 + r2;
return vin * r2 / (r1_r2) * (1 - exp(-t * (r1_r2 / (c * r1 * r2))));
}
–EOF (The Ultimate Computing & Technology Blog) —
Last Post: How to Ban and Make a User Unlike Your Facebook Page?
Next Post: Algorithm to Compute the Pascal Triangle's values
