Create RF filter object
Use the rffilter
object to create a Butterworth, Chebyshev
or an Inverse Chebyshev RF filter. The RF filter is a 2-port circuit object, and you can
include this object as an element of a circuit.
For more design information see, Parameters to Define Filter and Design Tips.
You can also convert the rffilter
object to an lcladder by using
the lcladder
object. LCLad = lcladdder(rffiltobj)
where
rffilterobj
is an rffilter
object.
FilterType
— Filter type'Butterworth'
(default) | 'Chebyshev'
| 'InverseChebyshev'
Filter type, specified as 'Butterworth'
,
'Chebyshev'
, or
'InverseChebyshev'
.
Example: 'FilterType','Chebyshev'
Example: rfobj.FilterType = 'Chebyshev'
Data Types: char
| string
ResponseType
— Filter response type'Lowpass'
(default) | 'Highpass'
| 'Bandpass'
| 'Bandstop'
Filter response type, specified as 'Lowpass'
,
'Highpass'
, 'Bandpass'
, or
'Bandstop'
. For more information, see Frequency Responses.
Example: 'ResponseType','Highpass'
Example: rfobj.ResponseType = 'Highpass'
Data Types: char
| string
Implementation
— Filter implementation'LC Tee'
(default) | 'LC Pi'
| 'Transfer function'
Filter implementation, specified as 'LC Tee'
,
'LC Pi'
, or 'Transfer
function'
.
Example: 'Implementation','Transfer
function'
Example: rfobj.Implementation = 'Transfer function'
For 'Inverse Chebyshev'
type filter, you can only
use 'Transfer function'
implementation.
Data Types: char
| string
FilterOrder
— Filter order3
(default) | real finite non-negative integerFilter order, specified as a real finite non-negative integer. In a lowpass or highpass filter, the order specifies the number of lumped storage elements. In a bandpass or bandstop filter, the number of lumped storage elements is twice the value of the order.
Note
FilterOrder
has the highest precedence among
all the name-value pairs in the filter design. Using this property
sets the UseFilterOrder
read-only property to
true.
Example: 'FilterOrder',4
Example: rfobj.FilterOrder = 4
Data Types: double
PassbandFrequency
— Passband frequencyPassband frequency, specified as:
A scalar in hertz for lowpass and highpass filters.
A two-element vector in hertz for bandpass or bandstop filters.
By default, the values are 1e9
for lowpass
filter, 2e9
for highpass filter, and [2e9
3e9]
for bandpass and [[1e9 4e9]
for
bandstop filters.
Example: 'PassbandFrequency',[3e6 5e6]
Example: rfobj.PassbandFrequency = [3e6
5e6]
Data Types: double
StopbandFrequency
— Stopband frequencyStopband frequency, specified as:
A scalar in hertz for lowpass and highpass filters.
A two-element vector in hertz for bandpass or bandstop filters.
By default, the values are 2e9
for lowpass
filter, 1e9
for highpass filter, [1.5e9
3.5e9]
for bandpass filters, and [2.1e9
2.9e9]
bandstop filters.
Example: rffilter('ResponseType','lowpass','StopbandFrequency',[3e6
5e6])
Example: rfobj.StopbandFrequency = [3e6
5e6]
Data Types: double
PassbandAttenuation
— Passband attenuation10*log10(2)
(default) | scalarPassband attenuation, specified as a scalar in dB. For bandpass filters, this value is applied equally to both edges of the passband.
Example: 'PassbandAttenuation',5
Example: rfobj.PassbandAttenuation = 5
Data Types: double
StopbandAttenuation
— Stopband attenuation40
(default) | scalarStopband attenuation, specified as a scalar in dB. For bandstop filters, this value is applied equally to both edges of the stopband.
Example: 'StopbandAttenuation',30
Example: rfobj.StopbandAttenuation = 30
Data Types: double
Zin
— Source impedance50
(default) | positive real part finite scalarSource impedance, specified as a positive real part finite scalar in ohms.
Example: 'Zin',70
Example: rfobj.Zin = 70
Data Types: double
Zout
— Load impedance50
(default) | positive real part finite scalarLoad impedance, specified as a positive real part finite scalar in ohms.
Example: 'Zout',70
Example: rfobj.Zout = 70
Data Types: double
Name
— Name of RF filter object 'Filter'
(default) | character vectorName of RF filter object, specified as a character vector. Two elements in the same circuit cannot have the same name. All names must be valid MATLAB® variable names.
Example: 'Name','filter1'
Example: rfobj.Name = 'filter1'
Data Types: char
| string
NumPorts
— Number of ports2
Number of ports, specified as a 2
. This property is
read-only.
Data Types: double
Terminals
— Names of terminals{'p1+','p2+','p1-','p2-'}
Names of the terminals, specified as a {'p1+','p2+','p1-','p2-'}. This property is read-only.
Data Types: char
DesignData
— Filter design dataFilter design data, specified as a structure. This property is read-only. For more information, see Design Data for LC Tee and LC Pi Topologies and Design Data for Transfer Function Implementation.
Data Types: struct
UseFilterOrder
— Use of filter order for filter designtrue
| false
Use of filter order for filter design, specified as a
true
or false
. This property is a
read-only.
Data Types: logical
groupdelay | Group delay of S-parameter object or RF filter object or RF Toolbox circuit object |
sparameters | S-parameter object |
set | Set rffilter object property values |
zpk | Converts rffilter to zero-pole-gain representation |
tf | Converts rffilter to transfer function |
lcladder | LC ladder object |
rfplot | Plot input reflection coefficient and transducer gain of matching network |
clone | Create copy of existing circuit element or circuit object |
circuit | Circuit object |
Create and view the properties of a default RF filter object.
rfobj = rffilter
rfobj = rffilter: Filter element FilterType: 'Butterworth' ResponseType: 'Lowpass' Implementation: 'LC Tee' FilterOrder: 3 PassbandFrequency: 1.0000e+09 PassbandAttenuation: 3.0103 Zin: 50 Zout: 50 DesignData: [1x1 struct] UseFilterOrder: 1 Name: 'Filter' NumPorts: 2 Terminals: {'p1+' 'p2+' 'p1-' 'p2-'}
rfobj.DesignData
ans = struct with fields:
FilterOrder: 3
Inductors: [7.9577e-09 7.9577e-09]
Capacitors: 6.3662e-12
Topology: 'lclowpasstee'
PassbandFrequency: 1.0000e+09
PassbandAttenuation: 3.0103
Create a Butterworth passband filter object named BFCG_162W
with passband frequencies between 950 and 2200 MHz, stopband frequencies between 770 and 3000 MHz, passband attenuation of 3.0 dB, and stopband attenuation of 40 dB using 'LC Tee' implementation type. Calculate the S-parameters of the filter at 2.1 GHz.
robj = rffilter('ResponseType','Bandpass','Implementation','LC Tee','PassbandFrequency',[950e6 2200e6], ... 'StopbandFrequency',[770e6 3000e6],'PassbandAttenuation',3,'StopbandAttenuation',40); robj.Name = 'BFCG_162W'
robj = rffilter: Filter element FilterType: 'Butterworth' ResponseType: 'Bandpass' Implementation: 'LC Tee' PassbandFrequency: [950000000 2.2000e+09] PassbandAttenuation: 3 StopbandFrequency: [770000000 3.0000e+09] StopbandAttenuation: 40 Zin: 50 Zout: 50 DesignData: [1x1 struct] UseFilterOrder: 0 Name: 'BFCG_162W' NumPorts: 2 Terminals: {'p1+' 'p2+' 'p1-' 'p2-'}
Calculate the S-parameters at 2.1 GHz.
s = sparameters(robj,2.1e9)
s = sparameters: S-parameters object NumPorts: 2 Frequencies: 2.1000e+09 Parameters: [2x2 double] Impedance: 50 rfparam(obj,i,j) returns S-parameter Sij
Build a lcladder
object from the rffilter
object. This lcladder object can be used in a circuit directly and could also be used for parametric analysis across inductor and capacitance values.
l = lcladder(robj)
l = lcladder: LC Ladder element Topology: 'bandpasstee' Inductances: [1x11 double] Capacitances: [1x11 double] Name: 'lcfilt' NumPorts: 2 Terminals: {'p1+' 'p2+' 'p1-' 'p2-'}
Alternatively, to access the inductors and capacitors directly from the filter object use:
L = robj.DesignData.Inductors; C = robj.DesignData.Capacitors;
Create a Chebyshev lowpass filter with a passband frequency of 2 GHz.
robj = rffilter('FilterType','Chebyshev','PassbandFrequency',2e9);
Set the filter order to 5
and the implementation to LC Pi
.
set(robj,'FilterOrder',5,'Implementation','LC Pi');
Calculate the group delay of the filter at 1.9 GHz.
groupdelay(robj,1.9e9)
ans = 1.4403e-09
This example shows how to design a low-pass Butterworth filter with passband frequency of 3 kHz, stopband frequency 7 kHz, passband attenuation of 2 dB, and stopband attenuation 60 dB. Display the filter order of such a designed filter and determine the passband frequency at 3.0103 dB. See [2] in rffilter object page.
Filter parameters
Fp = 3e3; % Passband frequency, Hz Ap = 2; % Passband attenuation, dB Fs = 7e3; % Stopband frequency, Hz As = 60; % Stopband attenuation, dB
Design filter
r = rffilter("FilterType","Butterworth","ResponseType","Lowpass","Implementation","Transfer function","PassbandFrequency",Fp, ... "PassbandAttenuation",Ap,"StopbandFrequency",Fs,"StopbandAttenuation",As);
Filter order of the designed filter
N = r.DesignData.FilterOrder;
sprintf('Calculated filter order is %d',N)
ans = 'Calculated filter order is 9'
Frequency at 3.0103 dB
F_3dB = r.DesignData.PassbandFrequency/1e3;
sprintf('Frequency at 3.0103 dB is %d kHz',F_3dB)
ans = 'Frequency at 3.0103 dB is 3.090733e+00 kHz'
Visualize magnitude response
frequencies = linspace(0,2*Fs,1001); rfplot(r, frequencies)
Note: To use rfplot and plot on the same figure use setplot
. Type 'help setrfplot' in command window for information.
Reference
Larry D. Paarmann, Design and Analysis of Analog Filters: A Signal Processing Perspective, Kluwer Academic Publishers
Design a low-pass Chebyshev filter with 0.1 dB bandpass ripple, cut-0ff frequency of 1 rad/sec, and 50 dB attenuation at 1.1 rad/sec. Display the filter order of this designed filter [1].
Define parameters
Fp = 1/(2*pi); % Passband frequency, Hz Rp = 0.1; % Ripple in Passband, dB Fs = 1.1/(2*pi); % Stopband frequency, Hz As = 50; % Stopband attenuation, dB
Design filter
r = rffilter("FilterType","Chebyshev","ResponseType","Lowpass","Implementation","Transfer function","PassbandFrequency",Fp, ... "PassbandAttenuation",Rp,"StopbandFrequency",Fs,"StopbandAttenuation",As)
r = rffilter: Filter element FilterType: 'Chebyshev' ResponseType: 'Lowpass' Implementation: 'Transfer function' PassbandFrequency: 0.1592 PassbandAttenuation: 0.1000 StopbandFrequency: 0.1751 StopbandAttenuation: 50 Zin: 50 Zout: 50 DesignData: [1x1 struct] UseFilterOrder: 0 Name: 'Filter' NumPorts: 2 Terminals: {'p1+' 'p2+' 'p1-' 'p2-'}
Filter order of the designed filter
N = r.DesignData.FilterOrder;
sprintf('Calculated filter order is %d',N)
ans = 'Calculated filter order is 19'
Reference
G.Ellis, Michael,Sr.Electronic Filter Analysis and Synthesis,Artech House, 1994
For LC Tee or Pi topologies, DesignData
returns inductor and capacitor values. In addition, DesignData
includes other design parameters relevant to response type.
Lowpass/Highpass Response: Filter order, Passband Frequency, Passband Attenuation
Bandpass Response: Filter order, Passband Frequency, Passband Attenuation, Auxiliary (Wx).
Bandstop Response: Filter order, Stopband Frequency, Passband Attenuation, Auxiliary (Wx).
For bandstop response, Wx is an adjustment for the first frequency at which the lowpass prototype meets the prescribed bandstop loss. For bandpass response, Wx is an adjustment of specification of passband attenuation not equal to 3 dB. For more information, see [1].
For transfer function implementation,
DesignData
returns factored polynomial coefficients for
S-parameters. These factors group the complex conjugate terms to preserve precision.
All S-parameters have a common denominator present in
Denominator
. The numerator terms for S11,
S22, and S21
(S21 = S12) can be evaluated using
the factored polynomial present in numerators Numerator11
,
Numerator22
, and Numerator21
,
respectively.
For example, consider a default lowpass filter at 1 GHz. You can find the S21 data at 1 GHz for the filter as follows:
r = rffilter('Implementation','Transfer function'); f = 1e9; num21 = [polyval(r.DesignData.Numerator21(1,:),1i*2*pi*f) ... polyval(r.DesignData.Numerator21(2,:),1i*2*pi*f)]; den = [polyval(r.DesignData.Denominator(1,:),1i*2*pi*f) ... polyval(r.DesignData.Denominator(2,:),1i*2*pi*f)]; s21_1GHz = prod(num21./den,2)
s21_1GHz = -0.5000 - 0.5000i
sparameters
function to calculate the
example:S = sparameters(r,1e9); S.Parameters(2,1)
ans = -0.5000 - 0.5000i
In addition, DesignData
includes other design parameters
relevant to response type for:
Lowpass/Highpass Response: Filter order, Passband Frequency, Auxiliary (Numerator21 Polynomial)
Note
Passband frequency is at 3 dB for Butterworth filter.
Bandpass Response: Filter order, Passband Frequency, Auxiliary (Wx, Numerator21 Polynomial)
Bandstop Response: Filter order, Stopband Frequency, Auxiliary (Wx, Numerator21 Polynomial)
For bandstop response, Wx is an adjustment for the first frequency at which the lowpass prototype meets the prescribed bandstop loss. For bandpass response, Wx is an adjustment of specification of passband attenuation not equal to 3 dB.
Some additional design tips:
Filter Type | Frequency Response |
---|---|
Lowpass | |
Highpass | |
Bandpass | |
Bandstop |
Frequency response of typical lowpass even and odd order Chebyshev filters:
Frequency response of typical low pass even and odd order of Inverse Chebyshev filters:
This table shows all the parameters required to design each filter correctly:
[1] G.Ellis, Michael,Sr.Electronic Filter Analysis and Synthesis,Artech House, 1994
[2] Larry D. Paarmann, Design and Analysis of Analog Filters, A Signal Processing Perspective with MATLAB Examples, Kluwer Academic Publishers, 2001.
[3] www.matheonics.com/Tutorials/Chebyshev.html
[4] www.matheonics.com/Tutorials/InverseChebyshev.html
lcladder
| nport
| rfbudget
| sparameters
You have a modified version of this example. Do you want to open this example with your edits?