FFT信号的最大峰值

时间:2014-05-24 09:37:25

标签: matlab filter signal-processing frequency

我有一个带通滤波器过程的代码:

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') `

以下是我的问题:

  1. 我创建的程序代码是否正确
  2. 我应该添加什么命令行来查找带通滤波器频谱结果的最大频率
  3. 我感谢你的帮助!

    最好的问候

0 个答案:

没有答案