low pass filter coding that received white noise as a input

3 次查看(过去 30 天)
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