RC滤波器详解

摘自博客:https://www.cnblogs.com/unclemac/p/

高通滤波器可以滤除频率低于截止频率的信号,类似的还有低通滤波器,带通滤波器,带阻滤波器。

一阶RC高通滤波器的电路图:

参考公式:

RC:时间常数

ΔT:采样时间

matlab实现:

Serial = 0:0.1:100;
Fs = 1;
Phase = 0;
Amp = 1;

N0 = 2*pi*Fs*Serial - Phase;
X0 = Amp*sin(N0);
subplot(4,1,1);
plot(X0);

Fs = 0.02;
N1 = 2*pi*Fs*Serial - Phase;
X1 = Amp*sin(N1);
subplot(4,1,2);
plot(X1);

X2=X0+X1;
subplot(4,1,3);
plot(X2);

len = length(X2);
X3=X2;
p=0.75;

for i=2:len
    X3(i) = p*X3(i-1)+p*(X2(i)- X2(i-1))
end

subplot(4,1,4);
plot(X3);

低通滤波器可以滤除频率高于截止频率的信号,类似的还有高通滤波器,带通滤波器,带阻滤波器

一阶RC低通滤波器的电路图:

参考公式:

matlab实现


Serial = 0:0.1:100;
Fs = 1;
Phase = 0;
Amp = 1;

% 高频信号
N0 = 2*pi*Fs*Serial - Phase;
X0 = Amp*sin(N0);
subplot(4,1,1);
plot(X0);

% 低频信号
Fs = 0.02;
N1 = 2*pi*Fs*Serial - Phase;
X1 = Amp*sin(N1);
subplot(4,1,2);
plot(X1);

% 高频低频叠加的信号
X2=X0+X1;
subplot(4,1,3);
plot(X2);

%Xi-Yi=RC*(Yi - Yi-1)/DetalT
len = length(X2);
X3=X2;
p=0.05;

% 一阶RC滤波得到X3
for i=2:len
    X3(i) = p*X2(i)+(1-p)*X3(i-1);
end

subplot(4,1,4);
plot(X3);

2次低通滤波:


Serial = 0:0.1:100;
Fs = 1;
Phase = 0;
Amp = 1;

% 高频信号
N0 = 2*pi*Fs*Serial - Phase;
X0 = Amp*sin(N0);
subplot(5,1,1);
plot(X0);

% 低频信号
Fs = 0.02;
N1 = 2*pi*Fs*Serial - Phase;
X1 = Amp*sin(N1);
subplot(5,1,2);
plot(X1);

% 高频低频叠加的信号
X2=X0+X1;
subplot(5,1,3);
plot(X2);

%Xi-Yi=RC*(Yi - Yi-1)/DetalT
len = length(X2);
X3=X2;
p=0.05;

% 一阶RC滤波得到X3
for i=2:len
    X3(i) = p*X2(i)+(1-p)*X3(i-1);
end

subplot(5,1,4);
plot(X3);

X4=X3;
p=0.05;
for i=2:len
    X4(i) = p*X3(i)+(1-p)*X4(i-1);
end
subplot(5,1,5);
plot(X4);