low pass filter -signal processing - viv-post

 Desc:

Create a signal sampled at 1 kHz for 1 second. The signal contains two tones, one at 50 Hz and the other at 250 Hz, embedded in Gaussian white noise of variance 1/100. The high-frequency tone has twice the amplitude of the low-frequency tone.

matlab code:

%Lowpass Filtering of Tones
% works for matlab 2018 or later
% https://www.mathworks.com/help/signal/ref/lowpass.html#mw_76073e9d-503f-4b85-ab6a-0f4028aa02f0
% Create a signal sampled at 1 kHz for 1 second. The signal contains two tones, one at 50 Hz and the other at 250 Hz, embedded in Gaussian white noise of variance 1/100.
clc;clear;
fs = 1e3;
t = 0:1/fs:1; % start, step size, end
x = [1 2]*sin(2*pi*[50 250]'.*t) + randn(size(t))/10;
lowpass(x,150,fs)

 

 

 

posted @ 2020-10-13 21:47  kaiming_ai  阅读(157)  评论(0编辑  收藏  举报