Digital Signal Processing Reference
In-Depth Information
function [d2] = ugc_diff2(h,p,N);
%
% ugc_diff2
converts a unity gain filter h into the corresponding
%
second-order differentiator, d2.
%
% Usage:
[d2] = ugc_diff2(h,p,N)
% Input:
h, a low-pass filter with normalized cut-off
%
no more than 0.4
%
p, plot frequency response.
%
Input '1' to plot response and '0' otherwise.
%
N, number of FFT values to compute
% Output:
d2, second-order differentiator coefficients with
%
cut-off same as h
%
% Notes.
(i) The error may be substantial for normalized frequency
%
beyond 0.4.
%
(ii) The normalization is frequency/Nyquist frequency.
%
L = length(h);
d2(1:L+1) = 0;
d2(L+1) = 2*h(1);
d2(1) = 2*h(1);
for k = 2:L
for j = 1:k-2
d2(L-k+2) = d2(L-k+2) + ((-1)^(k+j))*8*h(j);
end
d2(L-k+2) = d2(L-k+2) + 2*h(k) - 6*h(k-1);
end
if p == 1 [resp,w] = freqz(d2,1,N);
subplot(1,2,1); freqzplot(resp,w,'mag');
xlabel('Normalized Frequency'); ylabel('Magnitude /pi (dB)');
subplot(1,2,2); plot(w/pi,abs(resp)/pi^2,w/pi,(w/pi).^2);
xlabel('Normalized Frequency'); ylabel('Magnitude /pi');
end
return
function to convert a unity gain filter into a second order differentiator.
Figure 6.14 A Matlab
Table 6.1
Characteristics of Second-Order Differentiators
Differentiator Type
Main Characteristics
Type a*
(i)
(ii)
(iii)
(iv)
Excellent attenuation, A ~ -100dB
Excellent dc accuracy,
~ 10 -5
Poor ac accuracy, R ~ 0.01
Maximally smooth at dc
Excellent ac characteristics, R ~ 10 -5
Type b
(i)
~ 0.01
(iii) Poor attenuation, A ~ 50dB
*Attenuation measured closer to transition edge,
but shows gradual increase towards Nyquist frequency
(ii)
Good dc accuracy,
Search WWH ::




Custom Search