You are on page 1of 103

MSc ELECTRONICS Communication and DSP Lab

INDEX

PAGE
SL NO NAME OF EXPERIMENT DATE
NO
DSP LAB
FAMILIARIZATION OF MATLAB

1 MATRIX ADDITION

2 MATRIX SUBTRACTION

3 MATRIX MULTIPLICATION

4 INVERSE OF A MATRIX

DISCRETE TIME SIGNALS

5 UNIT IMPULSE SIGNAL

6 UNIT STEP SIGNAL

7 RAMP SIGNAL

8 EXPONENTIAL SIGNAL

9 IMPULSE RESPONSE

10 CONVOLUTION

11 LINEAR CONVOLUTION

12 CIRCULAR CONVOLUTION

FAST FOURIER TRANSFORM

13 FFT

INTRODUCTION TO SAMPLING

14 VERIFICATION OF SAMPLING THEOREM

Department of Electronics 1 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PAGE
SL NO NAME OF EXPERIMENT DATE
NO
DESIGN OF IIR FILTER

15 IIR BUTTORWORTH LOWPASS FILTER

16 IIR BUTTORWORTH HIGHPASS FILTER

17 IIR CHEBYSHEV LOWPASS FILTER

18 IIR CHEBYSHEV HIGHPASS FILTER

COMMUNICATION LAB
INTRODUCTION TO SIMULINK

1 AMPLITUDE MODULATION

2 AM DEMODULATION

3 PULSE AMPLITUDE MODULATION

4 FREQUENCY SHIFT KEYING

Department of Electronics 2 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

DIGITAL SIGNAL PROCESSING

Department of Electronics 3 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

FAMILIARIZATION OF MATLAB

MATLAB is an interactive program for doing matrix calculations and has now grown to
a high-level mathematical language that can solve integrals and differential equations
numerically and plot a wide variety of two- and three-dimensional graphs.

A) Definition of Variables
Variables are assigned numerical values by typing the expression directly. The answer
will not be displayed when a semicolon is put at the end of an expression.

MATLAB utilizes the following arithmetic operators:


+ - Addition

- - Subtraction

* - Multiplication

/ - Division

^ - Power operator

' - Transpose

A variable can be assigned using a formula that utilizes these operators and either
numbers or previously defined variables. To determine the value of a previously defined
quantity, type the quantity by itself. If your expression does not fit on one line, use an ellipsis
(three or more periods at the end of the line) and continue on the next line. There are several
predefined variables which can be used at any time, in the same manner as user defined
variables:

i - sqrt(-1)

j - sqrt(-1)

pi - 3.1416...

Department of Electronics 4 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

There are also a number of predefined functions that can be used when defining a
variable. Some common functions that are used in this text are:
abs - magnitude of a number (absolute value for real numbers)

angle - angle of a complex number, in radians

cos - cosine function, assumes argument is in radians

sin - sine function, assumes argument is in radians

exp - exponential function(can be used on complex numbers).

B) Definition of Matrices
MATLAB is based on matrix and vector algebra; even scalars are treated as 1x1 matrices.
Therefore, vector and matrix operations are as simple as common calculator operations.

Vectors can be defined in two ways. The first method is used for arbitrary elements.
v = [1 3 5 7];
creates a 1x4 vector with elements 1, 3, 5 and 7. Note that commas could have been used in
place of spaces to separate the elements. Additional elements can be added to the vector,
v(5) = 8;
yields the vector v = [1 3 5 7 8]. Previously defined vectors can be used to define a new
vector.

The second method is used for creating vectors with equally spaced elements.
t = 0:0.1:10;
creates a 1x11 vector with the elements 0, .1, .2, .3,..., 10. Note that the middle number defines
the increment. If only two numbers are given, then the increment is set to a default of 1.
k = 0:10;
creates a 1x11 vector with the elements 0, 1, 2, ..., 10.Matrices are defined by entering the
elements row by row.
M = [1 2 4; 3 6 8];

Department of Electronics 5 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

creates the matrix


M = [1 2 4]
[3 6 8]

There are a number of special matrices that can be defined as follows.


Null matrix: M = [ ];
nxm matrix of zeros: M = zeros(n,m);
nxm matrix of ones: M = ones(n,m);
nxn identity matrix: M = eye(n);

A particular element of a matrix can be assigned as,


M (1, 2) = 5;
places the number 5 in the first row, second column. Operations and functions that were
defined for scalars in the previous section can also be used on vectors and matrices.
Functions are applied element by element.
For example,
t = 0:10;
x = cos(2*t);

creates a vector x with elements equal to cos(2t) for t = 0, 1, 2, ..., 10.

Operations that need to be performed element-by-element can be accomplished by


preceding the operation by a ".". For example, to obtain a vector x that contains the elements
of x(t) = tcos(t) at specific points in time, you cannot simply multiply the vector t with the
vector cos(t). Instead you multiply their elements together:
t = 0:10;
x = t.*cos(t);

Department of Electronics 6 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

C) General Information
MATLAB is case sensitive so "a" and "A" are two different names. Comment statements
are preceded by a "%". On-line help for MATLAB can be reached by typing help for the full
menu or typing help followed by a particular function name or M-file name. For example, help
cos gives help on the cosine function.

The number of digits displayed is not related to the accuracy. To change the format of the
display, type format short e for scientific notation with 5 decimal places, format long e for
scientific notation with 15 significant decimal places and format bank for placing two
significant digits to the right of the decimal.

The commands who and whos give the names of the variables that have been defined in
the workspace. The command length(x) returns the length of a vector x and size(x) returns the
dimension of the matrix x.

D) M-files
M-files are macros of MATLAB commands that are stored as ordinary text files with
the extension "m", that is filename. An M-file can be either a function with input and output
variables or a list of commands.

The following describes the use of M-files on a PC version of MATLAB. MATLAB


requires that the M-file must be stored either in the working directory or in a directory that is
specified in the MATLAB path list. For example, consider using MATLAB on a PC with a
user-defined M-file stored in a directory called "\MATLAB\MFILES". Then to access that M-
file, either changes the working directory by typing cd\matlab\mfiles from within the
MATLAB command window or by adding the directory to the path. Permanent addition to the
path is accomplished by editing the \MATLAB\matlabrc.m file, while temporary modification
to the path is accomplished by typing addpath c:\matlab\mfiles from within MATLAB.

MATLAB M-files are most efficient when written in a way that utilizes matrix or vector
operations. Loops and if statements are available, but should be used sparingly since

Department of Electronics 7 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

they are computationally inefficient. An if statement can be used to define conditional


statements.

The allowable comparisons between expressions are >=, <=, <, >, ==, and ~=. Suppose that
you want to run an M-file with different values of a variable T. The following command line
within the M-file defines the value.
T = input ('Input the value of T: ')
Whatever comment is between the quotation marks are displayed to the screen when the M-
file is running, and the user must enter an appropriate value.

Department of Electronics 8 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

HOW TO GET STARTED

Double click on icon for MATLAB 6.5. Within about 30 seconds MATLAB will open, a
screen like the picture below appears.

This is the MATLAB screen. It has broken into 3 parts.

▪ Command Window – This is where you can type commands and usually the answers
(or error messages) appear here too. You will see the cursor flickering after the >>
prompt. This means that MATLAB is waiting for further instructions.

▪ Workspace – if you define new quantities (called variables) their names should be listed
here.

Department of Electronics 9 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

▪ Command History – This is past commands are remembered. If you want to re-run a
previous command or to edit it you can drag it from this window to the command
window to re-run it.

To begin to use MATLAB, click New:M-file from the File menu. This opens a blank window
as shown below.

The M-file is executed using the Run command under the Tools menu. The output signal
appears in Figure Window

Department of Electronics 10 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

The output data appears in Command Window.

Department of Electronics 11 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp. No: 01 Date: 10-09-13

MATRIX ADDITION

AIM
Write an algorithm & program to add two matrices and display the result using Matlab.

ALGORITHM

1. Start.

2. Enter the first matrix.

3. Enter the second matrix.

4. Add the two matrices to obtain the result.

5. Display the result.

6. Stop.

Department of Electronics 12 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM

clc;
clear all;
close all;
x=input('Enter the First Matrix');
y=input('Enter the Second Matrix');
z=x+y;
disp(z);

OUTPUT

Enter the First Matrix :[1 2; 3 4]


Enter the Second Matrix :[4 5; 6 7]
57
9 11

RESULT
Matrix addition is performed and the result is displayed

Department of Electronics 13 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp.No:02 Date: 10-09-13

MATRIX SUBTRACTION

AIM
Write an algorithm& program to add two matrices and display the result using Matlab.

ALGORITHM
1. Start.

2. Enter the first matrix.

3. Enter the second matrix.

4. Subtract second matrix from first to obtain the result.

5. Display the result.

6. Stop.

Department of Electronics 14 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM
clc;
clear all;
close all;
X=input(„Enter the first matrix:‟);
Y=input(„Enter the second matrix:‟);
Z=x-y;
disp(z);

OUTPUT

Enter the first matrix :[4 5; 6 7]


Enter the second matrix: [4 2; 1 7]
0 3
5 0

RESULT

Matrix Subtraction is performed and the result is displayed.

Department of Electronics 15 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp.No:03 Date: 10-09-13

MATRIX MULTIPLICATION

AIM
Write an algorithm& program to PERFORM Matrix multiplication and display the result using
Matlab.

ALGORITHM
1. Start.

2. Enter the first matrix.

3. Enter the second matrix.

4. Multiply the two matrices

5. Display the result.

6. Stop.

Department of Electronics 16 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM

clc;
close all;
clear all;
x=input('Enter the First Matrix :');
y=input('Enter the Second Matrix :');
z=x*y;
disp('Ans:');
disp(z);

OUTPUT

Enter the First Matrix :[4 2 5 6; 5 6 7 8; 7 8 4 5]


Enter the Second Matrix :[5 6 ; 7 3; 5 2; 6 7]
Ans:
95 82
150 118
141 109

RESULT
Matrix multiplication is performed and result is displayed

Department of Electronics 17 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp.No.04 Date: 10-09-13

INVERSE OF THE MATRIX

AIM
Write an algorithm & program to find the inverse of the matrix using Matlab.

ALGORITHM
1. Start.

2. Enter the matrix.

3. Find inverse of the matrix.

5. Stop.

Department of Electronics 18 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM
clc;
clear all;
close all;
x=input(„Enter the matrix:‟);
z=inv(x);
disp(z);

OUTPUT

Enter the matrix:[1 2; 3 4]


-2.0000 1.0000
1.5000 -0.5000

RESULT
Inverse matrix operation is performed and result is displayed

Department of Electronics 19 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

DISCRETE TIME SIGNALS

A discrete time signal, x(n),is a function of an independent variable where the


independent variable is an integer. A discrete time signal is not defined at instants between two
successive samples. Also, x(n) is not equal to zero if n is not an integer. Simply the signal x(n)
is not defined for non-integer values of n. A discrete time signal is defined for every integer
value of n in the range – ∞ < n < ∞. Since a discrete time signal is represented by a set of
numbers it is also called a sequence.

Some elementary discrete-time signals


1. Digital impulse signal or unit sample sequence
The unit sample sequence is denoted as ∂(n) and is defined as
∂(n) =1 for n = 0
0 for n ≠ 0
In words, unit sample sequence is a signal that is zero everywhere, except at n=0 where its
value is unity. This signal is sometimes referred to as a unit impulse.

Delayed impulse ∂1(n) = ∂(n-d) = 1 for n = d

0 for n ≠ d

Department of Electronics 20 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

2. Unit step signal


The unit step signal is denoted as u(n) and is defined as
u(n) =1 for n ≥ 0
0 for n < 0

3. Ramp signal
The unit ramp signal is denoted as ur(n) and is denoted as
ur(n)=n for n ≥ 0
0 for n < 0

4. Exponential signal
The exponential signal is a sequence of the form
x(n) = an for all n

Department of Electronics 21 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

If the parameter a is real, then x(n) is a real signal. We can express x(n) for various values
of the parameter a.
If the parameter a is complex valued, it can be expressed as
a = rejθ
where r and θ are now the parameters.

5. Sine signal
A discrete time sine signal may be expressed as
x(n) = A sin (n + θ) , - ∞ < n < ∞........... (1)
where n is an integer variable(called the sample number),
A is the amplitude of the signal,
 is the frequency in radians per sample, and
θ is the phase in radians.
If instead of  we use the frequency variable f defined by
 ≡2f
The relation (1) becomes 
x(n) = A sin (2f n + θ ) , -∞ < n< ∞
The frequency f has dimensions of cycles per sample.

6. Cosine signal
A discrete time cosine signal may be expressed as
x(n) = A cos (n + θ) , - ∞ < n < ∞ ........... (2)
where n is an integer variable(called the sample number),

Department of Electronics 22 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

A is the amplitude of the signal,


 is the frequency in radians per sample, and
θ is the phase in radians.
If instead of  we use the frequency variable f defined by
 ≡ 2f
The relation (2) becomes
x(n) = A cos (2f n + θ ) , -∞ < n< ∞

The frequency f has dimensions of cycles per sample.

Department of Electronics 23 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp.No.05 Date: 13-09-13

UNIT IMPULSE SIGNAL

AIM
To write a program that plot unit impulse signal using MATLAB

ALGORITHM

1. Start.

2. Enter the limit of unit impulse signal

3. Plot the unit impulse signal

4. Stop.

Department of Electronics 24 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM

clc;
clear all;
close all;
i=input('Enter the lower limit :');
j=input('Enter the upper limit :');
n=-i:j;
y=[zeros(1,i),1,zeros(1,j)];
stem(n,y);
xlabel('n');
ylabel('y(n)');
title('Impulse Signal');

Department of Electronics 25 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT

Enter the lower limit :10


Enter the upper limit :10

RESULT
The unit impulse signal is generated and displayed

Department of Electronics 26 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp.No.06 Date: 13-09-13

UNIT STEP SIGNAL

AIM
To write a program that plot unit step signal using MATLAB

ALGORITHM

1. Start.

2. Enter the limit of unit step signal

3. Plot the unit step signal

4. Stop.

Department of Electronics 27 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM

clc;
clear all;
close all;
i=input('Enter the limit :');
n=-i:i;
y=[zeros(1,i),1,ones(1,i)];
stem(n,y);
xlabel('n');
ylabel('y(n)');
title('Unit Step Signal');

Department of Electronics 28 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT
Enter limit :10

RESULT
The unit step signal is generated and displayed

Department of Electronics 29 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp.No.07 Date: 13-09-13

RAMP SIGNAL

AIM
To write a program that plot Ramp signal using MATLAB

ALGORITHM

1. Start.

2. Enter the limit of Ramp signal

3. Plot the Ramp signal

4. Stop.

Department of Electronics 30 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM

clc;
clear all;
close all;
i=input('ENter the limit :');
n=0:i;
y=n;
stem(n,y);
xlabel('n');
ylabel('y(n)');
title('Ramp Signal');

Department of Electronics 31 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT

Enter the limit:12

RESULT
The Ramp signal is generated and displayed

Department of Electronics 32 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp.No.08 Date: 13-09-13

EXPONENTIAL SIGNAL

AIM
To write a program that plot Exponential signal using MATLAB

ALGORITHM

1. Start.

2. Enter the limit of Exponential signal

3. Plot the Exponential signal

4. Stop.

Department of Electronics 33 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM

clc;
clear all;
close all;
i=input('Enter the limit :');
n=-i:i;
x=exp(1/2*n);
y=exp(-1/2*n);
subplot(2,1,1);
stem(n,x);
xlabel('n');
ylabel('x(n)');
title('Growing Exponential Signal');
subplot(2,1,2);
stem(n,y);
xlabel('n');
ylabel('y(n)');
title('Decaying Exponential Signal');

Department of Electronics 34 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT
Enter the limit :12

RESULT
The Exponential signal is generated and displayed

Department of Electronics 35 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp. No.09 Date: 13-09-13

IMPULSE RESPONSE

AIM
Write a program to evaluate the impulse response of the system described by the differential
equation

y(n)+0.71y(n-1)-0.46y(n-2)-0.62y(n-3) = 0.9x(n)-0.45x(n-1) +0.35x(n-2) +0.002x(n-3)

ALGORITHM

1.Start

2. Enter number of samples

3. Find the impulse response for the given system

3.Plot the impulse response

6.Stop

Department of Electronics 36 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM
clc;
close all;
clear all;
x=[0.9 -0.45 0.35 .002];
y=[1 0.71 -0.46 -0.62];
N=input('Enter the no. of samples :');
h=impz(x,y,N);
subplot(2,1,1)
stem(0:N-1,h);
xlabel('samples');
ylabel('amplitude');
title('Impulse Response using "impz" function');
d=[1 zeros(1,N-1)];
h1=filter(x,y,d);
subplot(2,1,2);
stem(0:N-1,h1);
xlabel('samples');
ylabel('amplitude');
title('Impulse Response using "filter" function');

Department of Electronics 37 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT

Enter the no. of samples: 50

RESULT

The impulse response for the given system is evaluated

Department of Electronics 38 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp. No.10 Date: 17-09-13

LINEAR CONVOLUTION

AIM
Write an algorithm and program to find the linear convolution of the input sequence using
Matlab.

ALGORITHM

1.Start

2. Enter the 1st sequence x(n)

3. Enter the 2nd sequence h(n)

4.Perform linear convolution

5.Plot the graph for input sequences x(n), h(n) and output sequence y(n)

6.Stop

Department of Electronics 39 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM
clc ;
clear all;
close all;
x=input('Enter the first sequence : ');
h=input('Enter the second sequence : ');
k=length(x);
l=length(h);
n=k+l-1;
subplot(3,1,1);
stem(0:k-1,x);
title('Input Sequence x(n)');
xlabel('No. of samples');
ylabel('x(n)');
subplot(3,1,2);
stem(0:l-1,h);
xlabel('No. of samples');
ylabel('h(n)');
title('Impulse Response h(n)');
y=conv(x,h);
disp('Output=');
disp(y);
subplot(3,1,3);
stem(0:n-1,y);
title('Convolved Signal y(n)=x(n)*h(n)');
xlabel('No. of samples');
ylabel('y(n)');

Department of Electronics 40 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT
Enter the first sequence: [3 5 2 6 7 8 9]
Enter the second sequence: [4 6 2 3 8 9 1 4]
Output=
12 38 44 55 107 159 180 174 174 168 175 117 41 36

RESULT
Obtained linear convolution of the given input sequence and plotted the sequences

Department of Electronics 41 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp. No.10 Date: 17-09-13

CIRCULAR CONVOLUTION

AIM
Write an algorithm and program to find the circular convolution of the input sequence using
Matlab.

ALGORITHM

1.Start

2. Enter the 1st sequence x(n)

3. Enter the 2nd sequence h(n)

4.Perform circular convolution

5.Plot the graph for input sequences x(n), h(n) and output sequence y(n)

6.Stop

Department of Electronics 42 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM

clc;
close all;
x=input('Enter the first sequence : ');
h=input('Enter the second sequence : ');
k=length(x);
l=length(h);
n=max(l,k);
subplot(3,1,1);
stem(0:k-1,x);
title('Input Sequence x(n)');
xlabel('No. of samples');
ylabel('x(n)');
subplot(3,1,2);
stem(0:l-1,h);
xlabel('No. of samples');
ylabel('h(n)');
title('Impulse Response h(n)');
y=cconv(x,h,n);
disp('Output =');
disp(y);
subplot(3,1,3);
stem(0:n-1,y);
title('Convolved Signal y(n)=x(n)*h(n)');
xlabel('No. of samples');
ylabel('y(n)');

Department of Electronics 43 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT

Enter the first sequence: [3 2 1 5 6 7 8 4]

Enter the second sequence: [4 1 2 6 7 4 2 9]

Output =

156 159 177 171 159 156 138 144

RESULT
Obtained circular convolution of the given input sequence and plotted the sequences

Department of Electronics 44 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

FAST FOURIER TRANSFORM (FFT)

The discrete Fourier Transform (DFT) of a discrete time signal x(n) is a finite duration
discrete frequency sequence. The DFT sequence is denoted by X(k). The DFT is obtained by
sampling one period of the Fourier Transform X() of the signal x(n) at a finite number of
frequency points. This sampling is conventionally performed at N equally spaced points in the
period       =     −

The Fourier Transform of a discrete time signal is continuous function of w and so


cannot be processed by digital system. The discrete Fourier Transform (DFT) converts the
continuous function of „‟ to a discrete function of „‟. Thus DFT allows us to perform
frequency analysis on a digital computer.

The N-point DFT of a finite duration sequence x(n) of length L, where N  L, is defined as

The Fast Fourier transform (FFT) is a method for computing the DFT with reduced
number of calculations. The computation efficiency is achieved if we adopt a divide and
conquer approach. This approach is based on the decomposition of an N-point DFT into
successively smaller DFTs. This basic approach leads to a family of an efficient computation
algorithm known as FFT algorithm.

In an N-point sequence, if N can be expressed as N=rm, then the sequence can be


decimated into r-point sequences. For each r-point sequence, r-point DFT can be computed.
From the result of r-point DFT, r²-point DFTs are computed. From the result of r²-point DFTs,
the r³-point DFTs are computed and so on, until we get rm point DFT. In computing N-point
DFT by this method the number of stages of computation will be m times. The number r is
called the radix of the FFT algorithm.

Department of Electronics 45 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

In radix-2 FFT the N-point sequence is decimated into 2-point sequences and the 2- point
DFT for each decimated sequence is computed. From the results of 2-point DFTs, the 4-point
DFTs can be computed. From the result of 4-point DFT, the 8-point DFT can be computed and
so on, until we get N-point DFT.

Department of Electronics 46 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp.No: 13 Date: 30-09-13

FAST FOURIER TRANSFORM

AIM
Develop a program to find the FFT of the given signal and plot the graph.

ALGORITHM

1.Start

2. Read the input signals

3. Add the input signals to generate the mixed signal.

4.Perform FFT on the mixed signal

5. Plot the amplitude spectrum.

6.Stop

Department of Electronics 47 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM

clc;
close all;
clear all;
fs=1000;
Ts=1/fs;
n=2000;
t=(0:n-1)*Ts;
f1=20;
f2=40;
f3=70;
x1=6*sin(2*pi*f1*t);
x2=5*sin(2*pi*f2*t);
x3=8*sin(2*pi*f3*t);
x=x1+x2+x3;
figure(1);
subplot(3,1,1);
plot(t,x1);
xlabel('Time');
ylabel('Amplitude');
title('20Hz Signal');
subplot(3,1,2);
plot(t,x2);
xlabel('Time');
ylabel('Amplitude');
title('40Hz Signal');
subplot(3,1,3);
plot(t,x3);
xlabel('Time');
ylabel('Amplitude');
title('70Hz Signal');

Department of Electronics 48 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

figure(2);
subplot(2,1,1);
plot(t,x);
xlabel('Time');
ylabel('Amplitude');
title('Mixed Signal X(t)');
f=fs*(1:(n/2))/n;
y=fft(x);
p1=abs(y/n);
p2=p1(1:n/2);
subplot(2,1,2);
plot(f,p2);
axis([0 500 0 5]);
xlabel('Frequency');
ylabel('|X(t)|');
title('Amplitude spectrum of Mixed Signal X(t)');

Department of Electronics 49 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT

Department of Electronics 50 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

RESULT
Generated the FFT of the mixed signal wave signal and verified the frequency
components.

Department of Electronics 51 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

INTRODUCTION TO SAMPLING

Sampling is the conversion of a continuous-time signal into discrete-time signal obtained


by taking “samples” of the continuous-time signal at discrete-time instants. Thus, if xa(t) is the
input to the samples, the output is
xa(nT) = x(n),
Where T is called sampling interval.

If the highest frequency obtained in an analog signal xa(t) is fmax. The sampling rate
fs = fmax is called the Nyquist rate.

If the sampling rate is higher than the Nyquist rate, it is called Over-sampling. On the
other hand, if the sampling rate is lower than the Nyquist rate, it is called under-sampling.
Finally, if the sampling rate is exactly equal to the Nyquist rate, it is called critical sampling.

Sampling theorem
“A continuous-time signal may be completely represented in its samples and recovered
back if the sampling if the sampling frequency is fs 2fmax. Here fs is the sampling frequency
and fmax is the maximum frequency present in the signal.”

Department of Electronics 52 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp.No.14 Date: 04-10-13

VERIFICATION OF SAMPLING THEOREM

AIM
Write a program to sample a signal having frequency 0.02 and plot the output wave forms of
the three conditions given below

1) fs=2*fm
2) fs>2*fm
3) fs<2*fm

PROGRAM

clc;
clear all;
close all;
t=-100:0.01:100;
fm=0.02;
x=cos(2*pi*fm*t);
subplot(2,2,1);
plot(t,x);
xlabel(' time in seconds');
ylabel('x(t)');
title('Original Signal');

fs1=0.02; %fs<2fm%
n1=-2:2;
x1=cos(2*pi*fm*n1/fs1);
subplot(2,2,2);
stem(n1,x1);
hold on;

Department of Electronics 53 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

subplot(2,2,2);
plot(n1,x1,':');
xlabel('n1');
ylabel('x(n1)');
title('Discrete Time Signal for fs<2fm');

fs2=0.04; %fs=2fm%
n2=-4:4;
x2=cos(2*pi*fm*n2/fs2);
subplot(2,2,3);
stem(n2,x2);
hold on;
plot(n2,x2,':');
xlabel('n2');
ylabel('x(n2)');
title('Discrete Time Signal for fs=2fm');

fs3=0.5; %fs3>2fm%
n3=-50:50;
x3=cos(2*pi*(fm/fs3)*n3);
subplot(2,2,4);
stem(n3,x3);
hold on;
plot(n3,x3,':');
xlabel('n3');
ylabel('x(n3)');
title('Discrete Time Signal for fs>2fm');

Department of Electronics 54 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT

RESULT

Generated sampled signals of given signal and verified Sampling Theoem

Department of Electronics 55 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp. No: 17 Date: 14-10-13

IIR BUTTERWORTH LOW PASS FILTER

AIM
Write a program to design an IIR Butterworth Lowpass filter and plot its amplitude &
phase responses

ALGORITHM

1. Start.

2. Enter pass band frequency, stop band frequency, pass band ripple, minimum stop band
attenuation and sampling frequency.

3. Find normalized pass band frequency (Wp) and normalized stop band frequency (Ws).

4. Find order and cut off frequency of the butterworth filter using function “buttord‟.

5. Find butterworth filter coefficients using function „butter‟.

6. Find frequency response of the filter using function “freqz‟.

7. Find out gain (in dB) and pass angle in (in radian) using frequency response.

8. Plot amplitude response, phase response .

9. Stop.

Department of Electronics 56 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM

clc;
close all;
clear all;
fp=input('Enter the pass band frequency :');
fs=input('Enter the stop band frequency :');
f=input('Enter the sampling frequency :');
rp=input('Enter the passband ripple :');
rs=input('Enter the stopband ripple :');
wp=fp/f;
ws=fs/f;
[N,Wn]=buttord(wp,ws,rp,rs);
[b,a]=butter(N,Wn,'low');
n=0:0.1:pi;
[h,ohm]=freqz(b,a,n);
gain=20*log10(abs(h));
ang=angle(h);
subplot(2,1,1);
plot(ohm/pi,gain);
grid;
xlabel('Normalized Frequency');
ylabel('gain(dB)');
title('Frequency Response');
subplot(2,1,2);
plot(ohm/pi,ang);
grid;
xlabel('Normalised frequency');
ylabel('Phase');
title('Phase Response');

Department of Electronics 57 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT
Enter passband frequency :400
Enter stopband frequency :800
Enter sampling frequency :2000
Enter passband ripple:.4

Enter stopband ripple :30

RESULT
Designed an IIR Butterworth Low pass filter and plotted its responses

Department of Electronics 58 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp.No: 18 Date: 18-10-13

IIR BUTTERWORTH HIGH PASS FILTER

AIM
Write a program to design an IIR Butterworth High Pass Filter and plot its amplitude &
phase responses and pole-zero plot.

ALGORITHM
1. Start.

2. Enter pass band frequency, stop band frequency, pass band ripple, minimum stop band
attenuation and sampling frequency.

3. Find normalized pass band frequency (Wp) and normalized stop band frequency (Ws).

4. Find order and cut off frequency of the butterworth filter using function “buttord‟.

5. Find butterworth filter coefficients using function “butter‟.

6. Find frequency response of the filter using function “freqz‟.

7. Find out gain (in dB) and pass angle in (in radian) using frequency response.

8. Plot amplitude response, phase response.

9. Stop.

Department of Electronics 59 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM
clc;
clear all;
close all;
Fp=input('Enter passband frequency :');
Fs=input('Enter stopband frequency :');
Ft=input('Enter sampling frequency :');
Rp=input('Enter passband attenuation :');
Rs=input('Enter Min stopband attenuation :');
Wp=(2*Fp)/Ft;
Ws=(2*Fs)/Ft;
[N,Wn]=buttord(Wp,Ws,Rp,Rs);
[b,a]=butter(N,Wn,'high');
w=[0:0.01:pi];
[h,omega]=freqz(b,a,w);
gain=20*log10(abs(h));
ang=angle(h);
subplot(2,1,1);
plot(omega/pi,gain);grid;
xlabel('Normalised frequency(Hz)');
ylabel('gain in dB');
title('Frequency response');
subplot(2,1,2);
plot(omega/pi,ang);grid;
xlabel('Normalised frequency(Hz)');
ylabel('Phase in radians');
title('Phase response');

Department of Electronics 60 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT
Enter passband frequency :500

Enter stopband frequency :1000


Enter sampling frequency :2000
Enter passband attenuation :0.2

Enter Min stopband attenuation :40

RESULT
Designed an IIR Butterworth High pass filter and plotted its response.

Department of Electronics 61 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp. No: 19 Date:24-10-13

IIR CHEBYSHEV LOW PASS FILTER

AIM
To design an IIR Chebyshev Low Pass Filter and plot its response.

ALGORITHM
1. Start.

2. Enter pass band frequency, stop band frequency, pass band ripple, minimum stop band
attenuation and sampling frequency.

3. Find normalized pass band frequency (Wp) and normalized stop band frequency (Ws).

4. Find order and cut off frequency of the chebyshev filter using function “cheb1ord‟.

5. Find chebyshev filter coefficients using function “cheby1‟.

6. Find frequency response of the filter using function “freqz‟.

7. Find out gain (in dB) and pass angle in (in radian) using frequency response.

8. Plot amplitude response, phase response.

9. Stop.

Department of Electronics 62 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM

clc;
close all;
clear all;
fp=input('Enter the pass band frequency :');
fs=input('Enter the stop band frequency :');
f=input('Enter the sampling frequency :');
rp=input('Enter the passband ripple :');
rs=input('Enter the stopband ripple :');
wp=fp/f;
ws=fs/f;
[N,Wn]=cheb1ord(wp,ws,rp,rs);
[b,a]=cheby1(N,rp,Wn,'low');
n=0:0.1:pi;
[h,ohm]=freqz(b,a,n);
gain=20*log10(abs(h));
ang=angle(h);
subplot(2,1,1);
plot(ohm/pi,gain);
grid;
xlabel('Normalized Frequency');
ylabel('gain(dB)');
title('Frequency Response');
subplot(2,1,2);
plot(ohm/pi,ang);
grid;
xlabel('Normalised frequency');
ylabel('Phase');
title('Phase Response');

Department of Electronics 63 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT
Enter passband frequncy : 400
Enter stopband frequncy : 700
Enter sampling frequncy : 2000
Enter passband attenuation : .5
Enter min. stopband attenuation: 40

RESULT
Designed IIR Chebyshev Low Pass Filter and plotted its response.

Department of Electronics 64 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp.No: 20 Date: 24-10-13

IIR CHEBYSHEV HIGH PASS FILTER

AIM
To design an IIR Chebyshev High Pass Filter and plot its response.

ALGORITHM
1. Start.

2. Enter pass band frequency, stop band frequency, pass band ripple, minimum stop band
attenuation and sampling frequency.

3. Find normalized pass band frequency (Wp) and normalized stop band frequency (Ws).

4. Find order and cut off frequency of the chebyshev filter using function “cheb1ord‟.

5. Find chebyshev filter coefficients using function “cheby1‟.

6. Find frequency response of the filter using function “freqz‟.

7. Find out gain (in dB) and pass angle in (in radian) using frequency response.

8. Plot amplitude response, phase response.

9. Stop.

Department of Electronics 65 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

PROGRAM
clc;
close all;
clear all;
fp=input('Enter the pass band frequency :');
fs=input('Enter the stop band frequency :');
f=input('Enter the sampling frequency :');
rp=input('Enter the passband ripple :');
rs=input('Enter the stopband ripple :');
wp=fp/f;
ws=fs/f;
[N,Wn]=cheb1ord(wp,ws,rp,rs);
[b,a]=cheby1(N,rp,Wn,'high');
n=0:0.1:pi;
[h,ohm]=freqz(b,a,n);
gain=20*log10(abs(h));
ang=angle(h);
subplot(2,1,1);
plot(ohm/pi,gain);
grid;
xlabel('Normalized Frequency');
ylabel('gain(dB)');
title('Frequency Response');
subplot(2,1,2);
plot(ohm/pi,ang);
grid;
xlabel('Normalised frequency');
ylabel('Phase');
title('Phase Response');

Department of Electronics 66 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

OUTPUT
Enter passband frequency: 700
Enter stopband frequency: 400
Enter sampling frequency:2000

Enter passband attenuation: .5


Enter min. stopband attenuation: 40

RESULT
Designed IIR Chebyshev High Pass Filter and plotted its response.

Department of Electronics 67 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

COMMUNICATION LAB

Department of Electronics 70 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

INTRODUCTION TO SIMULINK

SIMULINK is an extension to MATLAB which uses a icon-driven interface for the


construction of a block diagram representation of a process. A block diagram is simply a
graphical representation of a process (which is composed of an input, the system, and an
output).

Figure 1: A very simple block diagram of a process

Typically, the MATLAB m-file ode45 is used to solve sets of linear and nonlinear
ordinary differential equations. The ``traditional'' numerical methods approach is used, e.g.
supply the equations to be solved in a function file, and use a general purpose equation solver
(linear or nonlinear algebraic, linear or nonlinear differential equation, etc.) which ``calls'' the
supplied function file to obtain the solution. One of the reasons why MATLAB is relatively
easy to use is that the ``equation solvers'' are supplied for us, and we access these through a
command line interface (CLI) (aka the MATLAB prompt, >>). However, SIMULINK uses a
graphical user interface (GUI) for solving process simulations. Instead of writing MATLAB
code, we simply connect the necessary ``icons'' together to construct the block diagram. The
``icons'' represent possible inputs to the system, parts of the systems, or outputs of the system.
SIMULINK allows the user to easily simulate systems of linear and nonlinear ordinary
differential equations. A good background in matrix algebra and lumped parameter systems as
well as an understanding of MATLAB is required, and we highly recommend that the student
thoroughly reads and works through this tutorial. Many of the features of SIMULINK are
user-friendly due to the icon-driven interface, yet it is important to spend some time
experimenting with SIMULINK and its many features. Dynamic simulation packages (such
as MATLAB, SIMULINK, etc.) are being used more and more frequently in the chemical
process industries for process simulation and control system design. After completing this
tutorial, the student should be able to ``build'' and simulate block diagram representations of
dynamic systems.

Department of Electronics 71 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

GETTING STARTED IN SIMULINK

SIMULINK is an icon-driven state of the art dynamic simulation package that allows
the user to specify a block diagram representation of a dynamic process. Assorted sections of
the block diagram are represented by icons which are available via various "windows" that the
user opens (through double clicking on the icon). The block diagram is composed of icons
representing different sections of the process (inputs, state-space models, transfer functions,
outputs, etc.) and connections between the icons (which are made by "drawing" a line
connecting the icons). Once the block diagram is "built", one has to specify the parameters in
the various blocks, for example the gain of a transfer function. Once these parameters are
specified, then the user has to set the integration method (of the dynamic equations), stepsize,
start and end times of the integration, etc. in the simulation menu of the block diagram window.

In order to use SIMULINK the student must ``start'' a MATLAB session (click on
the MATLAB button). Once MATLAB has started up, type simulink (SMALL LETTERS!)
at the MATLAB prompt (>>) followed by a carriage return (press the return key). A
SIMULINK window should appear shortly, with the following icons: Sources, Sinks,
Discrete, Linear, Nonlinear, Connections, Extras (this window is shown in Figure 2). Next, go
to the file menu in this window and choose New in order to begin building the block diagram
representation of the system of interest.

Department of Electronics 72 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Figure 2: Simulink Block Library Window

Saving a Model
We can save a model by choosing either the Save or Save As command from the File menu.
Simulink saves the model by generating a specially formatted file called the model file (with
the .mdl extension) that contains the block diagram and block properties

Printing a Block Diagram


We can print a block diagram by selecting Print from the File menu (on a Microsoft Windows
system) or by using the print command in the MATLAB Command Window (on

Department of Electronics 73 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

all platforms). On a Microsoft Windows system, the Print menu item prints the block
diagram in the current window.

Creating a New Model


To create a new model, click the New button on the Library Browser's toolbar (Windows
only) or choose New from the library window's File menu and select Model.

Selecting Objects
Many model building actions, such as copying a block or deleting a line, require that you
first select one or more blocks and lines (objects).

Connecting Blocks
Simulink block diagrams use lines to represent pathways for signals among blocks in a model
(see Annotating Diagrams for information on signals). Simulink can connect blocks for you or
we can connect the blocks our self by drawing lines from their output ports to their input ports.

Department of Electronics 74 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Annotations provide textual information about a model. We can add an annotation to any
unoccupied area of our block diagram
Creating Subsystems
As our model increases in size and complexity, we can simplify it by grouping blocks into
subsystems.
we can create a subsystem in two ways:
➢ Add a Subsystem block to your model, then open that block and add the blocks it
contains to the subsystem window.
➢ Add the blocks that make up the subsystem, then group those blocks into a
subsystem.

Setting Block Parameters


All Simulink blocks have a common set of parameters, called block properties, that we can
set. By setting these parameters, you can customize the behavior of the block to meet the
specific requirements of your model.

To simulate and display result (when dealing with signals)


Run the model by clicking on the “start simulation” button on model window

To view the result the following two methods can be used


➢ Double click on the sink- „scope‟ in our model to view input ,output or intermediate
wave forms
➢ We can also view the output by typing commands in the command window for that we
have to include the sink-„To workspace‟ in our model, give a suitable variable name
and save it in ARRAY format. Simout is the default variable name. Suppose the
variable name is „input‟ we can view the output by typing

>>plot(input) ;input is the variable name in the command window

Department of Electronics 75 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

TABLE OF SIMULINK BLOCKS

Department of Electronics 76 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Department of Electronics 77 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Department of Electronics 78 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Department of Electronics 79 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Exp. No: 01 Date: 05-11-13

AMPLITUDE MODULATION

AIM
Simulate an amplitude modulator with modulation index,
(a) m =1.
(b) m >1.
(c) 0 < m <1.
Using SIMULINK

THEORY
In amplitude modulation the amplitude of a carrier signal is varied by modulating voltage,
whose frequency is invariably lower than that of carrier. That is the amplitude of carrier is
made proportional to the instantaneous amplitude of the modulating voltage.
Let the carrier voltage and the modulating voltage, Vc and Vm respectively be represented as
Vc = Ac sin c t ….. (1)
Vm= Am sin m t ..… (2)
From the definition of amplitude modulation, it follows that maximum amplitude Ac of the
unmodulated carrier will have to be made proportional to the instantaneous modulating voltage
Am sin m t when the carrier is amplitude modulation. Hence,
A = Ac + Vm
= Ac + Am sin m t
= Ac [1+ Am / Ac sin m t]
= Ac [1 + m sin m t]....... (3)

Where „m‟ is called the modulation index, which is a number lying between 0 & 1 and it is
often expressed as percentage and called percentage modulation.
If m= 1 :100% modulation.
m>1 : over modulation.
0<m<1 : perfect modulation

Department of Electronics 80 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Substitute equation (3) in equation (1) according to the theory of AM.


VAM = Ac (1+ m sin m t) sin c t
VAM = (1+ m sin m t) (Ac sin c t) ....... (4)
VAM = (Ac sin c t) + [m Ac / 2cos (c - m) + m Ac /2cos(c + m)
The result is a double side band full carrier amplitude modulated signal.
From equation (4),
VAM = ( 1+ m sin m t ) (Ac sin c t)
= Ac sin c t + m sin m t Ac sin c t
= Ac sin c t +m Am / Am sin m t Ac sin c t
= Ac sin c t + ka Am sin m t Ac sin c t
Where ka = m/Am = proportionality constant
VAM = Ac sin c t(1+ ka Am sin m t)
But we use cos(c t) and cos(m t) for easier calculation.

BLOCK DIAGRAM

Department of Electronics 81 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

RESULT

1. Modulation index, m=0.5


Message signal parameters
Sine type: Time based
Amplitude: 1
Bias: 0
Frequency[rad/sec]: 2*pi*0.5
Phase[rad]: 0
Sample time: 1/100

Message signal

Carrier signal parameters


Sine type: Time based
Amplitude: 2
Bias: 0
Frequency[rad/sec]: 2*pi*5
Phase[rad]: 0
Sample time: 1/100

Department of Electronics 82 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Carrier Signal

AMPLITUDE MODULATED SIGNAL

Department of Electronics 83 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

2. Modulation index, m=1


Message signal parameters
Sine type: Time based
Amplitude: 1
Bias: 0
Frequency[rad/sec]: 2*pi*0.5
Phase[rad]: 0
Sample time: 1/100

Message signal

Carrier signal parameters


Sine type: Time based
Amplitude: 1
Bias: 0
Frequency[rad/sec]: 2*pi*5
Phase[rad]: 0
Sample time: 1/100

Department of Electronics 84 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Carrier Signal

AMPLITUDE MODULATED SIGNAL

Department of Electronics 85 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

3. Modulation index, m=2


Message signal parameters
Sine type: Time based
Amplitude: 2
Bias: 0
Frequency[rad/sec]: 2*pi*0.5
Phase[rad]: 0
Sample time: 1/100

Message signal

Carrier signal parameters


Sine type: Time based
Amplitude: 1
Bias: 0
Frequency[rad/sec]: 2*pi*5
Phase[rad]: 0
Sample time: 1/100

Department of Electronics 86 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Carrier Signal

AMPLITUDE MODULATED SIGNAL

Department of Electronics 87 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Ex No: 02 Date: 05-11-13

AM DEMODULATION

AIM
Simulate an amplitude demodulator using SIMULINK

THEORY
Demodulation is the process of extracting the base band message from the carrier so
that it may be processed and interpreted by the intended receiver. There are two types of
demodulation techniques
1) coherent detection
2) non–coherent detection

Coherent Detection
Coherent demodulation requires knowledge of the transmitted carrier frequency and phase
at the receiver. Product detector is used commonly. It is commonly. It is also called phase
detector. It contains a down converter circuit, which converts the input band pass signal to a
base band signal
Let x(t) = (1+ m(t)) cos ct
Let m = vc =1 and the message and carrier be in cosine form.
In product detector demodulator, x(t) is multiplied with the same carrier.
i.e.,y(t) = x(t) cos ct
= [(1+m(t)) cos ct] cos ct
= (1+m(t)) cos2 ct
= (1+m(t)) (cos 2ct + 1)
= [1+m(t)+ cos 2ct+ m(t)cos 2ct]
The message signal can be reconstructed by neglecting the constant terms and by using
lowpass filter to eliminate the higher frequency components.

Department of Electronics 88 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Non-Coherent Detection
In second method AM signal is demodulated using non – coherent envelope detectors
which are easy and cheap to build. An ideal envelope detector is circuit that has an output
proportional to the real envelope of the input signal.

Envelope detectors are useful when the input signal power is at least 10dB greater
than the noise power, where as product detectors are able to process AM signals with input
signal to noise ratios well below 10dB.

BLOCK DIAGRAM

Department of Electronics 89 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

RESULT

Message signal parameters


Sine type: Time based
Amplitude: 1
Bias: 0
Frequency[rad/sec]: 2*pi*0.5
Phase[rad]: 0
Sample time: 1/100

Carrier signal parameters


Sine type: Time based
Amplitude: 2
Bias: 0
Frequency[rad/sec]: 2*pi*5
Phase[rad]: 0
Sample time: 1/100

Department of Electronics 90 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Carrier Signal

Amplitude Modulated signal

Department of Electronics 91 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Demodulated signal

Department of Electronics 92 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Ex No: 03 Date: 20-11-13

FREQUENCY MODULATION

AIM
Simulate a frequency modulator using SIMULINK.

THEORY
It is the system in which the amplitude of the modulated carrier is kept constant while
its frequency is varied by modulating signal. The amount by the carrier frequency are varied
from its un–modulated value is called the deviation, is made proportional to the instantaneous
values of the modulating signal.
The instantaneous value of the frequency is given by,
fi(t)= fc + kf m(t) ...................... (1)
Where kf m(t) = Time varying component proportional to m(t)
m(t) = modulating signal
kf =Frequency sensitivity of modulator
=k fc
k = proportionality constant
fc = carrier frequency.

Department of Electronics 93 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

BLOCK DIAGRAM

RESULT
FM modulator passband parameters
Carrier frequency (Hz) : 5
Initial phase (Rad) : 0
Modulation constant (Hz per volt) : 1
Sample time (s) : 0.001
Symbol interval : Inf

Message signal parameters


Sine type: Sample based
Amplitude: 1
Bias: 0
Samples per period: 75
Number of offset samples: 0
Sample time: 0.039

Department of Electronics 94 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Message signal

FM output Signal

Department of Electronics 95 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Ex No: 04 Date : 20-11-13

PULSE AMPLITUDE MODULATION

AIM
Simulate a pulse amplitude modulator using SIMULINK.

THEORY
PAM is the simplest form of pulse modulation. In PAM, the signal is sampled at regular
intervals and each sample is made proportional to the amplitude of the signal at the instant of
sampling. Two ways of sampling can be employed in PAM
(a)Natural Sampling
(b)Flat-topped Sampling

In natural sampling, the sampling waveform consist of a train of pulses having duration
„‟separated by the sampling period „Ts‟. The base band signal is m(t) and the sampled signal
s(t)m(t) will follow the waveform m(t). Naturally sampled signal can be recovered by passing
it through a low pass filter.

BLOCK DIAGRAM

Department of Electronics 96 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

RESULT
Message signal parameters
Sine type: Time based
Amplitude: 2
Bias: 0
Frequency[rad/sec]: 2*pi*0.2
Phase[rad]: 0
Sample time: 1/100

Message signal

Unit sample signal parameters


Pulse type: Time based
Amplitude: 1
Periods[sec]: 0.2
Pulse width[%of period]: 50
Phase delay[sec]: 0

Department of Electronics 97 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Unit sample signal

PAM Output

Department of Electronics 98 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Ex No: 05 Date : 27-11-13

FREQUENCY SHIFT KEYING

AIM
Simulate an FSK modulator using SIMULINK

THEORY
In FSK, the carrier frequency is shifted in steps or levels corresponding to the levels
of the digital modulating signal. FSK is a method of frequency modulation where a bit
„1‟ is represented by a „mark‟ and bit‟0‟ by „space‟. In this system two different frequencies
are used as carriers‟ .One frequency is transmitted for a „mark‟ and another frequency is
transmitted for a „space‟.
Binary 0= e0(t) =A0cos (2f0 t + 0)
Binary 1= e1(t) =A1cos (2f1 t + 1)

BLOCK DIAGRAM

Department of Electronics 99 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

RESULT
Switch Parameters
Criteria for passing first input: U2>threshold
Threshold: 0

Space signal parameters


Sine type: Time based
Amplitude: 2
Bias: 0
Frequency[rad/sec]: 2*pi*5
Phase[rad]: 0
Sample time: 1/100

Space signal

Department of Electronics 100 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Mark signal parameters


Sine type: Time based
Amplitude: 2
Bias: 0
Frequency[rad/sec]: 2*pi*1
Phase[rad]: 0
Sample time: 1/100

Mark signal

1. Pulse Width=25%

Message signal parameters


Pulse type: Time based
Amplitude: 1
Periods[sec]: 2
Pulse width[%of period]: 25
Phase delay[sec]: 0

Department of Electronics 101 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Message signal

FSK Output

Department of Electronics 102 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

2. Pulse Width=50%

Message signal parameters


Pulse type: Time based
Amplitude: 1
Periods[sec]: 2
Pulse width[%of period]: 50
Phase delay[sec]: 0

Message signal

Department of Electronics 103 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

FSK Output

3. Pulse Width=75%

Message signal parameters


Pulse type: Time based
Amplitude: 1
Periods[sec]: 2
Pulse width[%of period]: 75
Phase delay[sec]: 0

Department of Electronics 104 CAS Calicut


MSc ELECTRONICS Communication and DSP Lab

Message signal

FSK Output

Department of Electronics 105 CAS Calicut

You might also like