Calibration of a resistance temperature detector
This assignment will test your knowledge of: linear regression and using arrays with functions. This program will use material covered through Chapter 2 and Section 4..
A resistance temperature detector (RTD) is an economical device that measures temperature. It relies on the characteristic of certain materials to have a linear relationship between temperature and electrical resistance over a range of temperatures.
Your task is to evaluate several candidate metal alloys to determine which would be best suited for a household thermometer used to measure body temperature. Your test lab has given you a data file temperaturedata.txt (right click here to save the data file) which has resistance versus temperature for four metal alloys. Your job is to determine which metal alloy has the most linear relationship between temperature and resistance.
For more information on the theory of RTD's click here.
Write a C++ program that:
1. Reads the data file, temperaturedata.txt, exactly as it appears, into a two-dimensional array. Note: Failure to use a two dimensional array will cost up to a 10 point deduction. To skip over the heading text you will need to use the function getline discussed in Section 2.12.3.
2. Uses three separate single result double functions (do not use void functions) to determine the slope, intercept, and r-squared for each data set. Failure to use three double single result functions will cost up to a 10 point deduction.
3. Writes the results of the analysis and the input data to the screen using good format (i.e. use iomanip functions) for your output.
4. Prints to the screen the ID (R1, etc) of the metal alloy that demonstrates the most linear relationship (i.e. r-squared closest to 1.0).
5. In a while loop the program asks the user for a resistance and the program returns the temperature using the RTD alloy that has the best fit (the one that you found in part 4). The program ends when a zero is entered for the resistance.
Example C++ output is shown below. Note that the slopes and intercepts are determined with Temp as the dependent variable (y) and R's are the independent variables (x). This is a bit backwards, but it makes doing part 5 easier. A good suggestion is to complete the calculations in excel so you can debug your calculations in the C++ program.
Recently Asked Questions
- Im working with f(x)=8x−2ln(x), x>0 Im trying to find the critical numbers
- Consumption 600 Investment 134 Property income earned overseas 75 Property income paid overseas 95 Subsidies 55 Indirect tax 85 Exports 80 Imports 10
- What does the difference in the survey administration methods between BRFSS and NHANES tell you about what type of study the dataset will be able to support?