Escolar Documentos
Profissional Documentos
Cultura Documentos
Input Sequence
1
0.5 DOWN
Amplitude
-0.5
-1
0 5 10 15 20 25 30 35 40 45 50
Time index n
Output sequence up-sampled by3
1
0.5
Amplitude
-0.5
-1
0 5 10 15 20 25 30 35 40 45 50
Time index n
SAMPLING OPERATION
The program shown below can be used to study down sampling of a sinusoidal
input sequences, the down sampling factor, and the frequency of the sinusoid in
Hz. It then plots the input sequence and its down sampled sampled version.
PROGRAM
% Illustration of Down-Sampling by an Integer Factor
%
clf;
N = input('Output length = ');
M = input('Down-sampling Factor = ');
fo = input('Input signal frequency = ');
% Generate the input sinusoidal sequence
n = 0 : N-1;
m = 0 : N*M-1;
x = sin(2*pi*fo*m);
% Generate the down-sampled sequence
y = x([1 : M : length(x)]);
% Plot the input and the output sequences
subplot(2,1,1)
stem(n, x(1:N));
title('Input Sequence');
xlabel('Time index n');ylabel('Amplitude');
subplot(2,1,2)
stem(n, y);
title(['Output sequence down-sampled by ',num2str(M)]);
ylabel('Amplitude');xlabel('Time index n');
INPUT DATA
Length of the Sequence-50
Frequency: 0.042 Hz
Down sampling factor: 3
INPUT/OUTPUT WAVEFORM
Input Sequence
1
0.5
A m plitude
-0.5
-1
0 5 10 15 20 25 30 35 40 45 50
Time index n
Output sequence down-sampled by 3
1
0.5
A m plitude
-0.5
-1
0 5 10 15 20 25 30 35 40 45 50
Time index n
INPUT/OUTPUT WAVEFORM
Input spectrum
1
Output spectrum
0.9 1
0.9
0.8
0.8
0.7
0.7
0.6
0.6
M ag nitud e
Magnitude
0.5
0.5
0.4
0.4
0.3
0.3
0.2
0.2
0.1 0.1
0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
/ /
0.7 0.4
0.6 0.35
Magnitude
0.5 0.3
Magnitude
0.25
0.4
0.2
0.3
0.15
0.2
0.1
0.1
0.05
0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
/ /
Output spectrum
0.5
0.45
0.4
0.35
M a g n it u d e
0.3
0.25
0.2
0.15
0.1
0.05
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
/
Fig: input spectrum,output spectrum for down sampling factor of M=3,output spectrum for a
down sampling factor of M=2
III. DECIMATION
DECIMATION OPERATION USING MATLAB
INPUT/OUTPUT WAVEFORM
Input sequence
2
1
Amplitude
-1
-2
0 10 20 30 40 50 60 70 80 90 100
Time index n
Output sequence
2
1
Amplitude
-1
-2
0 5 10 15 20 25 30 35 40 45 50
Time index n
IV. INTERPOLATION
INTERPOLATION OPERATION USING MATLAB
To illustrate interpolation process,we consider an input x that is given by a sum of two sinusoidal
sequences. Program is used to find its interpolated output y for an upsampling factor of L. The
input data to th program are the length N of the input vector x,the upsamler factor L,anKd two
normalized frequencies in hz.The frequencies of the sinusoids considered here are the f1=0.043
and f2=0.031,while the interpolation factor is 2.The input length is 50.
PROGRAM:
-1
-2
0 5 10 15 20 25 30 35 40 45 50
Time index n
Output sequence
2
A m p lit u d e
-1
-2
0 10 20 30 40 50 60 70 80 90 100
Time index n
INPUT
Length of input signal = 25
Up-sampling factor = 5
Down-sampling factor = 3
Frequency of first sinusoid = 0.043
Frequency of second sinusoid = 0.031
INPUT/OUTPUT WAVEFORM
Input sequence
2
1
Amplitude
-1
-2
0 5 10 15 20 25
Time index n
Output sequence
2
1
Amplitude
-1
-2
0 5 10 15 20 25 30 35 40
Time index n
INPUT
Type in the filter length = 23
Type in the value of L = 2
INPUT/OUTPUT WAVEFORM
20
-20
Gain, dB
-40
-60
-80
-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
/
The impulse response coefficients of the length -12 linear phase low pass filter 12B
of Johnston are given by
Filter coefficients = -0.006443977 -0.00758164 +0.09808522 +0.02745539 -0.0913825
+0.4807962
Matlab program is used to verify the performance of the above filter H0(z).
PROGRAM
% Program
INPUT
Filter coefficients = -0.006443977 -0.00758164 +0.09808522 +0.02745539 -0.0913825
+0.4807962
INPUTOUTPUT WAVEFORM
-10
-20
G a in in dB
-30
-40
-50
-60
-70
-80
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency
1.4
A m p lit u d e d is t o rt io n in d B
1.2
0.8
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency
Design of a four channel QMF bank by iterating the two-channel QMF bank based on the filter
12B of Johnston
PROGRAM
% Program
% Frequency Responses of Tree-Structured QMF Filters
%
clf;
% Type in prototype lowpass filter coefficients
B = input('Filter coefficients = ');
B1 = [B fliplr(B)];
% Generate the complementary highpass filter
L = length(B1);
for k = 1:L
B2(k) = ((-1)^k)*B1(k);
end
% Determine the coefficients of the four filters
B10 = zeros(1, 2*length(B1));
B10([1: 2: length(B10)]) = B1;
B11 = zeros(1, 2*length(B2));
B11([1: 2: length(B11)]) = B2;
C0 = conv(B1, B10);C1 = conv(B1, B11);
C2 = conv(B2, B10);C3 = conv(B2, B11);
% Determine the frequency responses
[H0z, w] = freqz(C0, 1, 256);
h0 = abs(H0z);
M0 = 20*log10(h0);
[H1z, w] = freqz(C1, 1, 256);
h1 = abs(H1z);
M1 = 20*log10(h1);
[H2z, w] = freqz(C2, 1, 256);
h2 = abs(H2z);
M2 = 20*log10(h2);
[H3z, w] = freqz(C3, 1, 256);
h3 = abs(H3z);
M3 = 20*log10(h3);
plot(w/pi, M0,'r-',w/pi, M1,'b--',w/pi, M3,'g-.',w/pi, M2,'m:');grid
axis([0 1 -100 20]);
xlabel('\omega /\pi');ylabel('Gain, dB')
legend('H_{O}(z)','H_{1}(z)', 'H_{2}(z)', 'H_{3}(z)')
INPUT
20
HO(z)
H1(z)
0
H2(z)
H3(z)
-20
G a in , d B
-40
-60
-80
-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
/