Bhaisaab
Bhaisaab
Harsh Sharma
23/EE/097
Jai Kumar
23/EE/111
Experiment: 1
AIM:
To find the root of a polynomial equation using bisection method THEORY:
The bisection method is a simple and effective numerical technique for finding the
roots of a continuous function. It is particularly useful when the function changes
sign over an interval, indicating the presence of a root within that interval. Below
is a detailed theory on the bisection method and how you might implement it in
MATLAB.
Steps of the Bisection Method:
1. Initial Interval Selection: Choose two points a and b such that f(a)⋅f(b)<0.
This indicates that there is at least one root in the interval [a,b] due to the
Intermediate Value Theorem.
4. Update Interval:
o If f(c)=0, then c is the root, and the method terminates. o If
f(a)⋅f(c)<0, then the root lies in the interval [a,c] Update b to c.
o If f(b)⋅f(c)<0, then the root lies in the interval [c,b] Update a to c.
5. Repeat: Repeat steps 2-4 until the interval [a,b] is sufficiently small,
meaning the difference ∣b−a∣ is less than a predefined tolerance ϵ, or the
function value at the midpoint ∣f(c)∣ is less than ϵ.
CODE:
OUTPUT:
THEORY:
The regula-falsi method, also known as the false position method, is a numerical
technique used to find the roots of a continuous function. It is similar to the
bisection method but uses linear interpolation to approximate the root, which can
often converge faster under certain conditions. Below is a detailed explanation of
the regula-falsi method and how you might implement it in MATLAB.
Steps of the Regula-Falsi Method:
1. Initial Interval Selection: Choose two points a and b such that f(a)⋅f(b)<0.
This ensures that a root exists within this interval due to the Intermediate
Value Theorem.
4. Update Interval:
o If f(c)=0, then c is the root, and the method terminates. o If
f(a)⋅f(c)<0, then the root lies in the interval [a,c] Update b to c. o If
f(b)⋅f(c)<0 then the root lies in the interval [c,b]Update a to c.
5. Repeat: Repeat steps 2-4 until the interval [a,b] is sufficiently small,
meaning the difference ∣b−a∣ is less than a predefined tolerance ϵ, or the
function value at the interpolated root ∣f(c)∣ is less than ϵ.
CODE:
OUTPUT:
xn+1=xn−(f(xn)/f′(xn) )
It converges rapidly (quadratically) when the initial guess is close to the root.
However, it requires the derivative f′(x)f'(x)f′(x), and poor initial guesses or zero
derivatives can cause failure or divergence. Despite these limitations, the method
is efficient and widely used for solving nonlinear equations.
Steps of the Newton-Raphson Method:
CODE:
OUTPUT:
yn+1=yn+1/2(k1+k2)
where k1=h f(tn,yn) and k2=h f(tn+h,yn+k1) provides more accurate results than Euler's method,
with a simple implementation, but is less accurate than higher-order methods like RK4. It strikes
a balance between accuracy and computational cost.
Steps of the Runge-Kutte order 2 Method:
CODE:
OUTPUT:
AIM:
To find the root of a polynomial equation using Runge-Kutte (order 4) method
THEORY:
The Runge-Kutta 4th order (RK4) method is a numerical technique for solving ordinary
differential equations (ODEs) with high accuracy. It approximates the solution by calculating
intermediate values using weighted averages of function evaluations at different points within
each step. The formula for updating the solution is:
yn+1=yn+1/6(k1+2k2+2k3+k4)
• K1=hf(xn,yn)
• K2=hf(xn+h/2,yn+k1/2)
• K3=hf(xn+h/2,yn+k2/2)
• K4=hf(xn+h,yn+k3)
Steps of the Runge-Kutte order 4 Method: Given
the ordinary differential equation (ODE):
dy/dx=f(x,y)
with initial conditions y(x0)=y0 and a step size h, the RK4 method involves the following steps:
(step size)
o N (number of steps)
K1=hf(xn,yn)
K2=hf(xn+h/2,yn+k1/2)
K3=hf(xn+h/2,yn+k2/2)
K4=hf(xn+h,yn+k3)
3. Update the solution: yn+1=yn+1/6(k1+2k2+2k3+k4)
4. Update the time:
Xn+1=Xn+h
5. Repeat the process for each step until the desired time is reached.
CODE:
OUTPUT:
AIM:
To find the root of a polynomial equation using Euler’s method
THEORY:
Euler's Method is a simple numerical technique for solving ordinary differential equations (ODEs)
of the form dy/dx = f(x, y) with initial condition y(x0) = y0. The method approximates the solution
by stepping forward in small increments h, using the formula:
1. Define the ODE function: Write the differential equation dy/dx = f(x, y) as an anonymous
function in MATLAB.
2. Set initial conditions: Specify the initial values for x0 , y0, the step size h, and the final
value of x (end point).
3. Initialize arrays: Create arrays to store the values of x and y at each step.
4. Apply Euler’s update formula: For each step, update y using the formula: yn+1 = yn + h f(xn,
yn)
where h is the step size and f(xn, yn)is the function evaluated at the current point.
5. Repeat the steps: Loop through the steps until reaching the final xxx-value
CODE:
OUTPUT:
AIM:
To study the series RLC circuit on Simulink SIMULINK:
Experiment : 8
AIM:
To study the series RLC circuit on Simulink SIMULINK: