Filtering white noise with first and second order filter
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi everyone
I have a question about filtering white noise with a discrete tf like below :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/514677/image.png)
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/514682/image.jpeg)
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!