Digital Signal Processing Reference
In-Depth Information
5
2
0
0
-2
-5
-4
0
100
200
300
400
500
0
100
200
300
400
500
5
2
0
0
-2
-5
-4
0
100
200
300
400
500
0
100
200
300
400
500
5
2
0
0
-2
-5
-4
0
100
200
300
400
500
0
100
200
300
400
500
Sample number
Frequency (Hz)
FIGURE 12.26
Signal comparisons in both the time and frequency domains.
fmax
¼
500;fs
¼
1000;T
¼
1/fs; % Maximum frequency, sampling rate, sampling period
fsL
1/fsL;% Oversampling rate and oversampling period
% Sampling at fs
¼
L*fs;TL
¼
¼
1000 Hz
x
¼
C1*sin(2*pi*f1*n*T)
þ
C2*sin(2*pi*f2*T*n
þ
pi/6)
þ
C3*sin(2*pi*f3*T*n
þ
pi/4);
xq
¼
round(x); % Quantized signal at the minimum sampling rate
NN
¼
length(n);
f
¼
[0:ntotal-1]*fs/NN;
M
M/L; % Delay in terms of samples due to anti-aliasing filtering
B
¼
firwd(2*M
þ
1,1,2*pi*fmax/fsL,0,4); % Anti-aliasing filter design (5% transition
% bandwidth)
figure(1);
freqz(B,1,1000,fsL)
% Oversampling
xx
¼
C1*sin(2*pi*f1*nL*TL)
þ
C2*sin(2*pi*f2*nL*TL
þ
pi/6)
þ
C3*sin(2*pi*f3*nL*TL
þ
pi/4);
xxq
¼
round(xx); % Quantized signal
% Down sampling
y
¼
filter(B,1,xxq);% Anti-aliasing filtering
yd
¼
y(1:L:length(y));% Downsample
figure (2)
subplot(3,2,1);plot(n,x,
'
k
'
);grid;axis([0 500 -5 5]);ylabel(
'
x(t)
'
)
Ak
¼
2*abs(fft(x))/NN; Ak(1)
¼
Ak(1)/2;
¼
32*L;nd
¼
Search WWH ::
Custom Search