A three-dimensional model for the coupled evolution of ice-surface temperature and elevation in the Martian polar ice caps is presented. The model includes (1) enhanced heat absorption on steep, dust-exposed scarps, (2) accumulation and ablation, and (3) lateral conduction of heat within the ice cap. The model equations are similar to classic equations for excitable media, including nerve fibers and chemical oscillators. In two dimensions, a small zone of initial melting in the model develops into a train of poleward-migrating troughs with widths similar to those observed on Mars. Starting from random initial conditions, the three-dimensional model reproduces spiral waves very similar to those in the north polar ice cap, including secondary features such as gull-wing shaped troughs, bifurcations, and terminations. These results suggest that eolian processes and ice flow may not control trough morphology.