Filtering white noise with first and second order filter
3 次查看(过去 30 天)
显示 更早的评论
Hi everyone
I have a question about filtering white noise with a discrete tf like below :

but i dont know use data or frequency for axis x ?
I use data and I have something like this
my x axis is data and my y axis is amplitude
do you think is it correct or i should do it with frequency?
if i am wrong what should i do ?
Thanks

my code is
clc
clear all
close all
dt = 0 ;
T = 100;
ts = 0.1;
t = dt:ts:T-ts;
N = numel(t) ; %number of data
u = randn(N,1);
H1 = tf((sqrt(3)/2),[1 0.8],ts) %first order filter
y= zeros(N,1);
a = 0.8;
b = sqrt((3)/2);
for i =2:T-ts
y(i) = a*y(i-1) + b*u(i-1);
end
plot(u)
hold on
plot(y)
title('Filtering White Noise')
ylabel("Amplitude")
xlabel("Data")
legend("white noise","filtered white noise")
1 个评论
Mathieu NOE
2021-2-10
hi
look at filter and filtfilt functions
I prefered to do the demo on a unity gain (dc gain = 1) filter so it appears evident that the filtered signal is lower in amplitude
clc
clear all
close all
dt = 0 ;
T = 100;
ts = 0.1;
t = dt:ts:T-ts;
N = numel(t) ; %number of data
u = randn(N,1);
% discrete filter num and denominator
% num = [sqrt(3)/2 0];
a = 0.8;
num = [1-a 0]; % unity gain LP filter
den = [1 -a];
y = filter(num,den,u);
plot(t,u,'b',t,y,'r')
title('Filtering White Noise')
ylabel("Amplitude")
xlabel("Data")
legend("white noise","filtered white noise")
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Filter Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!