Synthesis and analysis of Band pass from LPF and HPF

advertisement

Synthesis and analysis of Band pass from LPF and HPF Jan 2015

We can first build the band stop filter . For this ,first design the LPF , say hseqa(i). Then use this to convert to HPF using highpass i.e hseqh(i) =

-hseqa(i)*(-1)^(i) ; . Next the band stop is hseqb = hseqa+hseqb .

We can see that every other hseqb(i) of band stop is zero and the other values are double the lpf hseqa or hpf hseqb . So for analysis of the band stop we need to take say for lpf alternate values as hseqb/2 and expand it to include zeros like an expander with L=2.This has to be filled with interpolated values . The hpf is then obtained by changing signs of alternate hseqa(i).

1. Eigen lp filter type 1

// set sigma values passband sig1 sig2 in radians

// stop band sig3 sig4 sig3 =.5 *%pi // stop band sig4 = 1*%pi // stop band sig1 = 0*%pi // passband sig2 =.3*%pi // pass band

1.1. lpf hseqa = [ 0.5197220

0.7810746

0.2383787

- 0.1455732

- 0.1698201

- 0.0035968

0.0906716

0.0448063

- 0.0291368

- 0.0377701

- 0.0018667

0.0180220

0.0086882

- 0.0038613

- 0.0045153

- 0.0004323 ]

2 hpf hseqb =[ 0.5197220

0.7810746

0.2383787

- 0.1455732

- 0.1698201

- 0.0035968

0.0906716

0.0448063

- 0.0291368

- 0.0377701

- 0.0018667

0.0180220

0.0086882

- 0.0038613

- 0.0045153

- 0.0004323 ]

3. band stop

hseqb =[ 1.039444

0.

0.4767574

0.

- 0.3396402

0.

0.1813432

0.

- 0.0582736

0.

- 0.0037334

0.

0.0173764

0.

- 0.0090306

0. ]

4. Scilab 5.3.3 code for plotting

//plot lpf using result of spec function npt =100 dw= %pi/npt ; omg= zeros(1:npt); n1=length(hseqa)

for k=1:npt xm(k)= 0; omg(k)=omg(k)+(k-1)* dw; for i=1:n1 xm(k) = hseqa(i)*cos(omg(k)*(i-1) ) +xm(k) ;

end end xm =real(xm) ; figure(2); plot(omg, xm); // plot the magn vs freq figure(3); mx= max(xm) xml = 20*log10( abs(xm/mx)); oma=omg/2/%pi ; plot(oma, xml);

// lpf to hpf for i=1:n1 hseqh(i) = -hseqa(i)*(-1)^(i) ;

end

//plot hpf using result of spec function npt =100 dw= %pi/npt ; omg= zeros(1:npt); n1=length(hseqa)

for k=1:npt xm(k)= 0; omg(k)=omg(k)+(k-1)* dw; for i=1:n1 xm(k) = hseqh(i)*cos(omg(k)*(i-1) ) +xm(k) ;

end end xm =real(xm) ; figure(2); plot(omg, xm); // plot the magn vs freq figure(3); mx= max(xm) xml = 20*log10( abs(xm/mx)); oma=omg/2/%pi ; plot(oma, xml);

// add lp+hpf hseqb=hseqa+hseqh ;

//plot bpf using result of spec function npt =100 dw= %pi/npt ; omg= zeros(1:npt); n1=length(hseqb)

for k=1:npt xm(k)= 0; omg(k)=omg(k)+(k-1)* dw; for i=1:n1 xm(k) = hseqb(i)*cos(omg(k)*(i-1) ) +xm(k) ;

end end xm =real(xm) ; figure(2); plot(omg, xm); // plot the magn vs freq figure(3); mx= max(xm) xml = 20*log10( abs(xm/mx)); oma=omg/2/%pi ; plot(oma, xml);

5. Plots of the filters.

Below the plots of the lpf , hpf and band pass filters are shown.

lpf

lpf

hpf

hpf

band stop

Download