Root of cubic polynomial

The question is this:
By modifying the appropriate lines in your script file, find the values of a, b, c, and d so that the cubic polynomial  y = ax3 + bx2 + cx + d  passes through the (x, y) pairs (-2, 3), (-1, 7), (0, -2), and (1, 4).
Note that to check your answer you can plot the given points together with your cubic polynomial on the same graph, and check to see that all 4 points lie on the curve (as in the tutorial file). Note that you will likely have to modify the t vector so that it corresponds with the range of x-values above.
I try several times but I still couldn't get the answer.Please help.
Thank you very much.

1 Comment

This sounds like homework. You should post your attempts at solving it.

Sign in to comment.

Answers (1)

x=[-2 -1 0 1]';
y=[3 7 -2 4]';
[x.^3 x.^2 x ones(4,1)]\y

Categories

Asked:

on 6 Oct 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!