Operation of a patients heart or lungs may be analyzed by transmitting ultrasound energy into the patients lung, and detecting Doppler shifts of reflected ultrasound induced by moving borders between blood vessels/soft tissue in the lung and air filled alveoli that surround the blood vessels. Movement of the border is caused by pressure waves in the blood vessels that result in changes in diameter of those blood vessels. The detected Doppler shifts are processed with a noise reduction algorithm, and periodic features in the resulting data are then analyzed to determine the rate of the patients heartbeat, the rate of the patients breathing, and/or the appearance of anomalies in the patients heartbeat.