{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw6problem5

hw6problem5 - of resistivities(x values for the regression...

This preview shows page 1. Sign up to view the full content.

% ENGR 126 Fall 2008 % Solution to Homework 6, Problem 5. % This program performs a regression on temperature and resistivity data for a platinum resistance thermometer. % ---- Input Section ---- % Read the data into MATLAB load 'hw6problem5.txt' resistivity = hw6problem5(:,1); temperature = hw6problem5(:,2); % ---- Calculation & Output Section ---- % Generate a scatter plot of the data plot(resistivity,temperature,'or') % Formats the graph according to proper plotting format title('Temperature plotted as a function of resistivity for a Platinum Resistance Thermometer') ylabel('Temperature (degrees C)') xlabel('Resistivity (microohms-cm)') % Determine the slope and intercept for the regression line coefficients = polyfit(resistivity,temperature,1); % Determine the predicted temperatures (y values) using the original set
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % of resistivities (x values) for the regression line. pred_temperatures = polyval(coefficients,resistivity); % Add the regression line to the existing scatter plot hold on plot(resistivity,pred_temperatures,'b') % Predict the temperature when the resistivity is 35.83 microohms-cm. predict_35mohms = polyval(coefficients,35.83); % Display the predicted and actual temperature for 35.83 microohms-cm. disp('The predicted temperature (degrees C) is:') disp(predict_35mohms) disp('The actual measured temperature (degrees C) is:') disp(temperature(10)) %----Comments----% The predicted temperature (degrees C) is: 618.4847 % The actual measured temperature (degrees C) is: 600...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online