% O2 R, e) ]! w9 C% `7 C; |Design a 20th-order elliptic bandpass filter with a lower passband frequency of 500 Hz and a higher passband frequency of 560 Hz. Specify a passband ripple of 3 dB, a stopband attenuation of 40 dB, and a sample rate of 1500 Hz. Use the state-space representation. Design an identical filter using designfilt.: G0 y, z$ F3 N+ A' ^, p$ b
; ^5 e% V. O$ y, Y$ Z' e5 u
设计一个20阶椭圆带通滤波器与500Hz的低通频带频率和560赫兹的高通频带频率。 指定3 dB的通带纹波,40 dB的阻带衰减和1500 Hz的采样率。 使用状态空间表示。 使用designfilt设计相同的过滤器。 5 n, m; `) G% P5 H9 g3 E4 Y8 u: F6 f/ T
[A,B,C,D] = ellip(10,3,40,[500 560]/750); / ~3 K6 k( u# t; [2 W7 q* v* |d = designfilt('bandpassiir','FilterOrder',20, ... u) t0 a# K/ ]7 k3 h: L 'PassbandFrequency1',500,'PassbandFrequency2',560, ... . Y1 m- S# E9 \/ r 'PassbandRipple',3, ... 8 ]) W" i, A' s9 T ~- {6 i 'StopbandAttenuation1',40,'StopbandAttenuation2',40, ...: o. d; M) |% Q1 A4 t4 ~" g4 }. E5 X
'SampleRate',1500); ) F( i: R. M, K: w4 ^1 T1 I C$ F ; ?! p# v/ f+ G; ^" w ( `" r/ Z6 M) g2 \8 o- x6 {5 k; g: x- w3 r
Convert the state-space representation to second-order sections. Visualize the frequency responses using fvtool. 9 I+ y8 m# ?9 G6 S( q. v7 R; o; z+ `3 @ V5 m) _' F
将状态空间表示转换为二阶段。 使用fvtool可视化频率响应。 5 v9 c8 j- r9 M. A" b+ `6 X; N/ I
sos = ss2sos(A,B,C,D); 2 C# G6 j3 E8 V' i8 j# z2 ]/ l; ]fvt = fvtool(sos,d,'Fs',1500); 8 F6 f5 p2 O8 v8 i. L# q7 Hlegend(fvt,'ellip','designfilt') 5 y0 f O, w1 q$ N/ n1 I# G% j2 N " m. @/ g' T% q; e! c( S2 u" U4 N