Apparatus and methods are described for monitoring a subject. A motion sensor senses motion of the subject and generates a sensor signal in response thereto. A control unit includes a filter configured to extract from the sensor signal at least one signal selected from the group consisting of: a breathing-related signal and a heartbeat-related signal. The control unit is configured to analyze the selected signal and to detect changes in body posture of the subject at least partially in response thereto. Other applications are also described.