Answered step by step
Verified Expert Solution
Question
1 Approved Answer
% The same data is used for the activity. These are provided for you. X = [ - 2 - 1 1 2 ] .
The same data is used for the activity. These are provided for you.
X
Y
Use the length command to determine the size of the column vector X Store this value in m
Set up the appropriate matrix A to find the bestfit parabola of the form yCDxEx The
first column of A will contain all s using the ones command. The second column of A
contains x values that are stored in X The third column of A contains the squared x values
that are stored in X Elementwise multiplication of X by itself, using operator, will
produce the desired values for the third column.
Calculate the matrix products. These are provided for you.
AtransposeA A A
AtransposeY A Y
Use the backslash operation to solve the overdetermined system. Store this in Soln
Define the x values to use for plotting the bestfit parabola. This creates a vector x
This is provided for you.
x: :
Define the bestfit parabola, storing it in yquadratic. Elementwise multiplication of the
x values times themselves to square them is achieved by using operator because x is a vector
The following sequence of commands plots the data and the bestfit parabola. The command is
provided for you.
plotx yquadratic, X Yk;grid;shg
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started