Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

7. The graph of the function f(x)-a x\' +b-x\'+c-x\'+d-x +e, passes through the

ID: 3282487 • Letter: 7

Question

7. The graph of the function f(x)-a x' +b-x'+c-x'+d-x +e, passes through the points (-3,6.8), (-1.5, 15.2), (0.5, 14.5), (2, -21.2), and (5, 10). Write a script that will prompt for the ordered pairs as inputs and solve five equations with the five unknown constants: a, b, c, d, and e. You need to set up a matrix equation and solve for the unknowns by first finding the inverse of a matrix. y2 y3 Y4 il.lcl, solve the system: ?-r.h,for h. pairl input( 'Enter the first ordered pair as a vector la, b :'

Explanation / Answer

disp('enter coordinates of 5 points')
x1=input('enter x1');
y1=input('enter y1');
x2=input('enter x2');
y2=input('enter y2');
x3=input('enter x3');
y3=input('enter y3');
x4=input('enter x4');
y4=input('enter y4');
x5=input('enter x5');
y5=input('enter y5');

X=coeff(x1, x2, x3, x4, x5, y1, y2, y3, y4, y5)

function X=coeff(x1 ,x2 ,x3 ,x4 ,x5 ,y1 ,y2 ,y3 ,y4 ,y5)

P= [x1; x2; x3; x4; x5]

A=[P.^4 P.^3 P.^2 P.^1 P.^0]

Y=[y1 ; y2; y3; y4; y5]

X=inv(A)*Y
end

When above script is used with the data given , we obtain

0.4000
-0.2000
-8.0000
-7.0000
20.0000

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote