Question

In: Mechanical Engineering

Suppose it is known that the graph of the function y = ax3 + bx2 + cx + d passes through four given points (xi, yi ),

Suppose it is known that the graph of the function y = ax3 + bx2 + cx + d passes through four given points (xi, yi ), i = 1, 2, 3, 4. Write a userdefined function that accepts these four points as input and computes the coefficients a, b, c, and d. 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 (xi , yi) = (-2, -20), (0, 4), (2, 68), and (4, 508), whose answer is a = 7, b = 5, c = -6, and d = 4.

Solutions

Expert Solution

MATLAB Script:

close all
clear
clc

x = [-2 0 2 4];
y = [-20 4 68 508];
coeffs = fit_poly(x, y);
fprintf(\'Solution:\\n\\t\')
fprintf(\'a = %.2f\\n\\tb = %.2f\\n\\tc = %.2f\\n\\td = %.2f\\n\', coeffs)

function coeffs = fit_poly(x, y)
% (x, y): 4 data points
% coeffs: [a b c d]
 
% We need to solve the system A*coeffs = y
% Where A = [x^3 x^2 x 1]
 
x = x(:); y = y(:); % Turn into column vectors
A = [x.^3 x.^2 x ones(size(x))];
coeffs = A\\y; % Solve the system using \'\\\' operator
end

 

After the test of function output is:

   a = 7.00
   b = 5.00
   c = -6.00
   d = 4.00

 


After the test of function output is:

   a = 7.00
   b = 5.00
   c = -6.00
   d = 4.00

Related Solutions

Find a cubic function y = ax3 + bx2 + cx + d whose graph has...
Find a cubic function y = ax3 + bx2 + cx + d whose graph has horizontal tangents at the points (−2, 8) and (2, 2). Find an equation of the normal line to the parabola y = x2 − 8x + 7  that is parallel to the line x − 2y = 2.
Find a polynomial of the form f(x) = ax3 + bx2 + cx + d such...
Find a polynomial of the form f(x) = ax3 + bx2 + cx + d such that f(0) = −3, f(1) = 2, f(3) = 5, and f(4) = 0. (A graphing calculator is recommended.) answer in fraction form.
Find a, b, c, and d such that the cubic function f(x) = ax3 + bx2...
Find a, b, c, and d such that the cubic function f(x) = ax3 + bx2 + cx + d satisfies the given conditions. Relative maximum: (3, 21) Relative minimum: (5, 19) Inflection point: (4, 20)
Find a, b, c, and d such that the cubic function f(x) = ax3 + bx2...
Find a, b, c, and d such that the cubic function f(x) = ax3 + bx2 + cx + d satisfies the given conditions. Relative maximum: (3, 12) Relative minimum: (5, 10) Inflection point: (4, 11) a= b= c= d=
Find a, b, c, and d such that the cubic function f(x) = ax3 + bx2...
Find a, b, c, and d such that the cubic function f(x) = ax3 + bx2 + cx + d satisfies the given conditions. Relative maximum: (3, 9) Relative minimum: (5, 7) Inflection point: (4, 8) a =    b =    c =    d =
For the following exercises, find the formula for an exponential function that passes through the two points given.
For the following exercises, find the formula for an exponential function that passes through the two points given.
Given a general cubic function y = ax^3 + bx^2 + cx + d prove the...
Given a general cubic function y = ax^3 + bx^2 + cx + d prove the following, a) That a cubic must change at a quadratic rate.          I believe this to be the derivative of the general cubic function, yielding dy/dx = 3ax^2 + 3bx + c b) That there are only 6 basic forms (shapes) for a cubic.         This question is where I get lost. Please help, Thanks!
Assume that the differences are normally distributed. Complete parts ​(a) through ​(d) below. Observation   Xi Yi...
Assume that the differences are normally distributed. Complete parts ​(a) through ​(d) below. Observation   Xi Yi 1 48.8 51.1 2 47.4 48.7 3 48.2 50.1 4 48.0 52.1 5 48.6 48.5 6 49.8 53.6 7 51.7 52.8 8 54.3 53.5 (a) Determine di = Xi−Yi for each pair of data. (Type integers or​ decimals.) di 1__ 2__ 3__ 4__ 5__ 6__ 7__ 8__ (b)Compute d overbard and sd. d overbard = __ ? sd = __? (c) Test if μd...
Assume that the differences are normally distributed. Complete parts ​(a) through ​(d) below. Observation   Xi   Yi...
Assume that the differences are normally distributed. Complete parts ​(a) through ​(d) below. Observation   Xi   Yi 1 52.0   53.4 2 54.3   53.6 3 49.5   54.1 4 44.0   48.7 5 53.9   53.2 6 50.8   52.3 7 50.9   52.6 8 51.0   53.4 ​(a) Determine di=Xi-Yi for each pair of data. Answer: Di 1 2 3 4 5 6 7 8 -1.4 0.7 -4.6 -4.7 0.7 -1.5 -1.7 -2.4 ​(b) Compute d and sd. Answer: d=-1.863 sd=2.047 ​(c) Test if μd<0 at the...
Find the center and the radius of the circle whose graph passes through points (2,5) (-4,-3) and (3,4).
Solve by using elimination. Find the center and the radius of the circle whose graph passes through points (2,5) (-4,-3) and (3,4). Use the given equation x^2 + y^2 + ax + by + c= 0
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT