|
|
CS-381 -- Lab 3: Least Squares Interpolation
Fall Quarter 1999
Electrical Engineering and Computer Science Department
Dr. Christopher C. Taylor
S-331, 277-7339
www.msoe.edu/~taylor/
Purpose
The purpose of this lab assignment is to use the Matrix class from
lab 2 to explore least squares polynomial curve
fitting.
Assignment
In this lab, you are to do the following:
- Design and implement a method for obtaining the best fit (in the
least squares sense) polynomial curve to a set of data.
- You should reuse the Matrix class where appropriate.
- Input should be accepted from a data file with the following format:
5
300 0.024
400 0.035
500 0.046
600 0.058
700 0.067
where the first line indicates the number of x,y pairs and
each additional line specifies an x,y pair.
- The program should output (to the console or to a file) the equations
for the first, second, and third order polynomials fit to the input
data and the corresponding variance.
- Generate a couple of data sets to test your program.
- Use your program to answer the following question (similar to
textbook question 3.89):
Experimental data for the emittance of tungsten as a function of
temperature has been report to be:
T (Kelvin) | 300 400 500 600 700 800
-----------+------------------------------------
Emittance | 0.024 0.035 0.046 0.058 0.067 0.083
T (Kelvin) | 900 1000 1100 1200 1300 1400
-----------+------------------------------------
Emittance | 0.097 0.111 0.125 0.140 0.155 0.170
T (Kelvin) | 1500 1600 1700 1800 1900 2000
-----------+------------------------------------
Emittance | 0.186 0.202 0.219 0.235 0.252 0.269
The researchers claim that the following equation accurately represents
the emittance for all temperatures (to three decimal places):
e(T) = 0.02424*pow((T/303.16),1.27591)
Suppose that we wish to find the emmitance of tungsten at 350, 450,
550, ... , 1850, and 1950 K. What degree polynomial is required to
match to the equation proposed by the researchers? Discuss the
advantages and disadvantages interpolating instead of using their
equation.
For this project, you are to work individually.
Lab report (due 4:30pm Tuesday, October 12, 1999)
This week, your lab report need not be self-contained. Your report should
include:
- Discussion containing:
- A brief description of any problems you encountered and how they were
resolved
- A brief description of your test plan
- A brief description of your approach for answering the questions
(along with your answers)
- Any questions you have regarding the lab
- Suggestions for how the lab could be improved in the future
- Documented source code
- The data files that you created as well as their corresponding
output
As with any report you submit, correct spelling and grammar are
required. In addition, your report should be submitted electronically
following the Electronic Submission
Guidelines. (You may wish to consult the
sample report before submitting your
report.) Be sure to keep copies of all your files, in case something
gets lost. It may be wise to keep a diskette backup as well.
If you have any questions, consult the instructor.
This page was created by Dr.
Christopher C. Taylor, copyright 1999.
|