ASSIGNMENT
National Institute of Technology, Srinagar
Date:
Topic: MATLAB Codes for Numerical Methods
Submitted By: Arzoo Angral (2022BMEC026)
Piyush Kumar (2022BMEC016)
Anshul Jain (2022BMEC092)
Submitted To: Dr. Azher Jameel
INDEX
S. No Content Page No File
1. Bisection Method 1
2. False Position Method 2
3. Fixed Point Iteration Method 3
4. Newton Raphson Method 4
5. Secant Method 5
6. Gauss-Elimination Method 6
7. Gauss-Jordan Method 7
8. LU -Decomposition Method 8
9. Gauss-Siedel method 9
1. Bisection Method
Example: f (𝑥) = 𝑥 3 − 𝑥 2 + 1 where our initial values are [-1,1] should be correct up to 3
decimal places and let’s take maximum number of iterations be 6.
Solution:
2. False Position Method (Regula-Falsi
Method)
Example: f (𝑥) = 𝑥 3 − 2𝑥 − 5 where our initial values are [2,3] should be correct up to 3
decimal places, accuracy of 0.02% and let’s take maximum number of iterations be 10.
3. Fixed Point Iteration Method
Example: f (𝑥) = 𝑥 3 + 2𝑥 2 − 1 where our initial guess is 1 should be correct up to 3 decimal
places, accuracy of 𝜖𝑎 < 0.001 and let’s take maximum number of iterations be 10.
Solution:
4. Newton-Raphson Method
𝑥 𝜋
Example: f (𝑥) = sin 𝑥 − 2 ,where our initial guess is 2 should be correct up to 3 decimal places,
accuracy of up to 10−4 and let’s take maximum number of iterations be 10.
Solution:
5. Secant Method
Example: f (𝑥) = 𝑒 −𝑥 − 𝑥 ,where our initial guesses are 0 and 1 should be correct up to 3
decimal places, accuracy of up to 10−4 and let’s take maximum number of iterations be 10.
Solution:
6. Gauss Elimination Method
Example: Solve the system using Gauss elimination:
Solution:
7. Gauss-Jordan Method
Example:
Solution:
8. LU Decomposition Method
Example:
Solution:
9. Gauss – Siedel Method
Example:
Solution: