Question: Given the following Algorithm of LAGRANGE Interpolation formula: Step 1. Start the Program Step 2. Input number of terms n Step 3. Input the array

Given the following Algorithm of LAGRANGE Interpolation formula:

Step 1. Start the Program

Step 2. Input number of terms n

Step 3. Input the array ax

Step 4. Input the array

Step 5. for i=0; i

Step 6. nr=1

Step 7. dr=1

Step8. for j=0; j

Step 9. If j != i

a. nr=nr*(x-ax[j])

b. dr= dr*(ax[i]-ax[j])

Step 10. End Loop j

Step 11. Y=(nr/dr)*ay[i]

Step 12. End Loop i

Step 13. Print Output x,y

Step 14. End of Program

Write a well commented MATLAB Program for the given Algorithm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!