Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Physical Analysis
We begin with acknowledging the current through the resistor drops the voltage can be
exemplified by: VR = iR, where VR is in voltage drop, i is current (in amperes), and R is
resistance (in ohms). The inductor also resists the change in current and has the expression of:
VL = L(dl/dt), where L is inductance (in henrys). VL represents the voltage drop across it.
Additionally, the voltage drops across the capacitor can be represented by: VC= q/C, where q is
the charge (in coulombs) and C is the capacitance (in farad). Following Kirchhoff’s second law, a
closed circuit has the sum of all the voltage drops are zero and can be written by:
(1) L(di/dt) + Ri + q/C = 0
We can manipulate this equation to get a second-order linear ordinary differential equation:
(2)
The solution to equation (1) that satisfies the initial conditions:
is (see appendix):
(3)
This solution can be rewritten as [1]:
(4).
Numerical Analysis
A pseudocode for the bisection method is:
start
input a, b, delta, eps
if f(a)*f(b)<0
else input new a, b
endif
c = (a+b)/2
if f(a)*f(c)<0
b=c
else
a=c
endif
endif
display c
end
A flowchart for the Newton-Raphson method is:
Results
The circuit we are studying has the following initial conditions: L = 5H, C = 10-4F. We will use
an accuracy of 0.001. The Bisection Method produced a root of 328.125. In the Newton-Raphson
Method, it found the value of 328.151. The Secant Method was slightly off with computing the
value of 328.155. The Newton-Raphson Method gave the closest value to the value found using a
graphing calculator.
Conclusion
In this paper, we looked for the resistance of a given RLC circuit. The resistance was found as
the root of a function derived by applying Kirchhoff’s second law. The root finding methods used
were bisection, Newton-Raphson, and secant. Depending on the resources available, it is
important to study the type of root-finding methods in C++. In this case, we saw that the
Newton-Raphson Method held true over the Bisection and Secants Methods.
References
[1] Dr. Corina S. Drapaca, ESC 261M: Computational Methods for Engineers, Lecture 1 & 5.
Canvas, web. January, 2018.
Appendix
Code for Newton-Raphson Method:
#include<iostream>
#include<cmath>
using namespace std;
return b;
}
int main()
{
double x,x1,e,fx,fx1;
cout.precision(3);
cout.setf(ios::fixed);
cout<<"Enter the initial guess\n";
cin>>x1;
cout<<"Enter desired accuracy\n";
cin>>e;
fx=f(x);
fx1=fprime(x);
// cout <<"x{i}"<<" "<<"x{i+1}"<<" "<<"|x{i+1}-x{i}|"<<endl;
do
{
x=x1;
fx=f(x);
fx1=fprime(x);
x1=x-(fx/fx1);
cout<<x<<" "<<x1<<" "<<abs(x1-x)<<endl;
}while (fabs(x1-x)>=e);
cout<<"The root of the equation is "<<x1<<endl;
return 0;
}