Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a ) Write a function readData which will read in a file called CTEvsT. x 1 s x and will create ( and return )

a) Write a function readData which will read in a file called CTEvsT. x1sx and will create (and return) two
vectors, one called T(which corresponds to x above) and one vector called CTE (which corresponds to the
vector f above. Print the vector T and CTE to the command line.
b) Write another function call fitQuadraticFtn. This function will take in the T and CTE vectors of data,
will set up the A matrix, the f vector and solve for the coefficient vector c. It can be shown that the equation
for finding c is given as follows:
c=(ATA)-1(ATf) where c=[c1c2c3] are the coefficients of the quadratic function that
best fit the data given. This is called a least-squares solution and was developed by Gauss.
The function fitQuadraticFtn will return the vector of coefficients c1,c2 and c3. Print these out to the
command line.
c) Write a function plotQuadraticFit which takes in the original data points (T and CTE vectors) along with
the coefficient vector c and creates a plot which shows the original data (plotted as symbols such as x's) and
the smooth curve fit. Use 100 pts to create the smooth plot of the quadratic fit. The final results should look
like Figure 2. Display the plot.
Hint: My main program looks like the following. This tells you the function signatures and general structure
of the solution
CTE vs T Data
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

Step: 3

blur-text-image

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

ISBN: 3319234609, 978-3319234601

More Books

Students also viewed these Databases questions