
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=
2−1 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