|
发表于 2010-11-29 18:08:30
|
显示全部楼层
回复【3楼】smartzou 笨笨
-----------------------------------------------------------------------
matlab有fdatool工具设计数字和模拟滤波器,matlab帮助中搜analog filter design
这个是analog的滤波器设计工具,当然是用analog自己的运放,影响应该不大
http://www.analog.com/en/amplifiers-and-comparators/operational-amplifiers-op-amps/eval-fltr/products/dt-input-stage-filter-design/Filter_Wizard/resources/fca.html
matlab帮助:butter
Butterworth analog and digital filter design
Syntax
[z,p,k] = butter(n,Wn)
[z,p,k] = butter(n,Wn,'ftype')
[b,a] = butter(n,Wn)
[b,a] = butter(n,Wn,'ftype')
[A,B,C,D] = butter(n,Wn)
[A,B,C,D] = butter(n,Wn,'ftype')
[z,p,k] = butter(n,Wn,'s')
[z,p,k] = butter(n,Wn,'ftype','s')
[b,a] = butter(n,Wn,'s')
[b,a] = butter(n,Wn,'ftype','s')
[A,B,C,D] = butter(n,Wn,'s')
[A,B,C,D] = butter(n,Wn,'ftype','s')
Description
butter designs lowpass, bandpass, highpass, and bandstop digital and analog Butterworth filters. Butterworth filters are characterized by a magnitude response that is maximally flat in the passband and monotonic overall.
Butterworth filters sacrifice rolloff steepness for monotonicity in the pass- and stopbands. Unless the smoothness of the Butterworth filter is needed, an elliptic or Chebyshev filter can generally provide steeper rolloff characteristics with a lower filter order.
Digital Domain
[z,p,k] = butter(n,Wn) designs an order n lowpass digital Butterworth filter with normalized cutoff frequency Wn. It returns the zeros and poles in length n column vectors z and p, and the gain in the scalar k.
[z,p,k] = butter(n,Wn,'ftype') designs a highpass, lowpass, or bandstop filter, where the string 'ftype' is one of the following:
*
'high' for a highpass digital filter with normalized cutoff frequency Wn
*
'low' for a lowpass digital filter with normalized cutoff frequency Wn
*
'stop' for an order 2*n bandstop digital filter if Wn is a two-element vector, Wn = [w1 w2]. The stopband is w1 < ω < w2.
Cutoff frequency is that frequency where the magnitude response of the filter is . For butter, the normalized cutoff frequency Wn must be a number between 0 and 1, where 1 corresponds to the Nyquist frequency, π radians per sample.
If Wn is a two-element vector, Wn = [w1 w2], butter returns an order 2*n digital bandpass filter with passband w1 < ω < w2.
With different numbers of output arguments, butter directly obtains other realizations of the filter. To obtain the transfer function form, use two output arguments as shown below.
Note See Limitations below for information about numerical issues that affect forming the transfer function.
[b,a] = butter(n,Wn) designs an order n lowpass digital Butterworth filter with normalized cutoff frequency Wn. It returns the filter coefficients in length n+1 row vectors b and a, with coefficients in descending powers of z.
[b,a] = butter(n,Wn,'ftype') designs a highpass, lowpass, or bandstop filter, where the string 'ftype' is 'high', 'low', or 'stop', as described above.
To obtain state-space form, use four output arguments as shown below:
[A,B,C,D] = butter(n,Wn) or
[A,B,C,D] = butter(n,Wn,'ftype') where A, B, C, and D are
and u is the input, x is the state vector, and y is the output.
Analog Domain
[z,p,k] = butter(n,Wn,'s') designs an order n lowpass analog Butterworth filter with angular cutoff frequency Wn rad/s. It returns the zeros and poles in length n or 2*n column vectors z and p and the gain in the scalar k. butter's angular cutoff frequency Wn must be greater than 0 rad/s.
If Wn is a two-element vector with w1 < w2, butter(n,Wn,'s') returns an order 2*n bandpass analog filter with passband w1 < ω < w2.
[z,p,k] = butter(n,Wn,'ftype','s') designs a highpass, lowpass, or bandstop filter using the ftype values described above.
With different numbers of output arguments, butter directly obtains other realizations of the analog filter. To obtain the transfer function form, use two output arguments as shown below:
[b,a] = butter(n,Wn,'s') designs an order n lowpass analog Butterworth filter with angular cutoff frequency Wn rad/s. It returns the filter coefficients in the length n+1 row vectors b and a, in descending powers of s, derived from this transfer function:
[b,a] = butter(n,Wn,'ftype','s') designs a highpass, lowpass, or bandstop filter using the ftype values described above.
To obtain state-space form, use four output arguments as shown below:
[A,B,C,D] = butter(n,Wn,'s') or
[A,B,C,D] = butter(n,Wn,'ftype','s') where A, B, C, and D are
and u is the input, x is the state vector, and y is the output.
Examples
Highpass Filter
For data sampled at 1000 Hz, design a 9th-order highpass Butterworth filter with cutoff frequency of 300 Hz, which corresponds to a normalized value of 0.6:
[z,p,k] = butter(9,300/500,'high');
[sos,g] = zp2sos(z,p,k); % Convert to SOS form
Hd = dfilt.df2tsos(sos,g); % Create a dfilt object
h = fvtool(Hd); % Plot magnitude response
set(h,'Analysis','freq') % Display frequency response
Limitations
In general, you should use the [z,p,k] syntax to design IIR filters. To analyze or implement your filter, you can then use the [z,p,k] output with zp2sos and an sos dfilt structure. For higher order filters (possibly starting as low as order 8), numerical problems due to roundoff errors may occur when forming the transfer function using the [b,a] syntax. The following example illustrates this limitation:
n = 6; Wn = [2.5e6 29e6]/500e6;
ftype = 'bandpass';
% Transfer Function design
[b,a] = butter(n,Wn,ftype);
h1=dfilt.df2(b,a); % This is an unstable filter.
% Zero-Pole-Gain design
[z, p, k] = butter(n,Wn,ftype);
[sos,g]=zp2sos(z,p,k);
h2=dfilt.df2sos(sos,g);
% Plot and compare the results
hfvt=fvtool(h1,h2,'FrequencyScale','log');
legend(hfvt,'TF Design','ZPK Design')
Algorithm
butter uses a five-step algorithm:
1.
It finds the lowpass analog prototype poles, zeros, and gain using the buttap function.
2.
It converts the poles, zeros, and gain into state-space form.
3.
It transforms the lowpass filter into a bandpass, highpass, or bandstop filter with desired cutoff frequencies, using a state-space transformation.
4.
For digital filter design, butter uses bilinear to convert the analog filter into a digital filter through a bilinear transformation with frequency prewarping. Careful frequency adjustment guarantees that the analog filters and the digital filters will have the same frequency response magnitude at Wn or w1 and w2.
5.
It converts the state-space filter back to transfer function or zero-pole-gain form, as required.
See Also
besself, buttap, buttord, cheby1, cheby2, ellip, maxflat |
|