Numerical analysis exercises with matlab, Exercises of Matlab skills

10 exercises of numerical analysis using matlab

Typology: Exercises

2025/2026

Uploaded on 01/25/2026

mohamed-aymen
mohamed-aymen 🇩🇿

3 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Advanced MATLAB Exercises
Compiled by Mohamed Aymen
November 10, 2025
1. Polynomial Interpolation and Calculus
Given points: x= [1,2,4,5], y = [2,3,2,5]
1. Implement Lagrange interpolation to find the polynomial passing through the points.
2. Plot the polynomial and the given points.
3. Compute the area under the curve between x= 2 and x= 5 using your own
integration function.
4. Compute the slope at x= 3 using your own differentiation function.
5. (Optional) Compare results with MATLAB built-in functions.
2. LU Decomposition and Applications
Given:
A=
21 1
339
335
, b =
2
1
3
1. Perform LU decomposition with partial pivoting and return L,U,P, and number
of row swaps.
2. Use LU decomposition to compute the determinant of A.
3. Find the rank of A.
4. Compute the inverse of A.
5. Solve Ax =busing forward and backward substitution.
6. Handle the singular case (determinant = 0).
1
pf3

Partial preview of the text

Download Numerical analysis exercises with matlab and more Exercises Matlab skills in PDF only on Docsity!

Advanced MATLAB Exercises

Compiled by Mohamed Aymen

November 10, 2025

1. Polynomial Interpolation and Calculus

Given points: x = [1, 2 , 4 , 5], y = [2, 3 , 2 , 5]

  1. Implement Lagrange interpolation to find the polynomial passing through the points.
  2. Plot the polynomial and the given points.
  3. Compute the area under the curve between x = 2 and x = 5 using your own integration function.
  4. Compute the slope at x = 3 using your own differentiation function.
  5. (Optional) Compare results with MATLAB built-in functions.

2. LU Decomposition and Applications

Given:

A =

 (^) , b =

  1. Perform LU decomposition with partial pivoting and return L, U , P , and number of row swaps.
  2. Use LU decomposition to compute the determinant of A.
  3. Find the rank of A.
  4. Compute the inverse of A.
  5. Solve Ax = b using forward and backward substitution.
  6. Handle the singular case (determinant = 0).
  1. Polynomial Roots Using Newton’s Method
    1. Write a function to find a root using Newton’s method.
    2. Scan a range to find neighborhoods where roots exist.
    3. Call Newton’s method to find all distinct real roots.
    4. Plot the polynomial with markers at roots.
    5. Display all roots.
  2. Numerical Integration and Differentiation

Given f (x) = e−x^2.

  1. Approximate the definite integral between 0 and 2 using Trapezoidal and Simpson’s 1/3 rules.
  2. Approximate derivative of f (x) at x = 1 using central difference formula.
  3. Compare numerical results with analytical ones.
  4. Solving Nonlinear Systems

System: (^) ( x^2 + y^2 = 4 xey^ = 1

  1. Implement Newton–Raphson method for nonlinear systems.
  2. Find intersection points.
  3. Display iteration steps until error < tolerance.
  4. Eigenvalues and Eigenvectors (Power Method)

Given A =

  1. Implement Power Method to approximate the largest eigenvalue and corresponding eigenvector.
  2. Normalize vector at each iteration.
  3. Stop when relative error < tolerance.
  4. (Optional) Compare with MATLAB’s eig(A).