low pass filter coding that received white noise as a input

조회 수: 7 (최근 30일)
Muhammad Asad
Muhammad Asad 2022년 5월 28일
답변: William Rose 2022년 5월 29일
I want to create a low pass filter exactly
w0/ (s+ w0)
This filter received white noise of spectural density as i/p and give an output.
Note: w0 is the natural frequency of the system.

답변 (1개)

William Rose
William Rose 2022년 5월 29일
You have specified a low pass filter with a cutoff frequency of radians per unit time. Since you did not specify a filter order, or other filter requirements, we will use the simplest low pass filter:
where , where is the sampling rate, in samples per unit time.
Example: Sampling rate = . Desired lowpass filter cutoff frequency = radians/s.
%% Define constants
fs=100; %sampling rate (Hz)
w0=10*2*pi; %cutoff frequency (radians/s)
N=100; %number of points in signal
%% Define input signal and time vector
t=(1:N)/fs; %time vector
x=randn(1,N); %input signal=Gaussian white noise
%% Filter the input signal
alpha=w0/(w0+fs);
y=zeros(1,N); %allocate array for y
y(1)=0; %initial value for y
y(2:N)=alpha*x(2:N)+(1-alpha)*y(1:N-1); %filter the signal
%% Plot results
plot(t,x,'-r',t,y,'-b');
xlabel ('Time (s)'); legend('Input','Output'); title('Lowass filter')
Good luck.

카테고리

Help CenterFile Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by