Digital Signal Processing Reference
In-Depth Information
2
1
0
-1
-2
0
0.005
0.01
0.015
0.02
0.025
0.03
0.035
0.04
0.045
0.05
Time (s ec ond)
1
0.8
0.6
0.4
0.2
0
0
500
1000
1500
2000
2500
3000
3500
4000
Frequency (Hz)
FIGURE 8.50
Plots of a generated single tone of 1,000 Hz and its spectrum.
Note that if we replace the filter H(z) with the z-transform of other sequences such as a cosine function
and use the impulse sequence as the filter input, the filter will generate the corresponding digital wave
such as the digital cosine wave.
Program 8.18. MATLAB program for generating a sinusoid.
fs ¼ 8000;
% Sampling rate
t ¼ 0:1/fs:1;
% Time vector for 1 second
x ¼ zeros(1,length(t));
% Initialize input to be zero
x(1) ¼ 1;
% Set up impulse function
y ¼ filter([0 0.707107],[1 -1.414214 1],x);
% Perform filtering
subplot(2,1,1);plot(t(1:400),y(1:400));grid
ylabel( ' y(n) 1 kHz tone ' ); xlabel( ' time (second) ' )
Ak ¼ 2*abs(fft(y))/length(y);Ak(1) ¼ Ak(1)/2; % One-sided amplitude spectrum
f ¼ [0:1:(length(y)-1)/2]*fs/length(y); % Indices to frequencies (Hz) for plot
subplot(2,1,2);plot(f,Ak(1:(length(y) þ 1)/2));grid
ylabel(
Spectrum for y(n)
); xlabel(
frequency (Hz)
)
'
'
'
'
8.11.2 Dual-Tone Multifrequency Tone Generator
Now that the principle of a single-tone generator is illustrated, we can extend it to develop the DTMF
tone generator using two digital filters in parallel. The DTMF tone generator for key “7” is depicted in
Figure 8.51 .
 
Search WWH ::




Custom Search