Solving linear functions with matrix

3 views (last 30 days)
MR JUSTIN ACHARJEE Sumanta
Commented: Walter Roberson on 9 Dec 2021
Suppose it is known that the graph of the function 𝑦(𝑥)=𝑎𝑥3+𝑏𝑥2+𝑐𝑥+𝑑 passes through four given points (𝑥𝑖,𝑦𝑖),where 𝑖=1,2,3,4. Write a user-defined function that accepts these four points as input and computes the coefficients 𝑎, 𝑏, 𝑐, and 𝑑. The function should solve four linear equations in terms of the four unknowns a, b, c, and d. Test your function for the case where 𝑐𝑜𝑜𝑟𝑑=[−2,−20; 0,4; 2,68; 4,508] , whose answer is 𝑎=7, 𝑏=5, 𝑐=−6, and 𝑑=4. Plot the function as a solid UoP purple line and the coord points as UoP blue triangular markers with no line on the same axis. Label and format the graph.

Answers (0)

Community Treasure Hunt

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

Start Hunting!