Question

Question 4) Suppose that the (univariate) variable y is known to be a quadratic function of the variable x; that is, y = a x2

0 0
Add a comment Improve this question Transcribed image text
Answer #1

MATLAB Code:

close all
clear
clc

% To get the coefficients of the quadratic function,
% y = a*x^2 + b*x + c
% We need to solve the system AX = y,
% where:
% A = [x^2 x 1] and X = [a b c]

% Data points
x = (-2:1:4)';
y = [-5 -1 4 7 6 5 -1]';
A = [x.^2 x ones(size(x))];
X = A\y; % Solve the system
fprintf('Quadratic Function, y = (%.4f)*x^2 + (%.4f)*x + (%.4f)\n', X)

plot(x, y, 'o') % Plotting data points
hold on
xx = linspace(min(x), max(x), 100); % Bunch of new samples for a smoother plot
yy = X(1)*xx.^2 + X(2)*xx + X(3);
plot(xx, yy) % Plotting the quadratic curve
xlabel('x'), ylabel('y'), title('Least Squares Quadratic Fit')
legend('Data Points', 'Quadratic Fit', 'Location', 'northwest')

Output:

Quadratic Function, y = (-1.0476)*x^2 + (3.0238)*x + (4.3571)

Plot:

Least Squares Quadratic Fit Data Points Quadratic Fit Y -1 0 1 2

Add a comment
Know the answer?
Add Answer to:
Question 4) Suppose that the (univariate) variable y is known to be a quadratic function of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please answer this question with python. Write a program to solve the quadratic equation ax^2 +...

    please answer this question with python. Write a program to solve the quadratic equation ax^2 + bx + c = 0 using the standard quadratic formula x = -b plusminus Squareroot b^2 - 4ac/2a or the alternative formula x = 2c/-b Squareroot b^2 - 4ac. Your program should accept values for the coefficients a, b, and c as input and produce the two roots of the equation as output. Your program should detect when the roots are imaginary, but need...

  • A wind tunnel test conducted on an airfoil section yielded the following data between the lift...

    A wind tunnel test conducted on an airfoil section yielded the following data between the lift coefficient (CL) and the angle of attack (?): 12 1.40 16 1.71 20 1.38 de CL 0.11 0.55 0.95 You are required to develop a suitable polynomial relationship between ? and CL and fit a curve to the data points by the least-squares method using (a) hand calculations and (b) Matlab programming Hint: A quadratic equation (parabola) y(x)-aa,x +a x' can be used in...

  • QUESTION: Show= (y − y0* )(y − y1*) . .(y − yn* ) = 5 it...

    QUESTION: Show= (y − y0* )(y − y1*) . .(y − yn* ) = 5 it is Part 1 at the bottom We were unable to transcribe this image(7+17) Problem 1: Recall that the Chebyshev nodes x7, x1,...,x* are determined on the interval (-1,1] [-1, 1) as the zeros of Tn+1(x) = cos((n + 1) arccos(x)) and are given by 2j +12 X; - cos j = 0,1, ... n. n+1 2 Consider now interpolating the function f(x) = 1/(1+x2)...

  • A quadratic equation is generally represented as, ax^2 + bx + c The root(s) of the...

    A quadratic equation is generally represented as, ax^2 + bx + c The root(s) of the above quadratic equation is computed using the following formula, root1 = (-b + sqrt(D))/ 2a root2 = (-b - sqrt(D))/2a Where D is the discriminant of the quadratic equation and is computed as, D = b^2 - 4ac Given the value of D, the roots of a quadratic equation can be categorized as follows, D > 0 : Two distinct real roots D =...

  • Task 3 - Simpson's Rule (Maximum Mark 15) Find the equation the quadratic y = ax?...

    Task 3 - Simpson's Rule (Maximum Mark 15) Find the equation the quadratic y = ax? + bx + c which passes through the points AC-h, Y.), B(0,y), and C(h.yc). Use your quadratic to find an expression for the area under the quadratic between the points A and C. Explaining carefully how your result can be used to prove the general formula for Simpson's Rule. Notes: . You will need to research independently to find the formula for Simpson's Rule....

  • Question 28 Error sum of squares (ESS) is computed as o a. È(9-Y,)? ob. Ŝ(v;-P) c....

    Question 28 Error sum of squares (ESS) is computed as o a. È(9-Y,)? ob. Ŝ(v;-P) c. ][9:-x;) od. [9:-Y) O Question 30 The estimated value of Y1 is given by o a. f = B, +BX ob. 9 = bo +byx oc. 9= B. + BAX +8 od. 8,= bo +bX+8 Question 31 The adjusted R2 statistic a. is equal to the value of unadjusted R? o b.adjusts R2 for the degrees of freedom in the multiple regression model o...

  • 2.4 We have defined the simple linear regression model to be y =B1 + B2x+e. Suppose...

    2.4 We have defined the simple linear regression model to be y =B1 + B2x+e. Suppose however that we knew, for a fact, that ßı = 0. (a) What does the linear regression model look like, algebraically, if ßı = 0? (b) What does the linear regression model look like, graphically, if ßı = 0? (c) If Bi=0 the least squares "sum of squares" function becomes S(R2) = Gyi - B2x;)?. Using the data, x 1 2 3 4 5...

  • Question 3: A random variable X has a Bernoulli distribution with parameter θ є (0,1) if...

    Question 3: A random variable X has a Bernoulli distribution with parameter θ є (0,1) if X {0,1} and P(X-1)-θ. Suppose that we have nd random variables y, x, following a Bernoulli(0) distribution and observed values y1,... . Jn a) Show that EIX) θ and Var[X] θ(1-0). b) Let θ = ỹ = (yit . .-+ yn)/n. Show that θ is unbiased for θ and compute its variance. c) Let θ-(yit . . . +yn + 1)/(n + 2) (this...

  • 4. (24 marks) Suppose that the random variables Yi,..., Yn satisfy Y-B BX,+ Ei, 1-1, , n, where βο and βι are parameters, X1, ,X, are con- stants, and e1,... ,en are independent and identically distr...

    4. (24 marks) Suppose that the random variables Yi,..., Yn satisfy Y-B BX,+ Ei, 1-1, , n, where βο and βι are parameters, X1, ,X, are con- stants, and e1,... ,en are independent and identically distributed ran- dom variables with Ei ~ N (0,02), where σ2 is a third unknown pa- rameter. This is the familiar form for a simple linear regression model, where the parameters A, β, and σ2 explain the relationship between a dependent (or response) variable Y...

  • use matlab and show all codes and work the question continues from this 4. Write a...

    use matlab and show all codes and work the question continues from this 4. Write a function with header (A, V - myCone (r, h), which outputs the total area A and volume of a cone with base radius r and height h. 5. Write a function - myMatrix (myvec, m, n) which creates an m-by-n matrix A, as in Problem 3, but for arbitrary values of mand n and any length of vector myvec. Hint: the function can use...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT