Temperature Sensor Linearization
Linearise an NTC thermistor reading using the Steinhart-Hart equation and build a lookup table that a microcontroller can use without floating point.
Constraints
- Function: [temps, lut] = ntc_linearize(coeffs, r_series, vref, bits).
- Use the three-coefficient Steinhart-Hart form.
- Output temperatures in degrees Celsius.
- LUT is indexed by ADC code and stores tenths of a degree as int16.
- Reject an ADC code of 0 or full scale, where the resistance is undefined.
- Table length must be 2^bits.
1function [temps, lut] = ntc_linearize(coeffs, r_series, vref, bits)2% TODO3end