Filtering white noise with first and second order filter
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Mathieu NOE
am 10 Feb. 2021
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")
Antworten (0)
Siehe auch
Kategorien
Mehr zu Digital Filter Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!