我有一个带通滤波器过程的代码:
clc;
f=2075; % Input frequency
Fs=4*f; % Sampling Frequency
t=0:(1:100)/Fs:0.01;
s=sin(2*pi*f*t);
subplot(2,3,1)
plot(t,s)
grid on;
xlabel('time')
ylabel('magnitude')
fp1=2070; % Low Cut
fp2=2080; % High Cut
w1=(fp1)/(Fs); % normalization
w2=(fp2)/(Fs); % normalization
%Bandpass Filter Function
[b,a] = butter(8, w1, 'low'); % lowpass filter
y1 = filtfilt(b, a, s);
[b,a] = butter(8, w2, 'high'); % highpass filter
y2 = filtfilt(b, a, y1);
subplot (2,3,2);
plot(y2);
grid on;
xlabel('time')
ylabel('magnitude')
% Input Frequency Spectrum
S1=fft(s,512);
w=(0:255)/256*(Fs/2);
subplot(2,3,4)
plot(w,abs(S1(1:256)))
grid on;
xlabel('frequency')
ylabel('magnitude')
% Out of Band pass filter spectrum
S2=fft(y2,512);
w=(0:255)/256*(Fs/2);
subplot(2,3,5)
plot(w,abs(S2(1:256)))
grid on;
xlabel('frequency')
ylabel('magnitude') `
以下是我的问题:
我感谢你的帮助!
最好的问候