This repository contains the MATLAB implementations for Problem Set 3 as part of the EEE 212 course curriculum. The primary focus of this problem set is finding the roots of non-linear equations (algebraic, polynomial, and transcendental) using the Regula Falsi (False Position) Method.
Each script is designed to:
-
Visualize the Function: Plots the equation using
fplotwith formatted intersecting axes at the origin to inspect roots visually. -
Automated Bracketing: Dynamically scans a specified range to find a suitable interval
$[x_n, x_p]$ where a sign change occurs ($f(x_n) \cdot f(x_p) < 0$ ), ignoring any complex or imaginary outputs. -
Iterative Root-Finding: Executes the Regula Falsi formula up to a defined tolerance (e.g.,
$10^{-6}$ ) or maximum iteration cap:$$x_i = \frac{x_p \cdot f(x_n) - x_n \cdot f(x_p)}{f(x_n) - f(x_p)}$$ -
Verification: Validates numerical findings against built-in MATLAB root solvers (
rootsfor polynomials orvpasolvefor transcendental equations).
The repository includes scripts handling different mathematical functions to demonstrate the versatility and limitations of the False Position method:
| Source Script / Problem | Function Type | Target Equation |
Built-in Verification |
|---|---|---|---|
| Problem 1 | Cubic Polynomial | roots() |
|
| Problem 2 | Higher-order Polynomial | roots() |
|
| Problem 3 | Transcendental (Trig) |
|
vpasolve() |
| Problem 4 | Quintic Polynomial | roots() |
|
| Problem 5 | Logarithmic | vpasolve() |
|
| Problem 6 | Exponential / Linear Mix | vpasolve() |
-
Asymptote & Domain Protection: Problem 3 uses a specialized localized scanning window (
$\frac{\pi}{2} + 0.01$ to$\frac{3\pi}{2} - 0.01$ ) to find non-trivial roots while strictly avoiding the vertical asymptotes of$\tan(x)$ . -
Precision Tuning: Variable calculations utilize
format longfor 15+ decimal point precision. -
Informative Workspace Cleanups: Standardized clean initializations (
clc,clear all,close all) ensure an isolated testing state every run. - Convergence Logs: Outputs total iterations and the final bounds of the bracket containing the root.
- Clone this repository to your local machine:
git clone [https://github.com/shadid-bhai/eee-212-lab-problem-set-3.git](https://github.com/shadid-bhai/eee-212-lab-problem-set-3.git)