<<

Digital T E (E & TC)

EXPERIMENT NO. 1 SAMPLING & ALIASING

AIM: Write a program to verify the sampling theorem and aliasing effects by sampling an analog signal with various sampling frequencies.

SOFTWARE TOOL: MATLAB. THEORY: Sampling of analog signal: If analog signal x(t) is sampled after every T sec then discrete time signal x(n) is obtained as following

x(n)  xa(nT) where -   n  

The time interval T between successive samples is called the sampling period and Fs = 1/T, is called the sampling rate. Continuous time variable t and discrete time variable n are related through sampling period T (or through sampling rate Fs) as

n t  nT  Fs

Consider analog sinusoidal signal xa(t) of the form

xa(t)  A cos(2  F t )

After sampling xa(t) at a rate Fs =1/T we get

xa(nT )  x(n)  A cos(2  F n T ) 2  n F  A cos( ) Fs From the above equation relationship between frequency variable F for analog signal and frequency variable f for discrete time signal can be established as f  F Fs , f is relative frequency or normalized frequency. The range of frequency variable F for continuous time sinusoid is -   F   and the range of frequency variable f for discrete time sinusoid is -1/2 < f <1/2. Thus periodic sampling of a continuous time signal implies a mapping of an infinite frequency range for the variable F into finite frequency range for the variable f.

As highest normalized frequency in discrete time signal is f =1/2 with sampling rate Fs, the corresponding highest allowed value of F is Fmax= Fs/2 for no aliasing in frequency domain. Aliasing will occur if F > Fmax with analog frequency of F being aliased to a frequency of (F - k Fs) in the range 0 to Fmax.

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 1

Digital Signal Processing T E (E & TC)

Sampling theorem:

If the highest frequency contained in a analog signal xa(t) is Fmax = B and the signal is sampled at a rate Fs > 2 Fmax, then xa(t) can be exactly recovered from its sample values using the interpolation function

sin 2Bt g(t)  2Bt

  n   n  Thus xa(t) may be expressed as xa(t)   xa  gt   n  -   Fs   Fs 

Because of complexity and infinite number of samples required, the above formula cannot be used practically to recover original signal from sampled version. ALGORITHM:

CONCLUSION:

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 2

Digital Signal Processing T E (E & TC)

EXPERIMENT NO. 2

Z & INVERSE Z- TRANSFORM.

AIM: (a) To find Z & inverse Z- transform & pole- zero plot of Z-transfer function.

(b) To solve the difference equation and find the system response using Z-transform.

SOFTWARE TOOL: MATLAB.

THEORY:

In mathematics and signal processing, the Z-transform converts a discrete time-domain signal, which is a sequence of real or complex numbers, into a complex frequency-domain representation. It can be considered as a discrete equivalent of the .

Z-transform, like the Laplace transform, is an indispensable mathematical tool for the design, analysis and monitoring of systems. The z-transform is the discrete-time counter-part of the Laplace transform and a generalization of the of a sampled signal. Like Laplace transform the z-transform allows insight into the transient behavior, the steady state behavior, and the stability of discrete-time systems. A working knowledge of the z-transform is essential to the study of digital filters and systems. This chapter begins with the definition of the Laplace transform and the derivation of the z-transform from the Laplace transform of a discrete-time signal. A useful aspect of the Laplace and the z-transforms are the representation of a system in terms of the locations of the poles and the zeros of the system transfer function in a complex plane.

The Z-transform, like many integral transforms, can be defined as either a one-sided or two-sided transform.

Bilateral Z-transform:The bilateral or two-sided Z-transform of a discrete-time signal x[n] is the function X(z) defined as-

+∞

X(Z) = Z{x(n)} = ∑ x(n). z -n

n= -∞

Where n is an integer and z is, in general, a .

Unilateral Z-transform:

Alternatively, in cases where x[n] is defined only for n ≥ 0, the single-sided or unilateral Z- transform is defined as +∞ X(Z) = Z{x(n)} = ∑ x(n). z -n

n=0

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 3

Digital Signal Processing T E (E & TC)

In signal processing, this definition can be used to evaluate the Z-transform of the unit impulse response of a discrete time causal system.

Region of convergence: The region of convergence (ROC) is the set of points in the complex plane for which the Z-transform summation converges. +∞

X(Z) = Z{x(n)} = │ ∑ x(n). z -n │ < ∞

n= -∞

The stability of a system can be determined by knowing the ROC alone. If the ROC contains the unit circle (i.e. │Z│= 1) then the system is stable.

 If you are provided a Z-transform of a system without an ROC (i.e., an ambiguous) you can determine a unique provided you desire the following: Stability & Causality

For stable system the ROC must contain the unit circle. For causal system the ROC must contain infinity and the system function will be a right-sided sequence. If the system is l anticausal then the ROC must contain the origin and the system function will be a left-sided sequence. For stable and causal, all the poles of the system function must be inside the unit circle.

ALGORITHM:

CONCLUSION:

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 4

Digital Signal Processing T E (E & TC)

EXPERIMENT NO. 3

STABILITY OF DIFFERENT TRANSFER FUNCTIONS

AIM: To plot the poles & zeros of a transfer function when the coefficients of the transfer function are given, also study the stability of different transfer functions.

SOFTWARE TOOL: MATLAB.

THEORY:

Let, x(n)= (0.5)nu[n] −(0.75)nu[−n−1]. has poles at 0.5 and 0.75. The ROC will be 0.5 < |z| < 0.75, which includes neither the origin nor infinity. Such a system is called a mixed-causality system as it contains a causal term (0.5)n u[n] and an anticausal term −(0.75)nu[−n−1].

The stability of a system can also be determined by knowing the ROC alone. If the ROC contains the unit circle (i.e., |z| = 1) then the system is stable. In the above systems the causal system, the system is stable because |z| > 0.5 contains the unit circle.

If you are provided a Z-transform of a system without an ROC (i.e., an ambiguous x[n]) you can determine a unique x[n] provided you desire the following:

 Stability  Causality

If you need stability then the ROC must contain the unit circle. If you need a causal system then the ROC must contain infinity and the system function will be a right-sided sequence. If you need an anticausal system then the ROC must contain the origin and the system function will be a left- sided sequence. If you need both, stability and causality, all the poles of the system function must be inside the unit circle.

 A causal LTI system with a rational transfer function H(Z)is stable if and only if all

poles of are inside the unit circle of the z-plane, i.e., the magnitudes of all poles are smaller than 1.

For Example: The transfer function of an LTI is

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 5

Digital Signal Processing T E (E & TC)

As shown before, without specifying the ROC, this H(Z) could be the z-transform of one of the two possible time signals H(n).

 If ROC is , the system is causal.

 If , i.e., unit circle can be included in ROC, the system is stable;

 If , i.e., unit circle cannot be included in ROC, the system is unstable;

 If ROC is , the system is anti-causal.

 If , i.e., unit circle cannot be included in ROC, the system is unstable;

 If , i.e., unit circle can be included in ROC, the system is stable;

We have a difference equation of the form -

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 6

Digital Signal Processing T E (E & TC)

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 7

Digital Signal Processing T E (E & TC)

Table: Input sequence & criteria for stability.

ALGORITHM:

CONCLUSION:

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 8

Digital Signal Processing T E (E & TC)

EXPERIMENT NO. 4 CIRCULAR CONVOLUTION

AIM: (a) Write a program for linear convolution.

(b) Write a program to find 4 point circular convolution & compare the result with 8 point

circular convolution to study aliasing in time domain.

SOFTWARE TOOL: SCILAB

THEORY:

Convolution:

Convolution is a mathematical operation equivalent to FIR filtering. Convolution is important in DSP because convolution of two sequences in time domain is equivalent to multiplication of two signals in frequency domain.

Consider two sequences x﴾n﴿ and h﴾n﴿ of lengths ‘nx’ and ‘nh’ respectively with lower limit of x﴾n﴿ = xl, upper limit of x﴾n﴿ = xh and lower limit of h﴾n﴿ = hl, upper limit of h﴾n﴿ = hh. Then the - convolution of x﴾n﴿ and h﴾n﴿ is defined as

y(n)  xnhn*h(n)x(n)

   xkhn  k k 

   xn  khk k 

Where, Y(n) = Response of LTI system

x(k) = Input signal

h(n-k)= Impulse response

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 9

Digital Signal Processing T E (E & TC)

Convolution between h(k) & x(k) involves 4 stages:

1. Folding: To fold h(k) about k=0 to obtain h(-k). 2. Shifting: Shift h(-k) by ‘n’ to right (left) if n is positive (negative) to obtain h(n-k). 3. Multiplication: Multiply x(k) by h(n-k) to obtain product sequence.

U(k)=x(k).h(n-k)

4. Summation: sum of all values of product sequence u(k) to obtain value of output at time(t).

ALGORITHM:

CONCLUSION:

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 10

Digital Signal Processing T E (E & TC)

EXPERIMENT NO.5 PROPERTIES OF DFT

AIM: Write a program to study & verify the DFT properties. (Minimum two)

SOFTWARE TOOL: SCILAB

THEORY:

Discrete Fourier Transform- Frequency analysis of discrete time signals is usually & most conveniently performed on a Digital signal Processor, which may be a general purpose digital computer or specially designed digital hardware. To perform frequency analysis on a discrete time signal x(n), we convert time domain sequence to frequency domain representation . Such representation is given by Fourier transform X(w) of the sequence x(n). But , X(w) is a continuous function of frequency & is not computationally convenient representation of sequence x(n) .

Calculation of X(w) on digital computer or processor is impossible. Therefore It is necessary to compute x(w) only at discrete values of w. When Fourier transform is calculated at only at discrete times, it is called as Discrete Fourier Transform. Representation of a sequence x(n) by samples of its spectrum X(w). Such a frequency domain representation leads to DFT, which is a powerful computational tool for performing frequency analysis of discrete time signal.

The discrete Fourier transform, or DFT, is the primary tool of digital signal processing. DFT maps a discrete signal into the frequency domain.

In mathematics, the discrete Fourier transform (DFT) is a specific kind of Fourier transform, used in . It transforms one function into another, which is called the frequency domain representation, or simply the DFT, of the original function (which is often a function in the time domain). But the DFT requires an input function that is discrete and whose non-zero values have a limited (finite) duration. Such inputs are often created by sampling a continuous function, like a person's voice.

DFT of the sequence x(n) is given as -

N-1

X (k) = ∑ x (n) . e-j2πkn/N , k = 0,1,2………N-1

n = 0

& its Inverse DFT (IDFT) is given as –

N-1

x(n) = ∑ X(k) . e j2πkn/N , n = 0,1,2………N-1

k = 0

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 11

Digital Signal Processing T E (E & TC)

Here both X(k)& x(n) contain N no. of samples.

-j2π/N Here, WN = e known as Twiddle Factor.

The input to the DFT is a finite sequence of real or complex numbers (with more abstract generalizations discussed below), making the DFT ideal for processing information stored in computers. In particular, the DFT is widely employed in signal processing and related fields to analyze the frequencies contained in a sampled signal, to solve partial differential equations, and to perform other operations such as convolutions or multiplying large integers.

Applications of DFT:

1) Data compression - The field of digital signal processing relies heavily on operations in the frequency domain (i.e. on the Fourier transform). For example, several lossy image and sound compression methods employ the discrete Fourier transform: the signal is cut into short segments, each is transformed, and then the Fourier coefficients of high frequencies, which are assumed to be unnoticeable, are discarded. The decompressor computes the inverse transform based on this reduced number of Fourier coefficients. (Compression applications often use a specialized form of the DFT, the discrete cosine transform or sometimes the modified discrete cosine transform.) 2) Spectral analysis - When the DFT is used for spectral analysis, the sequence usually represents a finite set of uniformly-spaced time-samples of some signal , where t represents time. The conversion from continuous time to samples (discrete-time) changes the underlying Fourier transform of x(t) into a discrete-time Fourier transform (DTFT), which generally entails a type of called aliasing. Choice of an appropriate sample-rate (see ) is the key to minimizing that distortion. Similarly, the conversion from a very long (or infinite) sequence to a manageable size entails a type of distortion called leakage, which is manifested as a loss of detail (aka resolution) in the DTFT. Choice of an appropriate sub-sequence length is the primary key to minimizing that effect. When the available data (and time to process it) is more than the amount needed to attain the desired frequency resolution, a standard technique is to perform multiple DFTs 3) Partial differential equations 4) Polynomial multiplication 5) Multiplication of large integers.

ALGORITHM:

CONCLUSION:

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 12

Digital Signal Processing T E (E & TC)

EXPERIMENT NO.6 FIR FILTER RESPONSE USING WINDOWS

AIM: To study the effect of different windows on FIR filter response.

SOFTWARE TOOL: SCILAB

THEORY:

1. Rectangular Window:

FIR filters are non-recursive filters as they do not use feedback. Different types of windows are used to design FIR filters.

In the windowing method we begin with the desired frequency response specification Hα(ω) and determine corresponding unit sample response hd(n).hd(n) is related to Hd(w) by FT relation:

-jwn Hd(ω) = Σ hd(n)e dw

n=0

Π

Where, hd(n) = 1\2Π ∫ Hd(w)ejwn dw

Thus the unit sample response hd(n) obtained from the above equation is infinite in duration and must be truncated at some point say at n=m-1 to yield as FIR filter of length m. Truncation of hd(n) to a length m-1 is equivalent to multiplying to hd(n) by a rectangular window.

w(n) = 1 n=0,1,2…….m-1

0 otherwise

Thus the unit sample response of FIR filter becomes,

h(n) = hd(n).w(n)

= hd(n) n = 0,1,2……m-1

= 0 otherwise

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 13

Digital Signal Processing T E (E & TC)

Multiplication of window function w(n)with hd(n) is equivalent to the convolution of Hd(w) with W(w) where W(w) is the frequency domain representation of window function.

W(w) = Σw(n).e-jwn

The convolution of Hd(w) with W(w) has effect of smoothing Hd(w). As m is increased W(w) becomes narrower and the smoothing provided by W(w) is reduced. Thus large sized lobes of W(w) results in some undesirable ringing effect in the FIR filter frequency response H(w) and also relatively large sized lobes in H(w). These undesirable effects are best attenuated by use of windows that do not contain abrupt discontinuities in their time domain characteristics and have correspondingly low side lobes in their frequency domain characteristics.

The DTFT of a rectangular window is shown in figure.

Figure : Rectangular window discrete-time Fourier transform.

Properties of rectangular window.

 Zero crossings at integer multiples of

 Main lobe width is .  As increases, the main lobe narrows (better frequency resolution).

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 14

Digital Signal Processing T E (E & TC)

 has no effect on the height of the side lobes (same as the ``Gibbs phenomenon'' for truncated expansions).  First side lobe only 13 dB down from the main-lobe peak.  Side lobes roll off at approximately 6dB per octave.  A phase term arises when we shift the window to make it causal, while the window transform is real in the zero-phase case (i.e., centered about time 0).

2. Hamming Window :

This window is introduced by R.W. Hamming. It is expressed as

2  n w(n)  0.54  0.46cos(  for 0  n  N-1 Ν 1  0 otherwise

The frequency response of Hamming window is calculated using FT as

N 1  2  n   j n W()  0.54  0.46cos(   e  Ν 1 n  0 

ALGORITHM:

CONCLUSION:

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 15

Digital Signal Processing T E (E & TC)

EXPERIMENT NO.7 DESIGN OF BUTTERWORTH FILTER USING BILINEAR TRANSFORMATION METHOD

AIM: Design Butterworth filter using Bilinear transformation method for LPF and write a program to draw the frequency response of the filter.

SOFTWARE TOOL: SCILAB

THEORY:

The Butterworth filter is a type of signal processing filter designed to have as flat a frequency response as possible in the passband. It is also referred to as a maximally flat magnitude filter. The Butterworth filter is simple to understand and suitable for applications such as audio processing.

Order – N of the filter is given as -

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 16

Digital Signal Processing T E (E & TC)

Table II : Butterworth polynomials

The :

The Bilinear transform is a mathematical relationship which can be used to convert the transfer function of a particular filter in the complex Laplace domain into the z-domain, and vice-versa. The resulting filter will have the same characteristics of the original filter, but can be implemented using different techniques. The Laplace Domain is better suited for designing analog filter components, while the Z-Transform is better suited for designing digital filter components.

The bilinear transform is the result of a numerical integration of the analog transfer function into the digital domain. We can define the bilinear transform as:

The bilinear transform can be used to produce a piecewise constant magnitude response that approximates the magnitude response of an equivalent analog filter. The bilinear transform does not faithfully reproduce the analog filters phase response.

Prewarping Effect:

Frequency warping follows a known pattern, and there is a known relationship between the warped frequency and the known frequency. We can use a technique called prewarping to account for the nonlinearity, and produce a more faithful mapping.

The p subscript denotes the prewarped version of the same frequency. PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 17

Digital Signal Processing T E (E & TC)

Properties of the Butterworth filter are:

 Monotonic amplitude response in both passband and stopband  Quick roll-off around the cutoff frequency, which improves with increasing order  Considerable overshoot and ringing in step response, which worsens with increasing order  Slightly non-linear phase response  Group delay largely frequency-dependent

Figure: Frequency response of Butterworth Filter

ALGORITHM:

CONCLUSION:

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 18

Digital Signal Processing T E (E & TC)

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 19

Digital Signal Processing T E (E & TC)

EXPERIMENT NO.9 MUSICAL TONE GENERATION

AIM: Write a program for musical tone generation.

SOFTWARE TOOL: SCILAB

THEORY: Digital signal Processing has various applications in real world such as –

Image Processing, Instrumentation /Control, Speech/Audio, Military, Pattern recognition, spectrum analysis, speech recognition, secure communications, noise reduction, speech synthesis, radar processing, Image enhancement, data compression, text to speech, sonar processing, patient monitoring, ECG Analysis, X-Ray storage/enhancement, ADPCM trans-coders EEG brain mappers, Echo cancellation, Video conferencing, digital cameras etc.

Musical tone generation is one of the application of Digital signal Processing

Digital audio technologies are used in the recording, manipulation, mass-production, and distribution of sound, including recordings of songs, instrumental pieces, sound effects, and other sounds. Modern online music distribution depends on and data compression.

A system starts with an ADC that converts an analog signal to a digital signal. The ADC runs at a specified sampling rate and converts at a known bit resolution. CD audio, for example, has a sampling rate of 44.1 kHz (44,100 samples per second), and has 16-bit resolution for each stereo channel. Analog signals that have not already been band limited must be passed through an anti-aliasing filter before conversion, to prevent the distortion that is caused by audio signals with frequencies higher than the Nyquist frequency, which is half of the system's sampling rate.

A digital audio signal may be stored or transmitted. Digital audio can be stored on a CD, a digital audio player, a hard drive, a USB flash drive, or any other digital data storage device. The digital signal may then be altered through digital signal processing, where it may be filtered or have effects applied. Audio data compression techniques, such as MP3, Advanced Audio Coding, are commonly employed to reduce the file size. Digital audio can be streamed to other devices.

For playback, digital audio must be converted back to an analog signal with a DAC. DACs run at a specific sampling rate and bit resolution, but may use , up sampling or down sampling to convert signals that have been encoded with a different sampling rate.

Before digital audio, the music industry distributed and sold music by selling physical copies in the form of records and cassette tapes. With digital audio and online distribution systems such as iTunes, companies sell digital sound files to consumers, which the consumer receives over the Internet. This digital audio/Internet distribution model is much less expensive than producing physical copies of recordings, packaging them and shipping them to stores.

Here, we have generated & played sound for letters sa, re, ga, ma, pa, da, ni, sa having various frequencies for respective letter.

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 20

Digital Signal Processing T E (E & TC)

Figure: Conversion & processing of sound signal

All musical programs are produced in basically two stages. First, sound from each individual instrument is recorded in an acoustically inert studio on a single track of a multitrack tape recorder. Then, the signals from each track are manipulated by the sound engineer to add special audio effects and are combined in a mix-down system to finally generate the stereo recording on a two- track tape recorder. The audio effects are artificially generated using various signal processing circuits and devices, and they are increasingly being performed using digital signal processing techniques.

ALGORITHM:

CONCLUSION:

PES‘s Modern College of Engineering Department of Electronics & Telecommunication Engineering. 21