Answered step by step
Verified Expert Solution
Question
1 Approved Answer
function c 1 x + c 2 , set up an overdetermined sys - tem V c = T . The coefficient matrix V can
function set up an overdetermined sys
tem The coefficient matrix can be
generated in MATLAB by setting
ones
or alternatively, by setting
vander;;:
Note For any vector dots,
the MATLAB command vanderx generates
a full Vandermonde matrix of the form
cdots,cdots,cdots,
For a linear fit, only the last two columns of
the full Vandermonde matrix are used. More
information on the vander function can be
obtained by typing help vander. Once
has been constructed, the least squares solu
tion of the system can be calculated using the
MATLAB operation.
b To see how well the linear function fits the data,
define a range of pressure values by setting
::;
The corresponding function values can be de
termined by setting
polyval;
We can plot the function and the data points with
the command
c Let us now try to obtain a better fit by us
ing a cubic polynomial approximation. Again
we can calculate the coefficients of the cubic
polynomial
that gives the best least squares fit to the data
by finding the least squares solution of an over
determined system The coefficient
matrix is determined by taking the last four
columns of the matrix vanderp To see
the results graphically, again set
polyral
and plot the cubic function and data points, us
ing the same plot command as before. Where do
you get the better fit, at the top or bottom of the
atmosphere?
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