Quiz4_solution - RKO=RTdata,2%extract column 2 R into column vec Y=TK.^-1%compute 1/T X=log(RKO%take ln of R remember R is in kilohms H=[X/X X

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Introduction to Computational Physics Phy 265 Quiz 4 (Take-Home) Solutions %THERMISTOR - A script that reads in temperature and resistance data for %a thermistor and finds the best Steinhart-Hart theoretical fit to the data %using linearization and matrix arithmatic (i.e. left division). %script outputs plot of data and fit and sends coefficients to command %window. %File written by S.C. Tegler. Last modified 2/16/11. format short e %numerical output is short sci notation load RTdata.dat -ascii %import ascii file of RT data into array TC=RTdata(:,1); %extract column 1, T, into column vec TK=TC+273.0; %covert T from C to K
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: RKO=RTdata(:,2); %extract column 2, R, into column vec Y=TK.^(-1); %compute 1/T X=log(RKO); %take ln of R, remember R is in kilohms H=[X./X X X.^3]; %create H matrix to solve for coeffs A=H\Y %use left division to solve for coeffs plot(RKO,TK, 'sk' ); %plot R,T data hold on ; INVTFIT=H*A; %(1/T) best fit values TFIT=INVTFIT.^(-1); % T best fit values plot(RKO,TFIT, '-r' ); %plot R data and T best fit xlabel( 'Resistance (kilohms)' ); %plot labels ylabel( 'Temperature (Kelvin)' ); title( 'Calibration Data For Thermistor' ); Output to Command Window A = 2.6860e-03 2.8712e-04 7.2650e-07 2 Plot...
View Full Document

This note was uploaded on 02/23/2012 for the course PHYSICS 265 taught by Professor Tegler during the Spring '11 term at N. Arizona.

Page1 / 2

Quiz4_solution - RKO=RTdata,2%extract column 2 R into column vec Y=TK.^-1%compute 1/T X=log(RKO%take ln of R remember R is in kilohms H=[X/X X

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online