Answered step by step
Verified Expert Solution
Link Copied!

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 c1x+c2, set up an overdetermined sys-
tem Vc=T. The coefficient matrix V can be
generated in MATLAB by setting
V=[p, ones (10,1)]
or, alternatively, by setting
A=vander(p);,V=A(;,9:10)
Note For any vector x=(x1,x2,dots,xn+1)T,
the MATLAB command vander(x) generates
a full Vandermonde matrix of the form
([x1n,x1n-1,cdots,x1,1],[x2n,x2n-1,cdots,x2,1],[vdots,],[xn+1n,xn+1n-1,cdots,xn+1,1])
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 V
has been constructed, the least squares solu-
tion c 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
q=1:0.1:10;
The corresponding function values can be de-
termined by setting
z=polyval(c,q);
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
c1x3+c2x2+c3x+c4
that gives the best least squares fit to the data
by finding the least squares solution of an over-
determined system Vc=T. The coefficient
matrix V is determined by taking the last four
columns of the matrix A= vander(p). To see
the results graphically, again set
z=polyral(c,q)
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?
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions

Question

Compare and contrast skills, knowledge, and interests.

Answered: 1 week ago