How can I predict the value of the coefficients?

์กฐํšŒ ์ˆ˜: 1 (์ตœ๊ทผ 30์ผ)
Atony Garcia
Atony Garcia 2020๋…„ 6์›” 26์ผ
ํŽธ์ง‘: Image Analyst 2020๋…„ 6์›” 28์ผ
So I have this polynomial equation ๐‘(๐‘ฅ) = ๐‘Ž + ๐‘Ž1๐‘ฅ + ๐‘Ž2๐‘ฅ^2 + ๐‘Ž3๐‘ฅ^3 and it is cero when x = -2,1,3,4 and I need to answer with the values of the coefficients and proving that the answer is correct
I have tried this code but I am not sure if it is the right one:
p= [a a a a]
h =polyval([4 3 1 -2],0)
Thank you

๋‹ต๋ณ€ (2๊ฐœ)

Walter Roberson
Walter Roberson 2020๋…„ 6์›” 26์ผ
Use polyfit() to compute p; the corresponding y would be 0.
You will probably think that the answer you get back from polyfit is incorrect, but it is correct under the condition that your cubic polynomial is zero at all four points x = -2,1,3,4
  ๋Œ“๊ธ€ ์ˆ˜: 3
Walter Roberson
Walter Roberson 2020๋…„ 6์›” 28์ผ
what is your code and what is the error?. your x is [-2,1,3,4] and your y is all zeros.
Atony Garcia
Atony Garcia 2020๋…„ 6์›” 28์ผ
Its the code I posted above in the first question

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.


Image Analyst
Image Analyst 2020๋…„ 6์›” 28์ผ
ํŽธ์ง‘: Image Analyst 2020๋…„ 6์›” 28์ผ
If you already know A, try roots with your given a vector.
x = roots([a(4), a(3), a(2), a(1)])
You should find x is [-2,1,3,4] if what it said was true.
You could also compute a Lagrange interpolating polynomial
y = (x- -2)*(x-1)*(x-3)*(x-4)
then multiply that out to find out the coefficients. Note that if you have x=0 at 4 locations, you can't do that with a cubic - you need a 4th order equation.

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Polynomials์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

Community Treasure Hunt

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

Start Hunting!

Translated by