Numerical Methods LAB: Lagrange Interpolation
Numerical Methods LAB: Lagrange Interpolation
Numerical Methods LAB: Lagrange Interpolation
LAB
Lagrange Interpolation
• The Solution is X =
• -0.1351
• 1.2162
• 2.2297
MATLAB Practical Problem 3 (Solution)
• x is a new variable with the following command.
• x = [-10:-1:-15; -2:3];
• x = [-10:-1:-15; -2:3];
• The Size is 2 x 6
• Solution is
-10 -11 -12 -13 -14 -15
-2 -1 0 1 2 3
Difference between clc and clear all
• clc : Clears the screen
• P[ 1, 2] = 4
Finding Errors in Code (Solution)
• P =linspace(2,3)
• P(1, 2) = 4
MATLAB Practical Problem 4
• Create a 6x6 matrix in the middle two rows, and the middle two
columns are 3's and the rest are 4's
MATLAB Practical Problem 4 Solution
• A=4*ones(6,6);
• A(:,3:4)=3;
• A(3:4,:)=3;
• disp (A)
Writing lines in MATLAB
• Type this is MATLAB
Writing lines in MATLAB (Solution)
• Type this is MATLAB
a=11;
b=pi;
X =[2 4 6 8];
Y=abs(X.*exp(a*X)-cos(b*X))