Skip to content

shadid-bhai/EEE-212-lab-3-problem-set

Repository files navigation

EEE-212-lab-3-problem-set

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.

🚀 Overview

Each script is designed to:

  1. Visualize the Function: Plots the equation using fplot with formatted intersecting axes at the origin to inspect roots visually.
  2. 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.
  3. 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)}$$
  4. Verification: Validates numerical findings against built-in MATLAB root solvers (roots for polynomials or vpasolve for transcendental equations).

📂 Problem Set Breakdown

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 $f(x)$ Built-in Verification
Problem 1 Cubic Polynomial $x^3 - 2x + 2 = 0$ roots()
Problem 2 Higher-order Polynomial $x^3 - 6x^2 + 11x - 6 = 0$ roots()
Problem 3 Transcendental (Trig) $\tan(x) - x = 0$ (Asymptote protected) vpasolve()
Problem 4 Quintic Polynomial $x^5 - x + 0.2 = 0$ roots()
Problem 5 Logarithmic $\ln(x) + \log_{10}(x) - 2 = 0$ vpasolve()
Problem 6 Exponential / Linear Mix $2^x - 5x + 2 = 0$ vpasolve()

🛠️ Features Implemented

  • 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 long for 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.

💻 How to Run

  1. 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)

About

MATLAB implementations for EEE 212: Numerical Analysis Lab (Problem Set 3). Focuses on solving algebraic, polynomial, and transcendental equations using the Regula Falsi (False Position) method with dynamic bracketing.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages