3
THEORY Upsampling is the process of increasing the sample rate of a digital audio signal. For example, the sample rate of a CD is 44.1 kHz, which means the analog signal is sampled 44,100 times per second. Upsampling by a factor of two increases the sample rate from 44.1 kHz to 88.2 kHz, effectively doubling the number of samples available. The benefit of upsampling the signal widens frequency response. The maximum frequency response of a signal sampled at 44.1 kHz is 22.05 kHz per channel, while a signal sampled at 88.2 kHz has a maximum frequency response of 44.1 kHz per channel. UPSAMPLING BY AN INTEGER FACTOR In this application the filter is called an interpolation filter, and its design is discussed below. When the interpolation filter is an FIR type, its efficiency can be improved, because the zeros contribute nothing to its dot product calculations. It is an easy matter to omit them from both the data stream and the calculations. The calculation performed by an efficient interpolating FIR filter for each output sample is a dot product: where the h[•] sequence is the impulse response, and K is the largest value of k for which h[j+kL] is non-zero. In the case L=2, h[•] can be designed as a half-band filter, where almost half of the coefficients are zero and need not be included in the dot products. Impulse response coefficients taken at intervals of L form a subsequence, and there are L such subsequences (called phases) multiplexed together. Each of L phases of the impulse response is filtering the same sequential values of the x[•] data stream and producing one of L sequential output values. In some multi-processor architectures, these dot products are performed simultaneously, in which case it is called a polyphase filter. For completeness, we now mention that a possible, but unlikely, implementation of each phase is to replace the coefficients of the other phases with zeros in a copy of the h[•] array, and process the sequence at L times faster than the original input rate. L-1 of every L outputs are zero, and the real values are supplied by the other phases. Adding them all together

upsample matlab

Embed Size (px)

DESCRIPTION

matlab

Citation preview

THEORY

Upsampling is the process of increasing the sample rate of a digital audio signal. For example, the sample rate of a CD is 44.1 kHz, which means the analog signal is sampled 44,100 times per second. Upsampling by a factor of two increases the sample rate from 44.1 kHz to 88.2 kHz, effectively doubling the number of samples available. The benefit of upsampling the signal widens frequency response. The maximum frequency response of a signal sampled at 44.1 kHz is 22.05 kHz per channel, while a signal sampled at 88.2 kHz has a maximum frequency response of 44.1 kHz per channel.

UPSAMPLING BY AN INTEGER FACTOR

In this application the filter is called an interpolation filter, and its design is discussed below. When the interpolation filter is an FIR type, its efficiency can be improved, because the zeros contribute nothing to its dot product calculations. It is an easy matter to omit them from both the data stream and the calculations. The calculation performed by an efficient interpolating FIR filter for each output sample is a dot product:

where the h[•] sequence is the impulse response, and K is the largest value of k for which h[j+kL] is non-zero. In the case L=2, h[•] can be designed as a half-band filter, where almost half of the coefficients are zero and need not be included in the dot products. Impulse response coefficients taken at intervals of L form a subsequence, and there are L such subsequences (called phases) multiplexed together. Each of L phases of the impulse response is filtering the same sequential values of the x[•] data stream and producing one of L sequential output values. In some multi-processor architectures, these dot products are performed simultaneously, in which case it is called a polyphase filter.

For completeness, we now mention that a possible, but unlikely, implementation of each phase is to replace the coefficients of the other phases with zeros in a copy of the h[•] array, and process the sequence at L times faster than the original input rate. L-1 of every L outputs are zero, and the real values are supplied by the other phases. Adding them all together produces the desired y[•] sequence. Adding a zero is equivalent to discarding it. The equivalence of computing and discarding L-1 zeros vs computing just every Lth output is known as the second Noble identity.

MATLAB CODE AND IT’S OUTPUTclc;clear all;close all; L=input('Enter upsampling factor - ');f=input('Enter signal frequency - ');fs=100;

t=0:1/fs:0.3;y = sin(2*pi*f*t+pi/3);subplot(2,2,1);stem(y) ;hold on; z = upsample(y,L+1);subplot(2,2,3);stem(z);hold on; y = fft(y);y = fftshift(y);u = length(y);f2 = (-u/2:u/2-1)/u;subplot(2,2,2);plot(f2,abs(y));hold on; z = fft(z);z = fftshift(z);N = length(z);f = [-N/2:N/2-1]/N;subplot(2,2,4);plot(f,abs(z));

VALUES INPUTTED BY USER IN COMMMAND WINDOW

Upsapmling Factor = 3 Signal Frequency = 10