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.

조회 수: 2 (최근 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

채택된 답변

Mehmed Saad
Mehmed Saad 2020년 4월 21일
편집: Mehmed Saad 2020년 4월 21일
Change the line g1.*b to
bfilterbank= g1(k).*b ;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by