I\'m practicing leanear interpolation using Lagrange polynomial. I used MATLAB t
ID: 1868179 • Letter: I
Question
I'm practicing leanear interpolation using Lagrange polynomial.
I used MATLAB to perform it but I failed.
I don't understand why the result of 'l' has infs and NaNs.
The MATLAB code I made is attached below.
How can I modify the code to get the result?
71 -Untitled : | Untitled" x ???? AT 411 385 TxTI double N=1 ength(x) ; 1x11 double TxT double 1x23987 daube x1 doubve lor 1-1:N P 1 for k=1:N vy 13 end I0:0.05 1199 16 1.08-04 0.000D 0.0000 0.0000 0.0000 0.COOD 0.0000 0.000 0. 0001 0.0033 0.1162 In Ini n Nal Nall Na N Na Na Na NaNExplanation / Answer
It seems you are getting infinite value in return, that's why you are getting Inf error and NaN error means 0/0, which can not be solved in MATLAB. Try to use larger positive value for your program.
Consideriing that you are just practicing langrange interpolation, why dont you directly use ' lagrangepoly ' function in matlab.
Example:
You can modify value of x and y in this code as per your condition.