0% found this document useful (0 votes)
187 views34 pages

Soft Lab - Iii Ec506

This document is a lab manual for Software Lab-III (EC-506) for the fifth semester Bachelor of Engineering program. It contains the syllabus, list of experiments, and one sample experiment on plotting and demonstrating various types of signals using MATLAB. The experiments cover topics related to control systems, communication systems, and data communications including simulations of modulation techniques, noise modeling, and digital signal processing concepts.

Uploaded by

Akanksha Dixit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
187 views34 pages

Soft Lab - Iii Ec506

This document is a lab manual for Software Lab-III (EC-506) for the fifth semester Bachelor of Engineering program. It contains the syllabus, list of experiments, and one sample experiment on plotting and demonstrating various types of signals using MATLAB. The experiments cover topics related to control systems, communication systems, and data communications including simulations of modulation techniques, noise modeling, and digital signal processing concepts.

Uploaded by

Akanksha Dixit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 34

LAB MANUAL

SOFTWARE LAB-III
(EC-506)

Bachelor of Engineering
Fifth Semester

DEPARTMENT OF ELECTRONICS &


COMMUNICATION ENGINEERING

GROUP OF INSTITUTIONS
FACULTY OF ENGINEERING AND MANAGEMENT,
GRAM: RAIGWAN, PATAN BYPASS, JABALAPUR (M.P.)
CONTENTS

TITLE PAGE …………………………………………………………………………. 1

SYLLABUS …………………………………………………………………………. 2

EXPERIMENTS………………………………………………………………………….. 3
List of Experiments
1. To plot and demonstrate various types of signals.
2. To plot and demonstrate addition, subtraction multiplication of continuous time signals.
3. Implementation of a Numerical Integrator and Differentiator
4. Plotting the Fourier transform of various signals
5. Simulation of Amplitude Modulation DSB-C using Matlab
6. Simulation of Phase Modulation using Matlab
7. Simulation of Frequency Modulation using Matlab
8. To build a Noise Model of a Communication Channel using Simulink.
9. To compare some of the Digital Modulation techniques in terms of their Bit Error Rates
and Symbol Error Rates in presence of Additive White Gaussian noise.
10. Obtain the unit step response for the system with the following transfer function
11. To obtain step response and time domain specifications for the given system
SYLLABUS

(EC– 506) Software Lab-III

Study of simulation software (any one Scilab/ MatLab etc.) Introduction to Scilab / Matab,
Study of Scilab / Matlab programming environment, Modeling, Design and development of
Programs. Overview and study of the key features and applications of the software. Application
of the software in the field of Control Systems, Data Communications and communication
systems.
1. Programs Related to Control System- open-loop and closed loop control system, frequency
response plots, determining transient response, specifications of second order system, effect of
PID controller on control system, Bode plot, Nyquist plot and Root Locus plot, state space
analysis.
2. Programs Related to Communication Systems--Simulation of a Communication System
(Generation, addition of noise and Detection), AM, FM, PM, PAM, PCM, PSK, FSK etc.
3. Programs related to Data Communications- simulations of CRC, LRC, VRC, hamming codes,
line encoding techniques.
Experiment-01
Aim:-To plot and demonstrate various types of signals.
Requirement:-
Operating System – Windows XP
Constructor - Simulator
Software - MATLAB R2010

Theory:-We use several elementary signals in signal processing for analysis purposes. Their
definitions and MATLAB representations are given below.

1. Unit impulse signal:-

δ(t) = {∞0 ,,t=0


t≠0

In MATLAB t he function zeros (1, N) generates a row vector of N zeros, which can be used to
implement δ(t)over a finite interval. However, the implementing δ (t) can be done by taking t=0
sample equal to a higher value rather than infinity because infinity causes overflow condition.

2. Unit step signal:-

u(t) = {1,0 ,tt<≥ 00


In MATLAB t he function ones (1, N) generates a row vector of N ones. It can be used to
generate u(t) over a finite interval.

3. Exponential signals:-
x(t) = (e)at
In MATLAB an array operator " . ^ " is required to implement a real exponential sequence.
For example, to generate z(t) = (0.9)n , 0 <t< 10, we will need the following MATLAB script:
>>t=0:10; x=(0.9).^t; instead in our program we used exp(a*t)

4. Sinusoidal signal:-
x(t) = sin (ωot + θ) whereωo= 2π/T where T is period of this sinusoid. Where θis the phase in
radians, a MATLABfunction cos (or sin) is used to generate sinusoidal sequences.

5. Signal Function:-
It is s special class of signal and can be mathematically written as:
1 fort ≥ 0
x(t)= { −1 fort <0
Program :-
%Software lab Department of Electronics & Communication Engineering
%GNCSGI Jabalpur
%Matlab Simulation of various singularity functions, exponential function
% and sinusoidal function
clearall;
closeall;
clc;
%---------------------------------------------------------------------
% simulation of Unit impulse Signal
%---------------------------------------------------------------------
t=-1:(1/200):1;
a=[zeros(1,200),25,zeros(1,200)];
subplot(2,3,1)
plot(t,a);
axis([-1 1 -0.5 25]);
title('Unit Impulse Signal');
xlabel('Time in second');
ylabel('Amplitude');
grid();
%---------------------------------------------------------------------
% simulation of Unit step Signal
%---------------------------------------------------------------------
b=[zeros(1,200),ones(1,201)];
subplot(2,3,2)
plot(t,b);
axis([-1 1 -0.5 1.5]);
title('Unit step Signal');
xlabel('Time in second');
ylabel('Amplitude');
grid();
%---------------------------------------------------------------------
% simulation of signam Signal
%---------------------------------------------------------------------
c=[-1*ones(1,200),0,ones(1,200)];
subplot(2,3,3)
plot(t,c);
axis([-1 1 -1.5 1.5]);
title('signam Signal');
xlabel('Time in second');
ylabel('Amplitude');
grid();
%---------------------------------------------------------------------
% simulation of exponential signal
%---------------------------------------------------------------------
d=exp(2*t);
subplot(2,3,4)
plot(t,d);
axis([-1 1 -0.5 1.5]);
title('Unit step Signal');
xlabel('Time in second');
ylabel('Amplitude');
grid();
%---------------------------------------------------------------------
% simulation of sinusoidal signal
%---------------------------------------------------------------------
f=input('Enter Frequency of Sinusoidal Wave');
T=1/f;
fs=100*f;
Ts=1/fs;
t1=0:Ts:5*T;
s=sin(2*pi*f*t1);
subplot(2,3,5);
plot(t1,s);
axis([0 5*T -1.5 1.5]);
title('Sinusoidal Signal of Desired Frequency');
xlabel('Time in second');
ylabel('Amplitude');
grid();
%---------------------------------------------------------------------
% simulation of squre wave signal
%---------------------------------------------------------------------
e=[ones(1,50),zeros(1,50),ones(1,50),zeros(1,50),ones(1,50),zeros(1,50),ones(1
,50),zeros(1,51)];
subplot(2,3,6)
plot(t,e);
axis([-1 1 -0.5 1.5]);
title('squre wave of duty cycle = 50%');
xlabel('Time in second');
ylabel('Amplitude');
grid();

Results:
Experiment (2)
Aim:-To plot and demonstrate addition, subtraction multiplication of continuous
time signals.
Equipments:-
Operating System – Windows XP
Constructor - Simulator
Software - MATLAB 7

Theory:-

1. Signal addition: - This is a sample -by-sample addition given by x1(t) + x2(t) it is


implemented in MATLAB by the arithmetic operator “+”. However, the lengths of x 1(t)
and x2(t) must be the same.
2. Signal subtraction:-This is a sample -by-sample subtraction given by x 1(t) - x2(t) It is
implemented in MATLAB by the arithmetic operator “-”. However, the lengths of x 1(t)
and x2(t) must be the same.
3. Signal Multiplication:-This is a sample -by-sample multiplication given by x 1(t) .*x2(t)
It is implemented in MATLAB by the arithmetic operator “.*”. However, the lengths of
x1(t) and x2(t) must be the same. This operation is non linear operation whereas addition
and subtraction are linear operations.

Program :-
clearall;
closeall;
clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Manipulation on Signals
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
t=0:0.001:0.1;
f1=50;
f2=25;
x1=cos(2*pi*f1*t);
x2=0.5*sin(2*pi*f2*t);
add=x1+x2;
sub=x1-x2;
mul=x1 .* x2;
subplot(1,2,1);
plot(t,x1);
grid;
title('sinusoidal signal of frequency 50 Hz');
xlabel('time in seconds');
ylabel('Amplitude');
subplot(1,2,2);
plot(t,x2);
grid;
title(' sinusoidal signal of frequency 25 Hz');
xlabel('time in seconds');
ylabel('Amplitude');
figure(2);
subplot(1,3,1);
plot(t,add);
grid;
title(' addition x1+x2');
xlabel('time in seconds');
ylabel('Amplitude');
subplot(1,3,2);
plot(t,sub);
grid;
title(' subtraction x1-x2');
xlabel('time in seconds');
ylabel('Amplitude');
subplot(1,3,3);
plot(t,mul);
grid;
title(' multiplication x1*x2');
xlabel('time in seconds');
ylabel('Amplitude');

Results:

Experiment (3)
Aim:-.Implementation of a Numerical Integrator and Differentiator
Requirement:-
Operating System – Windows XP
Constructor - Simulator
Software - MATLAB R-2010

Theory: - In Signal processing a differentiator and integrator can be synthesized using


difference equations, by means of Trapezoidal rule (for Integration ) and First difference rule
(For Differentiator)
1. Differentiator:- a differentiator can be implemented using finding the first difference of
any given input signal x(t) and it is given as:
y(t) = x(t)-x(t-Ts) this is called the first difference of input x(t). whereTs is sampling
time of signal x(t).
2. Integrator :- An integrator can be viewed as :
t

y(t)=∫ x ( t ) dtand this can be easily evaluated numerically by means of Trapezoidal rule
0
for finding numerical integration. According to Trapezoidal rule:
y(t)=y(t-Ts)+Ts/2[x(t)+x(t-Ts)] which can easily be programmed.

Program :-
% Software lab Department of Electronics & Communication Engineering
%GNCSGI Jabalpur
%Matlab Simulation of Integration And differentiation
clearall;
closeall;
clc;
%---------------------------------------------------------------------
% simulation of squre wave signal
%---------------------------------------------------------------------
t=-1:(1/300):1;
e=[-ones(1,50),ones(1,100),-ones(1,50),ones(1,100),-ones(1,50),ones(1,100),-
ones(1,50),ones(1,101)];
subplot(3,1,1)
plot(t,e);
axis([-1 1 -1.5 1.5]);
title('squre wave');
xlabel('Time in second');
ylabel('Amplitude');
grid();
%---------------------------------------------------------------------
% simulation of Integration Using Trapezoidal rule
%y(t)=y(t-1)+1/2(x(t)+x(t-1))
%---------------------------------------------------------------------
num=[1/2, 1/2];
den=[1, -1];
I=filter(num,den,e);
subplot(3,1,2)
plot(t,I);
title('Integration of Squre wave');
xlabel('Time in second');
ylabel('Amplitude');
grid();
%---------------------------------------------------------------------
% simulation of Differentiator
%y(t)=x(t)-x(t-1)
%---------------------------------------------------------------------
num1=[1, -1];
den1=[1];
D=filter(num1,den1,e);
subplot(3,1,3)
plot(t,D);
title('Differentiation of Squre wave');
xlabel('Time in second');
ylabel('Amplitude');
grid();

Results:
Experiment (4)

Aim:- Plotting the Fourier transform of various signals


Requirement:-
Operating System – Windows XP
Constructor - Simulator
Software - MATLAB R-2010

Theory: -The Fourier transform of any given continuous time signal is given by following
relation:

If x(t) is an Energy signal then its Fourier transform will be given as



X ( jω ) =∫ x (t )e jωt dt
−∞

Where ω is angular frequency in radian.


In Matlab to find the fourier spectrum of a signal a command ‘fft( )’ is used it gives one sided
fourier spectrum further by using a command fftshift( ) we can find two sided spectrum, and by
simply using abs() and angle() functions to find Magnitude and Phase Spectra. In this experiment
we have chosen a gate pulse a signum signal and Unit impulse signal to find their four
spectrums.
Program :-
clearall;
closeall;
clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MatlabPrograme to find Fourier Transform of some basic functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
t=-0.5:0.0001:0.5;
Fs=10000;
f=-Fs/2:1:Fs/2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Gate Pulse
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
u=[zeros(1,2499),ones(1,2501),ones(1,2501),zeros(1,2500)];
subplot(2,1,1)
plot(t,u)
xlabel('Time in seconds');
ylabel('Amplitude');
title('Gate Pulse Signal');
gridon
fft_u=fftshift(abs(fft(u)));
subplot(2,1,2)
plot(f,fft_u);
xlim([-100,100]);
xlabel('Frequency in Hertz');
ylabel('Magnitude');
title('Magnitude Spectrum of gate Pulse Signal');
gridon;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Signam function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
s=[-1*ones(1,5000),ones(1,5001)];
figure
subplot(2,1,1)
plot(t,s)
xlabel('Time in seconds');
ylabel('Amplitude');
title('Signum Signal');
gridon
fft_s=fftshift(abs(fft(s)));
subplot(2,1,2)
plot(f,fft_s);
xlim([-100,100]);
xlabel('Frequency in Hertz');
ylabel('Magnitude');
title('Magnitude Spectrum of Signum Signal');
gridon;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Unit Impulse Signal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
i=[zeros(1,5000),ones(1,1),zeros(1,5000)];
figure
subplot(2,1,1)
plot(t,i)
xlabel('Time in seconds');
ylabel('Amplitude');
title('Unit Impulse Signal');
gridon
fft_i=fftshift(abs(fft(i)));
subplot(2,1,2)
plot(f,fft_i);
xlim([-100,100]);
xlabel('Frequency in Hertz');
ylabel('Magnitude');
title('Magnitude Spectrum of Unit Impulse Signal');
gridon;
Results:
Experiment (5)
Aim:- Simulation of Amplitude Modulation DSB-C using Matlab
Requirement:-
Operating System – Windows XP
Constructor - Simulator
Software - MATLAB R-2010

Theory: -Wheneveramplitude of a Carrier signal is varied according to the amplitude of


Message signal the modulation is known as amplitude modulation. If m(t) is message signal and
c(t)=Ac.cos(2πfct) is carrier where fcis carrier frequency and Ac is maximum peak value. Then the
amplitude modulated wave will be y(t)=(Ac+ Ka . m(t)).cos(2πfct) or it can be written as:
K a∗m ( t )
y ( t ) =A c (1+ )cos ⁡(2 π f c t)
Ac
Where a term modulation index is defined as :
K a|m(t)|min K |m(t)|max
≤M ≤ a
Ac Ac
To avoid over modulation the value of M must be in between 0 and 1.
Program :-

clearall;
closeall;
clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%MatlabPrograme to Demonstrate Amplitude Modulation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% generation of message signal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Fs=10000;% sampling frequency in Hertz
t=0:(1/(Fs-1)):1;
f=-Fs/2:((Fs/(Fs-1))):Fs/2;
msg_sig=[-0.5*ones(1,1000),-1*ones(1,1500),zeros(1,1000),1.5*ones(1,1000),...
2*ones(1,1000),zeros(1,2000),0.5*ones(1,1500),-0.5*ones(1,1000)];
subplot(2,1,1)
plot(t,msg_sig);
ylim([-1.5,2.5]);
xlabel('time in second');
ylabel('Amplitude in volts');
title('message signal');
gridon;
fft_msg=fftshift(abs(fft(msg_sig)));
subplot(2,1,2)
plot(f,fft_msg);
xlim([-100,100]);
xlabel('Frequency in Hertz');
ylabel('Magnitude');
title('Magnitude spectrumof message signal');
gridon;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Generation of carrier signal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
A=max(msg_sig)+2;%to keep modulationindex less then 1 ma=Vm/Vc
fc=50;% Carrier Frequency in Hertz
car_sig=A*cos(2*pi*fc*t);
figure
subplot(2,1,1)
plot(t,car_sig);
xlim([0,0.1]);
xlabel('time in second');
ylabel('Amplitude');
title('Carrier signal having frequency 100 Hz');
gridon;
fft_car=fftshift(abs(fft(car_sig)));
subplot(2,1,2)
plot(f,fft_car);
xlabel('Frequency in Hertz');
ylabel('Magnitude');
title('Magnitude spectrum of carrier signal');
xlim([-100,100]);
gridon;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Generation of DSB with Carrier AM Signal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
am_sig=(A+msg_sig).*car_sig;
figure
subplot(2,1,1)
plot(t,am_sig)
xlabel('Time in Second');
ylabel('Amplitude in second');
title('Amplitude modulated wave');
gridon;
fft_am=fftshift(abs(fft(am_sig)));
subplot(2,1,2)
plot(f,fft_am)
xlabel('Frequency in Hrtz');
ylabel('Magnitude');
title('Magnitude Spectrum of AM Wave');
xlim([-100,100]);
gridon;

Results:
Experiment (6)

Aim:- Simulation of Phase Modulation using Matlab


Requirement:-
Operating System – Windows XP
Constructor - Simulator
Software - MATLAB R-2010
Theory: -In Phase Modulation the Phase of the carrier is varied in accordance with the
instantaneous values of the amplitudes of the modulating signal keeping the frequency and the
amplitude of carrier fixed.
y ( t ) =A c cos (θi ( t ))
Where θi ( t ) =θ ( t ) + K p m(t)
θi ( t ) =2 π f c t+ K p m(t )
Where m(t) is Message signal and fc is carrier frequency, here the termKp is known as Phase
constant its unit is degree/volt is the message signal is in volts.
Program :-
%-------------------------------------------------------------------
%Software Lab Department of Electronics & Communication Engineering
%GNCSGI Jabalpur
%-------------------------------------------------------------------
clearall;
closeall;
clc
%-------------------------------------------------------------------
%Matlab simulation for Phase modulation%
%-------------------------------------------------------------------
Fs=1000;
Ts=1/Fs;
a=Fs/4;
t=0:Ts:1;
fc=input('Enter frequency of carrier signal ');
K=input('Enter the value of phase constant in degree/volt ');
Kp=((pi/180)*K);
carr_sig=sin(2*pi*fc*t);%Carrier Signal
% Message Signal msg_sig
msg_sig=[2*ones(1,a),-ones(1,a),0.5*ones(1,a),-1.5*ones(1,a+1)];
%Phase Modulated Signal phs_mod
phs_mod=2*sin((2*pi*fc*t)+Kp*msg_sig);
mx=max(msg_sig);
mn=min(msg_sig);
subplot(3,1,1)
plot(t,carr_sig);
axis([0 1 -1.5 1.5]);
title('Carrier Signal');
xlabel('Time in second');
ylabel('Amplitude');
grid();
subplot(3,1,2)
plot(t,msg_sig);
axis([0 1 -2.5 2.5]);
title('Message Signal');
xlabel('Time in second');
ylabel('Amplitude');
grid();
subplot(3,1,3)
plot(t,phs_mod);
axis([0 1 -2.5 2.5]);
title('Phase modulated signal');
xlabel('Time in second');
ylabel('Amplitude');
grid();
maxmod_idx=Kp*mx;
phs_dev=K*(mx-mn);
ifphs_dev>360
phs_dev=phs_dev-360;
ifphs_dev>360
phs_dev=phs_dev-360;
end
end
disp('Phase Constant in Degree/volt '); disp(K);
disp('Phase deviation in degree is '); disp(phs_dev);
disp('maximum Modulation index of Phase modulation is ');disp(maxmod_idx);
%--------------------------------------------------------------------------
t1=(-5:1/10:5) ;
mod_idx=Kp*t1;
figure(2)
plot(t1,mod_idx);
title('Amplitude V/S Modulation index graph' );
xlabel('Amplitude of modulating signal');
ylabel('modulation index in radians 3.14 = pi radians ');
grid();

Results:

Command Window o/p:


Enter frequency of carrier signal 10
Enter the value of phase constant in degree/volt 90
Phase Constant in Degree/volt
90
Phase deviation in degree is
315
maximum Modulation index of Phase modulation is
3.1416
Experiment (7)

Aim:- Simulation of Frequency Modulation using Matlab


Requirement:-
Operating System – Windows XP
Constructor - Simulator
Software - MATLAB R-2010

Theory: -In Frequency Modulation the frequency of the carrier is varied in accordance with
instantaneous value of the amplitude of the modulating signal keeping amplitude and the phase
of carrier fixed.
Let m(t) is modulating signal and c(t) is carrier signal having carrier frequency fc
The instantaneous value of angular frequency in FM will be
ω i=ω c + K f m(t )
But we know that
θi (t )=∫ ωi dt
Hence
θi (t )=ω c t+ k f ∫ m ( t ) dt
Since carrier is given as:
c ( t ) =A c cos ⁡[θi ( t ) ]
And the Frequency modulated wave will be
y (t)=A c .cos ¿¿
Here Kf is known as frequency constant and given in hertz per volt if the message signal is in
volts.

Program :-
%-------------------------------------------------------------------
%Software Lab Department of Electronics & Communication Engineering
%GNCSGI Jabalpur
%-------------------------------------------------------------------
clearall;
closeall;
clc
%-------------------------------------------------------------------
%Matlab simulation for Frequency modulation%
%-------------------------------------------------------------------
Fs=10000;
Ts=1/Fs;
a=Fs/4;
t=0:Ts:1;
fc=100;
delta=input('Enter the value of frequency deviation ');
carr_sig=sin(2*pi*fc*t);%Carrier Signal
% Message Signal msg_sig
msg_sig=[2*ones(1,a),-ones(1,a),0.5*ones(1,a),-1.5*ones(1,a+1)];
num=[1/2,1/2];
den=[1,-1];
int_msg=filter(num,den,msg_sig);
Kf=delta/max(int_msg);%frequency constant in radian/volt*second
%Frequency Modulated Signal frq_mod
frq_mod=2*sin((2*pi*fc*t)+Kf*int_msg);
subplot(3,1,1)
plot(t,carr_sig);
axis([0 1 -1.5 1.5]);
title('Carrier Signal');
xlabel('Time in second');
ylabel('Amplitude');
grid();
subplot(3,1,2)
plot(t,msg_sig);
axis([0 1 -2.5 2.5]);
title('Message Signal');
xlabel('Time in second');
ylabel('Amplitude');
grid();
subplot(3,1,3)
plot(t,frq_mod);
axis([0 1 -2.5 2.5]);
title('Frequency modulated signal');
xlabel('Time in second');
ylabel('Amplitude');
grid();
disp('Frequency deviation in hertz is '); disp(delta);
disp('Frequency constant in radians/volt*second Kf is '); disp(Kf);

Results:

Command Window o/p:


Enter the value of frequency deviation 250
Frequency deviation in hertz is
250

Frequency constant in radians/volt*second Kf is


0.0500
Experiment (8)

Aim:-To build a Noise Model of a Communication Channel using Simulink.


Requirement:-
Operating System – Windows XP
Constructor - Simulator
Software - MATLAB R-2010

Theory: -
This experiment shows how to build a simple model of a communication system. The
modelcontains the most basic elements of a communication system: asource for the signal, a
channel with noise, and means of detecting errors caused by noise.

Overview of the Model: -


The channel noise model generates a random binary signal, and then switches the symbols 0 and
1 in the signal, according to a specified error probability, to simulate a channel with noise. The
model then calculates the error rate and displays the result. The model contains the following
components.

Source
The source for the signal in this model is the Bernoulli Binary Generator block, which generates
a random binary sequence.

The Channel
The Binary Symmetric Channel block simulates a channel with noise. The block introduces
random errors to the signal by changing a 0 to a 1 or the reverse, with a probability specified by
the Error probability parameter in the block's dialog.

Error Rate Calculation


The Error Rate Calculation block calculates the error rate of the channel. The block has two
input ports, labeledTx, for the transmitted signal, and Rx, for the received signal. The block
compares the two signals and checks for errors. The output of the block is a vector with three
entries:
• Bit error rate, which you expect to be approximately .01, since this is the probability of
Error in the channel
• Number of errors
• Total number of bits that are transmitted

Display
The Display block displays the output of the Error Rate Calculation block, as described in
displaying the Error Rate.
Block Diagram and simulation model: -
Results: -It is shown in figure that we used a BSC channel and calculated the error rate and it
is coming out to be 0.05028 or 5.028% we can conclude that at least 5 bits are in error out of 100
for a BSC channel having Probability of Error 0.05.
Experiment (9)

Aim:-To compare some of the Digital Modulation techniques in terms of their Bit Error Rates
and Symbol Error Rates in presence of Additive White Gaussian noise.

Requirement:-
Operating System – Windows XP
Constructor - Simulator
Software - MATLAB R-2010

Theory: - In this experiment basically Phase shift keying, Frequency shift keying and
differential phase shift keying techniques are compared according to their BER (Bit Error Rate)
Performance. An AWGN channel is considered as transmission medium.

Block Diagrams: - Block diagram for BPSK, BFSK, DBPSK, QPSK, QFSK, MPSK, and
MFSK are shown below:
Procedure:-
The data sequence is generated using a random integer block the output of which is then
converted into bits, using the integer-to-bit block.
1. The various baseband digital modulation(and demodulation) blocks are used to perform
the modulation and demodulation at the transmitter and receiver ends.
2. The effect of channel noise is modeled using a AWGN channel block.
3. Bit error rates and Symbol error rates are calculated using the Error rate block.
4. The variance of the AWGN noise is varied using a subsystem which is shown below.
The bit error rates and the symbol error rates obtained by varying the Es/No ratio are written to
the workspace for plotting.

The variance of AWGN channel


Results: -The results are plotted in terms of BER and SER plots for various Es/No Ratio
It is clear from figures that MFSK gives best performance over all modulation schemes.
Control System Simulation in Matlab
Matlab Control System tool box contain following function for time domain response.
1. step Step Response
2. impulse Impulse Response
3. initial Response of State Space System with given initial states.
4. lsim Response to arbitrary inputs
Given a transfer function of a closed-loop control system, the function step(num,den)
produces the step response plot with the time vector automatically determined. If the closed-
loop system is defined in state space, we use step(A,B,C,D), step(A,B,C,D,t) or
step(A,B,C,D,iu,t) uses the supplied time vector t. the scalar iu specifies which input is to be
used for the step response. If the above command are invoked with the left hand argument
[x,y,t], the output vector y, the state response x, and the time vector t are returned, and we
need to use plot function to obtain the plot. Similarly for impulse , initial and lsim.
Experiment (10)

Aim:- Obtain the unit step response for the system with the following transfer function
C( s) 25(1+0.4 s)
=
R( s) ( 1+ 0.16 s ) (s 2+ 6 s +25)

Requirement:-
Operating System – Windows XP
Constructor - Simulator
Software - MATLAB R-2010

Theory: -Use the damp function to obtain the root of the characteristic equation, the
corresponding damping function, and natural frequencies.
Program:
num=25*[0.4,1];
den=conv([1, 0.16],[1,6,25]);
step(num,den),grid % Obtain the step response plot
T=tf(num,den);
damp(T) % Returns Roots of CE damping ratio ,wn

Results:
Eigenvalue Damping Freq. (rad/s)

-1.60e-001 1.00e+000 1.60e-001


-3.00e+000 + 4.00e+000i 6.00e-001 5.00e+000
-3.00e+000 - 4.00e+000i 6.00e-001 5.00e+000
Experiment (11)
Aim: To obtain step response and time domain specifications for the given system

Requirement:-
Operating System – Windows XP
Constructor - Simulator
Software - MATLAB R-2010

Theory: -the control system Toolbox LTI viewer is a GUI that simplifies the
analysis of linear time invariant system. we use the LTI viewer to view and
compare the response plots of several linear models at the same time. We can
generate time and frequency response to inspect key response parameters, such as
rise time, maximum overshoot, and stability margin.
The command syntax is
ltiview(‘plot type’,sys,extra)
where sys is the transfer function name ‘plot type’ is one of the following
responses:
step bode
impulse nyquist
initial nicholas
lsim sigma
Program:
clear;
clc;
Gc=tf([50,70],[1,7]); % TF Gc
Gp=tf([1],[1,5,4,0]); %TF Gp
H=1;
G=series(Gc,Gp); % connect Gc and Gp in series
T=feedback(G,1); % obtain closed loop TF
ltiview('step',T);

Results:
Transfer function:
50 s + 70
---------------------------------
s^4 + 12 s^3 + 39 s^2 + 78 s + 70

You might also like