The invention discloses an electrocardiogram 
signal denoising method based on optimization theory. The electrocardiogram 
signal denoising method includes the steps that received electrocardiogram signals are preprocessed, and a 
heartbeat matrix where a 
heartbeat cycle is stored is acquired; optimization 
decomposition is conducted on the 
heartbeat matrix on the basis of the optimization theory, and a denoised electrocardiogram 
signal matrix is acquired. According to the electrocardiogram signal denoising method based on the optimization theory, by preprocessing the received electrocardiogram signals, the heartbeat matrix where the heartbeat cycle is stored is acquired, and the heartbeat matrix that contains the electrocardiogram signals and electromyogram 
noise can be acquired; by conducting the optimization 
decomposition on the heartbeat matrix, the denoised electrocardiogram signal matrix is acquired, the electrocardiogram signals and the electromyogram 
noise in the heartbeat matrix can be separated, accordingly, the electrocardiogram signals from which the electromyogram 
noise is removed can be acquired, the electromyogram noise is effectively restrained, and meanwhile the efficient information of the electrocardiogram signals is retained. In addition, the invention further discloses an electrocardiogram signal denoising device based on the optimization theory. The electrocardiogram signal denoising device based on the optimization theory has the same beneficial effects as the electrocardiogram signal denoising method.