Here's a simple way to simulate a thermostat in Matlab using a basic control algorithm called On-Off control. On-Off control turns the heater on when the temperature is below a set point (SP), and turns it off when the temperature is above the set point.
main.m159 chars4 lines
main.m108 chars3 lines
main.m317 chars11 lines
main.m177 chars7 lines
Note: This is a very basic and idealized model of a thermostat. A practical thermostat would have additional features such as hysteresis, proportional-integral-derivative (PID) control, and non-linear heating characteristics.
gistlibby LogSnag