Lab Final
Lab Final
Lab Final
ENGINEERINGAND TECHNOLOGY
ECR, MAMALLAPURAM,CHENNAI-603104.
DEPARTMENT OF ELECTRONICS
AND
COMMUNICATION
LAB MANUAL
Regulations 2021
Branch :M.E-CS
1 SPECTRAL CHARACTERISATIONOF
COMMUNICATION SIGNALS(USING
SPECTRUM ANALYZER)
7 ANALYSIS OF RADIATION
PATTERN AND
MEASUREMENT
8 NOISE CANCELLATION
9 NOISE CANCELLATION
10 MULTIRATE SIGNAL
PROCESSING
EX N O :
DATE :
SPECTRAL CHARACTERISATION OF COMMUNICATION
SIGNALS (USING SPECTRUM ANALYZER)
AIM:
Analyze the spectral content of a simple sign
EQUIPMENTS REQUIRED:
THEORY:
A waveform representing amplitude, as a function of time, is called a time domain display. It is also
possiblefor a waveform to represent amplitude as a function of frequency. This is called a frequency
domain display.A Spectrum Analyzer is an instrument, which can display the frequency domain
of a signal. However, the RTM3004 Oscilloscope has the capability of producing both time domain
and frequency domain displays.
A sine wave is the simplest signal for spectral analysis. The amplitude of the sine wave can be
determinedon the vertical scale and the frequency can be determined on the horizontal scale.
The units of amplitude used in this experiment will be dBV, which is dB relative to 1 VRMS (0 dBV =
1VRMS), according to the formula:
Vsignal
dBV = 20log( ) (1.1)
Vref
where Vsignal is the RMS voltage of the signal and Vref = 1 volt RMS.
Another common unit of amplitude used for spectrum analysis is dBm, which is dB relative to 1
milliwatt, according to the formula:
Psignal
dBm = 10log( ) (1.2)
Pref
where Psignal is the power of the signal in milliwatts and Pref = 1 mW.
PROCEDURE
a. Set the Function Generator for a sine wave output with a frequency of 4 KHz. Set the amplitude to 2 voltpeak-to-
peak with zero DC offset.
Oscilloscope Reset:
b. Connect the Channel 1 output of the Function Generator to Channel 1 input of the Oscilloscope using aBNC to
BNC cable. Turn on the Channel 1 output of the Function Generator.
Switch the oscilloscope to MAX. SA. RATE mode. You can achieve that by clicking on the second
upper label near C1 and change the GSa/s Acquire Mode to High Resolution after a menu
appears on the right of the screen.
This sets the vertical, horizontal, and trigger for a stable display of the waveform.
f. Press Channel 1 button to display the menu on the right side of the screen and select an Input Impedanceof 50 Ohms
under the Termination label.
For this experiment, the output of the Function Generator must be terminated into a 50 Ohm
But the total number of horizontal divisions is 12. Then, for 10 cycles to appear we need the time
duration per division (i.e., Timebase) to be 2500/12 = 208.33µs/div. But the available
durations per division are specified. So pick the value appearing in the scroll menu just above the
calculated valued, that is 500µs. Or click on the menu button and adjust the value to the
calculated one 208.33µs/div.
b. Press on the FFT icon touch button on the right top pane.
The screen is split into two panes; see Fig. 1.1. The upper pane (2) displays the previously defined
voltage-time trace for the measured signal and the settings for the horizontal system. That is, the
waveform in the time domain. The zoom and position information is displayed in between the two
panes (3). Only the signalsegment that is displayed on the monitor and bound by the two vertical
white lines is used for the FFT.
The FFT displays the frequency domain by expressing the input signal as a combination of
simple sig- nals and produces a waveform to display the amplitude verses frequency of the
component frequenciesof the input signal.
c. Now, either
i) Double press the FFT button under the Analysis grouping and a menu will appear on the right of thescreen
(Fig. 1.2),
ii) or by clicking on the FFT label on the bottom pane, a menu will appear (Fig. 1.3), then Press on Menu.The right
menu will appear (Fig. 1.2).
On this right pane menu ,these should be selected, if not already set:
d. First, adjust the time duration per division (timebase) on the top pane from 833.33µs/div to 200ms/div
and then select a maximum signal segment for the FFT.
Span shows the size of the currently displayed frequency range. The span, time- base and selected segment
are directly linked to one another. As the selection for the timebase and the range in the time domain
displayed between the two vertical lines increases, so too decreases the frequency band that can be set.
Center defines the frequency at the center ofthe segment displayed on the monitor. The minimum step
size can be set indirectly via the number of points.
e. Set now the value of the RBW (5 in Fig. 1.4) to the maximum (i.e. by clicking on RBW on the bar betweenthe two
screen and adjusting the value to the maximum allowed).
f. On the bar between the two panes that display time and frequency domains respectively, set Start (1 in Fig. 1.4)
value to 0, you can achieve that by clicking on the Start label where calculator form menu appearsand you can set the
value. This will be the value of the minimum frequency displayed.
g. Similarly, adjust the Stop (2 in Fig. 1.4) value to a value above 4KH𝑥, let’s say 8KH𝑥. N.B. Usuallyyou need
this value of 8KH𝑥 to fall between the minimum value and maximum value allowed for the Stop value. Therefore, you
need to readjust the time duration per division (timebase) so that is satisfied. Adjustthe center frequency to 4KH𝑥
you can set this value through clicking on Center in the middle bar. See the blue frame comments.
Using the Cursors:
First, for a better view of the frequency domain screen. Move the double arrow bar of the lower
screen upwards so that the frequency domain is the only display on the oscilloscope. There are a
variety of ways to measure the amplitude. One method is to use the Cursors.
a. Press the Cursors button twice on the front panel to activate the cursors. At the first click a bar will appearshowing
the values at the used cursors. After the second click a right menu will appear. On the Type, set toVertical & Horizontal,
so that both types of cursors appear on the screen. Set the Source to FFT: Spectrum,so that the frequency domain
cursors appear.
Cursors 1 and 2 are the horizontal
cursors.Cursors 3 and 4 are the vertical
cursors.
Click on number 1 on the cursor line and move it to the desired point on the spectrum. Its peak
value in our case. The amplitude measured by the Cursor 1 is now displayed on the bar near label
L1 and the corresponding frequency value near label f1.
Taking a Measurement:
a. Decrease the amplitude of the Function Generator out− put to 10 dBV as measured in the
frequency domain display. Now, switch to the time domain display. Press on the measure button.
A menu will appearon the right of the screen. Set the Measure Place to 1. Turn the Measure 1 bar
to on. Choose the Type to the type of measurement (peak to peak). Read the peak-to-peak voltage
measurement that will appear onthe bottom left of the screen above the channels bar. Does this
measurement agree with the value that youcalculated in the Preparation?
Using the Zoom Feature:
a. Turn the time domain on again by pressing the CH1 button. Turn the Zoom on by pressing the
Zoom button. Press on the part of the signal you want to zoom in. By using the two fingers motion
that you use onthe i-pad for zooming, double-tap with two fingers to zoom in and back out so that
you can adjust the signalpart you want to inspect to the right resolutio
In your report, describe what you have learned in this experiment. Compare your experimental measure- ments with
the theoretical calculations. Remember to insert the picture that you saved as part of your report.Write all conclusions.
Follow the instructions listed in the Appendix regarding outline and required analysis.
RESULT:
Thus the spectral content of given simple signal is analyzed
EX NO: DESIGN AND ANALYSIS OF SPECTRUM ESTIMATORS
DATE :
(BARTLETT, WELCH)
AIM:
To Stimulate and Performance of Design and Analysis of Spectrum Estimators-
(Bartlett, Welch) by using MAT Lab.
SOFTWARE REQUIRED
THEORY:
To estimate the power spectral density of a wide-sense stationary random process.
Recall that the power spectrum is the Fourier transform of the autocorrelation
sequence.
For an ergodic process, the following holds.
Bartlett’s method
Averaging (same mean) a set of uncorrelated measurements of a random variable results
in a consistent estimate of its mean In other words: Variance of the sample mean is inversely
proportional to the number of measurements Hence this should also work here, by averaging
Periodograms
Welch’s Method
Two modifications to Bartlett’s method
1) the subsequences are allowed to overlap
2) instead of Periodograms, modified Periodograms are averaged
Assuming that successive sequences are offset by D points and that each sequence
is L points long, then the ith sequence is
Thus, the overlap is L-D points and if K sequences cover the entire N data points,
then
n = 0:511;
x = cos(pi/3*n)+randn(size(n)); segmentLength
= 132;
[pxx,w] = pwelch(x,segmentLength);
plot(w/pi,10*log10(pxx))
xlabel('\omega / \pi')
Output
RESULT:
Thus, the Performance of Design and Analysis of Spectrum Estimators-(Bartlett, Welch) by
using MAT Lab.
EX NO:
DATE: DESIGN AND ANALYSIS OF DIGITAL MODULATION
TECHNIQUES ON AN SDR PLATFORM
Aim:
To write and simulate a MATLAB program to Generate and detect Binary Digital
ModulationTechnique (BASK).
Equipment Required:
Computer
Windows 7
MATLAB 7
Algorithm:
BASK Modulation
1. Clear the command window, workspace and close the figure windows.
2. Generate carrier signal.
3. Generate message signal.
4. Generate ASK modulated signal.
5. Plot message signal, carrier signal and ASK modulated signal.
BASK Demodulation
PROGRAM:
%%preliminaries
clc
clear all;
close all;
%%inputs
F1 =25;
F2 =5;
A =3;
t = 0:0.001:1;
%%plots
subplot(5,1,1)
plot (t,x);
xlabel('time')
ylabel ('amplitude')
title('carrier signal')
grid on;
subplot(5,1,2)
plot(t,u);
xlabel('time')
ylabel ('amplitude')
title('Message signal');
grid on;
subplot(5,1,3)
plot(t,v);
xlabel('time')
ylabel ('amplitude')
title('ASK modulated signal')
grid on;
OUTPUT:
RESULT:
Thus the program for BASK modulation and demodulation has been simulated in MATLAB and
necessary graphs were plotted.
EX NO:
DATE:
DESIGN AND PERFORMANCE ANALYSIS OF ERROR CONTROL
ENCODER AND DECODER(BLOCK AND CONVOLUTIONAL CODES)
AIM:
To simulate the generates Matrix, Code word, Parity check Matrix and error syndrome for
a (7, 4) cyclic code using MATLAB.
APPARATUS REQUIRED:
1. Personal computer.
2.MATLAB software.
for n = 1:length(EbNoVec)
% Convert Eb/No to SNR
snrdB = EbNoVec(n) + 10*log10(k*rate);
% Noise variance calculation for unity average signal power.
noiseVar = 10.^(-snrdB/10);
% Reset the error and bit counters
[numErrsSoft,numErrsHard,numBits] = deal(0);
% QAM modulate
txSig = qammod(dataEnc,M,'InputType','bit','UnitAveragePower',true);
% Calculate the number of bit errors in the frame. Adjust for the
% decoding delay, which is equal to the traceback depth.
numErrsInFrameHard = biterr(dataIn(1:end-tbl),dataHard(tbl+1:end));
numErrsInFrameSoft = biterr(dataIn(1:end-tbl),dataSoft(tbl+1:end));
end
Plot the estimated hard and soft BER data. Plot the theoretical performance for an uncoded64-QAM
channel.
semilogy(EbNoVec,[berEstSoft berEstHard],'-*')
hold on
semilogy(EbNoVec,berawgn(EbNoVec,'qam',M))
legend('Soft','Hard','Uncoded','location','best')
grid
xlabel('Eb/No (dB)')
ylabel('Bit Error Rate')
RESULT:
AIM:
To design a Channel Equalizer (LMS, RLS) using MATLAB.
SOFTWARE REQUIRED:
ISI caused by multipath in bandlimited time dispersive channels distorts the transmitted
signal causing bit error at the receiver . ISI has been recognized as the major obstacle to light speed
data transmission over wireless channels. Equalization technique is used to compact ISI.
An equalizer is usually implemented at base band in a receiver. Since the band pass
waveforms represent the channel response demodulated signal, adaptive equalizer algorithms are
usually simulated and implemented at the baseband.
Linear Equalizer:
In linear equalizer the current and past values of the received signal are linearly
weighed by equalizing co-efficient and summed to produce the output using the relation,
C(z)= ∑ Ck z-kk
C(z)= h-1(z)
(i) Give the system simulated parameters Fs number of bits maximum errors.
(ii) Give the modulated signal parameters.
(iii) Give the channel parameters.
(iv) Give the maximum likelihood sequence estimates (MLSE) parameter.
(v) Give the channel estimation parameters.
(vi)Construct RLS & LMS linear equalizers objects.
(vii) Run linear equalizer.
PROGRAM:
OUTPUT:
System Output
2.5
1.5
0.5
-0.5
-1
-1.5
-2
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Samples
101
100
10-1
10-2
10-3
10-4
10-5
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Samples
PROGRAM:
1.5
0.5
-0.5
-1
-1.5
-2
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Samples
Error Curve
100
10-1
10-2
10-3
10-4
10-5
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Samples
Comparison of the Actual Weights and the Estimated Weights
Actual weights
Estimated weights
0.3
0.25
0.2
0.15
0.1
0.05 0 1 2 3 4 5 6
PROGRAM:
%Design of LMS Channel Equalizer
close all;
clear all;
clc;
randn('state',sum(100*clock));
rand('state',sum(100*clock));
numPoints = 5000;
numTaps=5;
Mu=0.01;
r=randn(numPoints,1);
x=(r+1i*r);
% h=rand(numTaps,1);
h=[1 0.2 -0.08];
h=h/max(h);
d=filter(h,1,x);
w=[];
y=[];
n1=[];
e=[];
w=zeros(numTaps+1,1)+1i*zeros(numTaps+
1,1); for n=numTaps+1:numPoints
in=x(n:-1:n-
numTaps);
y(n)=w'*in;
e(n)=d(n)-y(n);
w=w+Mu*(real(e(n)*conj(in))-
1i*imag(e(n)*conj(in))); end
figure(10);
semilogy(abs(e));
title(['LMS Adaptation Learning Curve using Mu=',num2str(Mu)]);
xlabel('Iteration Number');
ylabel('Output Estimation Error in dB');
OUTPUT
100
10-2
10-4
10-6
10-8
10-10
10-12
10-14
10-16
10-18 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
Iteration Number
RESULT:
Thus the Channel Equalizers (LMS, RLS) were designed with the given parameters using
MATLAB.
EX NO:
DATE:
AIM:
To simulate and plot the radiation characteristics of microstrip antennas using MATLAB.
SOFTWARE REQUIRED:
PC with MATLAB 7.0.4 Software Package.
THEORY:
Microstrip antennas are popular due to their light weight, comfort, ability and low cost.
These antennas are integrated with printed strip line feed networks and active devices. Rectangular
and Circular micro-strip resonant patches have been extensively in a variety of array
configurations. It consists of a radiating patch on one side of a dielectric substrate which has a
ground plane on the other side. The patch is generally made up of conducting material such as
copper or gold and can take any possible shape. The radiating patch and feed lines are usually
photo etched on the dielectric substrate.
It radiates primarily because of the fringing fields between the patch edge and the ground
plane. For antenna good performance, a thick dielectric substrate having a low dielectric constant
is desirable since this provides better efficiency, larger bandwidth and better radiation. Hence such
a configuration leads to a larger antenna size. Inorder to design a compact micro-strip patch
antenna substrates with higher dielectric constants must be used which are less efficient and result
in narrower bandwidth. Hence tradeoff must be realized between the antenna dimensions and
antenna performance.
PROCEDURE:
PROGRAM:
OUTPUT:
input the dielecric constant value:2.2
input the resonant frequency value in GHZ:10
input the height of microstrip in cm:0.1588
width of the microstrip in cm:
w = 1.1859
effective dielectric constant of the microstrip:
ereff = 2.2193
increase in length of the microstrip in cm:
inclen = 0.0785
length of the microstrip in cm
len =0.8499
effective of the microstrip in cm:
leff =1.0069
Performance of microstrip antenna
3.5
2.5
impedance
2
1.5
0.5
0
1 2 3 4 5 6 7 8 9 10
10
frequency x 10
100000000
150 30
50000000
Field Strength----- >
180 0
210 330
240 300
270
Angle---- >
RESULT:
Thus the Microstrip patch antenna was simulated and the field pattern was obtained
successfully
EX NO:
DATE: ANALYSIS OF RADIATION PATTERN
AND MEASUREMENT.
AIM:
To obtain radiation pattern of given dipole antenna using Matlab and to find the directivity,
HPBW, Directive gain and also to compute the main lobe to side lobe width.
APPARATUS REQUIRED:
THEORY:
A dipole antenna or double is the simplest and most widely used class of antenna. It consists
of two identical conductive elements such as metal wires or rods, which are usually bilaterally
symmetrical. The driving current from the transmitter is applied, or for receiving antennas the
output signal to the receiver is taken, between the two halves of the antenna. Each side of the
feedline to the transmitter or receiver is connected to one of the conductors. This contrasts with a
monopole antenna, which consists of a single rod or conductor with one side of the feedline
connected to it, and the other side connected to some type of ground. A common example of a
dipole is the "rabbit ears" television antenna found on broadcast television sets.
The most common form of dipole is two straight rods or wires oriented end to end on the
same axis, with the feedline connected to the two adjacent ends. This is the simplest type of antenna
from a theoretical point of view. Dipoles are resonant antennas, meaning that the elements serve
as resonators, with standing waves of radio current flowing back and forth between their ends. So
the length of the dipole elements is determined by the wavelength of the radio waves used. The
most common form is the half-wave dipole, in which each of the two rod elements is approximately
1/4 wavelength long, so the whole antenna is a half-wavelength long.Several different variations
of the dipole are also used, such as the folded dipole, short dipole, cage dipole, bow-tie, and
batwing antenna.
PROCEDURE:
PROGRAM:
clc;
clear all;
close all;
k= 2*pi;
m= k*len/2;
theta= 0:0.01*pi:2*pi;
p1= cos(m*(cos(theta)));
p2= p1-cos(m);
f1= [p2./(sin(theta)+eps)].^2;
polar(theta,abs(f1)./max(f1));
grid on;
CALCULATION:
Directive Gain = (Max. Gain obtained in the desired direction of the antenna) = dB
Directive Gain = dB
0.6
150 30
0.4
0.2
180 0
210 330
240 300
270
RESULT:
Thus the radiation pattern of the given dipole antenna was obtained .
HPBW =
Directive Gain =
DATE:
NOISE CANCELLATION
AIM
To design and analyze the noise cancellation with different filters (Median filter and Adaptive
filter) using MATLAB.
EQUIPMENTS REQUIRED
Computer
Windows 7
MATLAB 7
ALGORITHM
Clear the command window, workspace and close the figure windows.
Provide the number of unique senders/bit streams.
Encode and transmit at the transmitter.
Decode and reconstruct at the receiver.
Stop the program.
PROGRAM
%Preliminaries
clc;
clear all;
close all;
% Noise Removal by Median filter
I = imread('eight.tif');
imshow(I)
J = imnoise(I,'salt & pepper',0.02);
figure, imshow(J)
K = filter2(fspecial('average',3),J)/255;
figure, imshow(K)
L = medfilt2(J,[3 3]);
figure, imshow(L)
%Noise Removal by Adaptive filter
RGB = imread('saturn.png');
I = rgb2gray(RGB);
figure, imshow(I)
J = imnoise(I,'gaussian',0,0.025);
figure
imshow(J)
K = wiener2(J,[5 5]);
figure, imshow(K)
OUTPUT
RESULT
Thus the design and performance of Noise cancellation and its output are verified successfully
EXP.NO:
DATE:
ECHO CANCELLATION
AIM
ALGORITHM
Provide the input audio signal.
Add an echo to the input signal.
Remove echo from audio signal.
Label the figures.
Stop the program.
PROGRAM
clc;
clear all;
close all;
%Reading the original audio signal
fs=44100;
y=audioread('nokia.mp3');
%Playing the original song
p=audioplayer(y,fs);
plot(y);
play(p);
% stop(p)
%%
% play(p);
% stop(p);
%Adding echo
num=[1,zeros(1,4800),0.8];
den=[1];
x=filter(num,den,y);
p1=audioplayer(x,fs);
figure
plot(x);
play(p1);
%%
% stop(p);
%Removing echo
den=[1,zeros(1,4800),0.8];
num=[1];
r=filter(num,den,x);
p2=audioplayer(r,fs);
figure
plot(r)
play(p2);
%%stop(p);
OUTPUT
RESULT
Thus the audio signal with adding and removal of echo signal is verified
successfully withMATLAB SOFTWARE.
MULTIRATE SIGNAL PROCESSING
EX.NO:
DATE :
AIM
To perform multirate signal processing by upsampling and downsampling using
MATLA
B.
EQUIPMENTS REQUIRED
Computer
Windows 7
MATLAB 7
ALGORITHM
Clear the command window, workspace and close the figure windows.
Provide the input signal for sampling
Convert the signal using upsampling process by factor I
Convert the signal using upsampling process by factor D
Plot the amplitude response and time response curves.
Label the figure.
Stop the program
PROGRAM
%% Inputs
x=input('Enter the input sequence x(n) : ');
D=input('Enter the Decimation factor D : ');
I=input('Enter the Interpolation factor I : ');
%% Downsampling
disp('Downsampled Signal');
xD=downsample(x,D)
%Upsampling
disp('Upsampled
Signal');
xI=upsample(x,I)
%% Plots
subplot(2,2,1);
stem(x);
xlabel('----> n');
ylabel('----->
x(nD)'); title('Input
x(n)'); grid on;
subplot(2,2,2);
stem(xD);
xlabel('---->
n');
ylabel('-----> x(n)');
title('Downsampled sequence
x(nD)'); grid on;
subplot(2,2,[3
4]); stem(xI);
xlabel('----> n');
ylabel('-----> x(n/I)');
title('Upsampled Sequence
x(n/I)'); grid on;
OUTPUT
Downsampled Signal
xD = 1 3 5
Upsampled Signal
xI = 1 0 2 0 3 0 4 0 5 0
RESULT :
The Multirate Signal Processing has been done by up sampling and down sampling and
verified by plotting the amplitude response and time response using MATLAB.