Hello I'm having a problem where I want to add multiple band pass filters onto one graph but, I have an error that I can figure out how to solve it.
4 次查看(过去 30 天)
显示 更早的评论
%Specify synthetic input signal parameters - sum of 2 sinusoids
f0=1600;
f1=7600;
fs=20000;
t=0:1/fs:0.5-(1/fs);
x1=1*sin(2*pi*f0*t);
x2=1*sin(2*pi*f1*t);
xin=x1+x2;
signal_power=var(xin)
%add in some white gaussian noise
xnse=wgn(1,10000,0.1,'linear');
noise_power=var(xnse)
SNR=10*log10(signal_power/noise_power)
in_file = xin + xnse;
%specify taylor window to be used for spectral estimation
w0=taylorwin(512,4,-80);
%Specify use of the Taylor window
t_window=taylorwin(51,20,-100);What I have:
N=input("Please Enter The Amount Of Filters Needed: ")
for k = 1:N
disp('Band Pass Filter \n')
%Filter Band pass filter cutoffs in Hz
Lc1(k)=input('Input The Lcl: ');
Uc1(k)=input('Input The Ucl: ');
g1(k)=input('Input The Gain: ');
Lc1_norm(k)=2*Lc1(k)/fs;
Uc1_norm(k)=2*Uc1(k)/fs;
b=fir1(50,[Lc1_norm(k) Uc1_norm(k)],t_window);
bfilterbank= g1.*b ;
out_file = filter(bfilterbank,1,in_file);
figure();
freqz(b,1);
title('FIR Filter #1 Magn. & Phase Function Plots');
hold on
end
%ERROR
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multirate Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!