如何过滤高频信号?
How to filter high freq signals?
所以我有一项任务要在 MATLAB 中为大学过滤高频信号。我为它写了代码,但它没有正确过滤。这是我的代码:
A1 = 7;
A2 = 10;
A3 = 2;
f1 = 934;
f2 = 232;
f3 = 844;
th1 = 5*pi/4;
th2 = pi/4;
th3 = 5*pi/8;
M = 21;
T = 0.7823;
T1 = 0.0331;
T2 = 0.08;
fd = 6395;
K = 3;
Td = 1/fd; % diskretizavimo periodas
N = fix(T/Td); %modeliuojamo signalo reiksmiu skaicius
t = (0:N-1)*Td;
y = A1*sin(2*pi*f1*t + th1)+A2*sin(2*pi*f2*t + th2);
df = 1/T;
Nf=fd/df;
frib=(f1+f2)/2;
Wn = frib/fd;
b = fir1(M, Wn, 'high');
N2=Nf/2;
fasis = (0:Nf-1)*df;
filt_y = filter(b,1, y);
FILT_Y = abs(fft(filt_y, Nf));
figure(17)
subplot(2,1,1)
plot(t(1:T1*2/Td),filt_y(1:T1*2/Td));box('off'); axis tight;
set(gca, 'fontsize', 12); title('Filtruotas sinusu sumos signalas')
subplot(2,1,2)
stem(fasis(1:N2),FILT_Y(1:N2),'.');box('off'); axis tight;
set(gca, 'fontsize', 12); title('Filtruoto sinusu sumos signalo spektras')
frib是截止频率
这些是我的图表:
你能告诉我怎样做才能使第二张图(接近 1000 频率)中只有一个可见吗?我不知道我还能做些什么
如果您查看信号前后的傅里叶分量,您可以清楚地看到第一个主频率如何大幅降低:
noFILT_Y = abs(fft(y, Nf));
subplot(2,1,2)
stem(fasis(1:N2),FILT_Y(1:N2),'.');box('off'); axis tight;
subplot(2,1,1)
stem(fasis(1:N2),noFILT_Y(1:N2),'.');box('off'); axis tight;
但是如果你遵循@irreducible 的建议:
Wn = frib/(fd/2);
所以我有一项任务要在 MATLAB 中为大学过滤高频信号。我为它写了代码,但它没有正确过滤。这是我的代码:
A1 = 7;
A2 = 10;
A3 = 2;
f1 = 934;
f2 = 232;
f3 = 844;
th1 = 5*pi/4;
th2 = pi/4;
th3 = 5*pi/8;
M = 21;
T = 0.7823;
T1 = 0.0331;
T2 = 0.08;
fd = 6395;
K = 3;
Td = 1/fd; % diskretizavimo periodas
N = fix(T/Td); %modeliuojamo signalo reiksmiu skaicius
t = (0:N-1)*Td;
y = A1*sin(2*pi*f1*t + th1)+A2*sin(2*pi*f2*t + th2);
df = 1/T;
Nf=fd/df;
frib=(f1+f2)/2;
Wn = frib/fd;
b = fir1(M, Wn, 'high');
N2=Nf/2;
fasis = (0:Nf-1)*df;
filt_y = filter(b,1, y);
FILT_Y = abs(fft(filt_y, Nf));
figure(17)
subplot(2,1,1)
plot(t(1:T1*2/Td),filt_y(1:T1*2/Td));box('off'); axis tight;
set(gca, 'fontsize', 12); title('Filtruotas sinusu sumos signalas')
subplot(2,1,2)
stem(fasis(1:N2),FILT_Y(1:N2),'.');box('off'); axis tight;
set(gca, 'fontsize', 12); title('Filtruoto sinusu sumos signalo spektras')
frib是截止频率
这些是我的图表:
你能告诉我怎样做才能使第二张图(接近 1000 频率)中只有一个可见吗?我不知道我还能做些什么
如果您查看信号前后的傅里叶分量,您可以清楚地看到第一个主频率如何大幅降低:
noFILT_Y = abs(fft(y, Nf));
subplot(2,1,2)
stem(fasis(1:N2),FILT_Y(1:N2),'.');box('off'); axis tight;
subplot(2,1,1)
stem(fasis(1:N2),noFILT_Y(1:N2),'.');box('off'); axis tight;
但是如果你遵循@irreducible 的建议:
Wn = frib/(fd/2);