Sei sulla pagina 1di 39

Exp No: Date:

Sri Mittapalli College of Engineering, Guntur Page 1




AMPLITUDE MODULATION AND DEMODULATION
AIM: To implement Amplitude modulation and demodulation by using MATLAB.
THEORY:
Amplitude Modulation may be defined as a system in which the maximum
amplitude of the carrier wave is made proportional to the instantaneous value
(amplitude) of the modulating or baseband signal.
Consider a sinusoidal carrier wave c(t) given as c(t)=Acos(wct).
Here, A is the maximum amplitude of the carrier wave and Wc is the carrier
frequency.
Let x(t) denotes the modulating or base band signal then according to the
amplitude modulation, the maximum amplitude A of the carrier will have to be
made proportional to the instantaneous amplitude of the modulating signal x(t).
The standard equation for amplitude modulation wave may be
expressed as
( ) ( ) ( ) ( ) t w A t w t x t S
c m
cos cos + =

In the process of amplitude modulation, the frequency and phase of the
carrier remain constant where as the maximum amplitude varies according to the
instantaneous value of the information signal.











Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 2


PROGRAM:
clc
clear all
close all
t=0:.001:.5;
am=1;
ac=1.5;
fm=10;
fc=100;
wc1=2*pi*fm;
wc2=2*pi*fc;
k=am/ac;
ct=ac*sin(wc2*t);
mt=am*sin(wc1*t);
s=(1+k*mt).*ct;
subplot(4,1,1)
plot(t,mt)
title('Modulating Signal')
subplot(4,1,2)
plot(t,ct)
title('carrier Signal')
subplot(4,1,3)
plot(t,s,t,ac+mt,t,-ac-mt)
title('Modulated Signal with enevelope')
subplot(4,1,4)
s2=(1/pi)*(ac+mt);
Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 3

plot(t,mt,t,s2)
title('Demodulated Signal')







RESULT:















CONCLUSION: Amplitude modulation and demodulation is implemented by using
MATLAB.

Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 4




FREQUENCY MODULATION AND DEMODULATION
AIM: To implement Frequency modulation and demodulation by using MATLAB.

THEORY:
Suppose the baseband data signal (the message) to be transmitted
is xm(t) and the sinusoidal carrier is , where fc is the
carrier's base frequency and Ac is the carrier's amplitude. The modulator combines
the carrier with the baseband data signal to get the transmitted signal:



In this equation, is the instantaneous frequency of the oscillator
and is the frequency deviation, which represents the maximum shift away
from fc in one direction, assuming xm(t) is limited to the range 1.
Although it may seem that this limits the frequencies in use to fc f, this
neglects the distinction between instantaneous frequency and spectral frequency.
The frequency spectrum of an actual FM signal has components extending out to
infinite frequency, although they become negligibly small beyond a point.









Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 5



PROGRAM:
clc
clear all
close all
t=0:.001:2;
am=.1;
ac=.2;
fm=2;
fc=10;
k=2;
wc1=2*pi*fm;
wc2=2*pi*fc;
mt=am*cos(wc1*t);
ct=ac*cos(wc2*t);
s=ac*cos(wc2*t+k*sin(wc1*t));
subplot(4,1,1)
plot(t,mt)
title('Modulating Signal')
subplot(4,1,2)
plot(t,ct)
title('carrier Signal')
subplot(4,1,3)
plot(t,s,t,mt)
title('Modulated Signal w.r.t message signal')
subplot(4,1,4)
s2=ac*(wc2+k*mt);
plot(t,s2)
title('Demodulated Signal')








Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 6

RESULT:





CONCLUSION: Frequency modulation and demodulation is implemented by using
MATLAB.




Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 7

QPSK MODULATION AND DEMODULATION

AIM: To implement QPSK modulation and demodulation by using MATLAB.

THEORY:
Modulation:
Quaternary PSK is also called as Quadrature PSK is another form of angle-
modulated, constant amplitude digital modulation. QPSK is an M-ary encoding
Scheme, where N=2 and M=4 (hence, the name Quaternary). With QPSK 4 output
phases are possible for a single carrier frequency. Because there are about 4
output phases, there must be 4 different input conditions: 00, 01, 10, 11 are
possible. Therefore with QPSk, the binary input data are combined into groups of
two bits called dibits. Each dibit code generates one of the four possible output
phases (+45
0
, +135
0
, -45
0
, -135
0
). Therefore for each two-bit dibit clocked into the
modulator, a single output change occurs.
In transmitter the two dibits are clocked into bit splitter. One bit directed to I
channel and other to Q- channel. I bit modulates a carrier that is in phase with
reference oscillator and Q bit modulates a carrier that is 90
0
out of phase or
Quadrature to the reference carrier. These are combined by a linear summer to get
the QPSK output.
Demodulation:
The reverse process is done at the receiver where carrier recovery and
product detectors are used to get the demodulated QPSk.











Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 8

PROGRAM:
clc
close all
clear all
M = 4;
x = randint(1,10,M);
subplot(2,1,1),stairs(x)
title('input signal')
y=modulate(modem.pskmod(M),x);
z = demodulate(modem.pskdemod(M),y);
subplot(2,1,2),stairs(z)
title('output demodulated signal')
scatterplot(y)


















Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 9

RESULT:


CONCLUSION: QPSK modulation and demodulation is implemented by using
MATLAB.



Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 10

TIME DIVISION MULTIPLE ACCESS TECHNIQUE
AIM: To implement TDMA technique by using MATLAB.

THEORY:
Time division multiple access (TDMA) is a channel access method for shared
medium networks. It allows several users to share the same frequency channel by
dividing the signal into different time slots. The users transmit in rapid succession,
one after the other, each using his own time slot. This allows multiple stations to
share the same transmission medium (e.g. radio frequency channel) while using
only a part of its channel capacity. TDMA is used in the digital 2G cellular
systems such as Global System for Mobile Communications (GSM), IS-
136, Personal Digital Cellular (PDC) and IDEN, and in the Digital Enhanced
Cordless Telecommunications (DECT) standard for portable phones. It is also used
extensively in satellite systems, and combat-net radio systems. TDMA is a type
of Time-division multiplexing, with the special point that instead of having
one transmitter connected to one receiver, there are multiple transmitters. In the
case of the uplink from a mobile phone to a base station this becomes particularly
difficult because the mobile phone can move around and vary the timing
advance required to make its transmission match the gap in transmission from its
peers.













Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 11

PROGRAM:
close all
clc
clear all
n=1:10;
t1=randn(1,10);
t2=randn(1,10);
t3=randn(1,10);
c=zeros(1,30);
s=1;
j=1;
for i=1:3:30
c(i)=t1(j);
c(i+1)=t2(j);
c(i+2)=t3(j);
j=j+1;
end
subplot(7,1,1),stem(t1)
title('Transmited signal in channel 1')
subplot(7,1,2),stem(t2)
title('Transmited signal in channel 2')
subplot(7,1,3),stem(t3)
title('Transmited signal in channel 3')
subplot(7,1,4),stem(c)
title('Transmited signal through channel')
for k=1:3:30
r1(s)=c(k);
r2(s)=c(k+1);
r3(s)=c(k+2);
s=s+1;
end
subplot(7,1,5),stem(r1)
title('Recieved signal in channel 1')
subplot(7,1,6),stem(r2)
title('Recieved signal in channel 2')
subplot(7,1,7),stem(r3)
title('Recieved signal in channel 3')








Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 12

RESULT:




CONCLUSION: TDMA technique is implemented by using MATLAB.



Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 13

CODE DIVISION MULTIPLE ACCESS TECHNIQUE
AIM: To implement CDMA technique by using MATLAB.

THEORY:
CDMA is a spread spectrum multiple access
[1]
technique. A spread spectrum
technique spreads the bandwidth of the data uniformly for the same transmitted
power. Spreading code is a pseudorandom code that has a narrow Ambiguity
function, unlike other narrow pulse codes. In CDMA a locally generated code runs
at a much higher rate than the data to be transmitted. Data for transmission is
combined via bitwise XOR (exclusive OR) with the faster code. The data signal with
pulse duration of Tb is XORed with the code signal with pulse duration of Tc.
(Note: bandwidth is proportional to 1 / T where T = bit time) Therefore, the
bandwidth of the data signal is 1 / Tb and the bandwidth of the spread spectrum
signal is 1 / Tc. Since Tc is much smaller than Tb, the bandwidth of the spread
spectrum signal is much larger than the bandwidth of the original signal. The
ratio Tb / Tc is called spreading factor or processing gain and determines to a
certain extent the upper limit of the total number of users supported
simultaneously by a base station. Each user in a CDMA system uses a different
code to modulate their signal. Choosing the codes used to modulate the signal is
very important in the performance of CDMA systems. The best performance will
occur when there is good separation between the signal of a desired user and the
signals of other users. The separation of the signals is made by correlating the
received signal with the locally generated code of the desired user. If the signal
matches the desired user's code then the correlation function will be high and the
system can extract that signal. If the desired user's code has nothing in common
with the signal the correlation should be as close to zero as possible (thus
eliminating the signal); this is referred to as cross correlation. If the code is
correlated with the signal at any time offset other than zero, the correlation should
be as close to zero as possible. This is referred to as auto-correlation and is used to
reject multi-path interference.









Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 14

PROGRAM:
clear all
close all
clc
user1=[1 0 1 0];
subplot(3,2,1),stem(user1)
title('user1 data')
user1code=[1 -1];
user2=[1 1 1 0];
subplot(3,2,2),stem(user2)
title('user2 data')
user2code=[-1 -1];
c=kron(user1,user1code);
d=kron(user2,user2code);
y=c+d;
subplot(3,2,3),stem(y)
title('data send through channel')
a=ones(1,length(y)/2);

b=kron(a,user1code);
rr=b.*y;
o=reshape(rr,2,length(rr)/2);
k=o(1,:)+o(2,:);
user1_data=k>0;
subplot(3,2,4),stem(user1_data)
title('user1 decodded data')

f=kron(a,user2code);
ss=f.*y;
m=reshape(ss,2,length(ss)/2);
kk=m(1,:)+m(2,:);
user2_data=kk>0;
subplot(3,2,5),stem(user2_data)
title('user2 decodded data')






Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 15

RESULT:




CONCLUSION: CDMA technique is implemented by using MATLAB.




Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 16

EFFECT OF SAMPLING AND QUANTIZATION OF DIGITAL IMAGE

AIM: To study the effect of sampling and quantization of digital image by using
MATLAB.

THEORY:
Formation of digital image from a continuous image basically involves two
steps:
1. Sampling
2. Quantization
An image may be continuous with respect to x and y coordinates and also in
amplitude. Digitizing the coordinate values is called sampling where as digitizing
the amplitude values are called quantization.
Let the continuous image be f(x, y) which we want to convert into digital form.
Let us take the continuous image along the line segment QR. The random
variations that are seen are due to image noise. This function is sampled and
quantized to get digital output.
Sampling is done by taking equally spaced samples along the line QR. the set of
discrete locations gives the sampled function. However, the values of the samples
still span a continuous range of gray-level values. In order to form a digital
function, the gray level values also must be converted into discrete quantities. The
continuous gray levels are quantized simply by assigning one of the discrete gray
levels to each sample. The assignment is made depending on the vertical proximity
of a sample to a vertical tick mark. Starting from the top of the image and carrying
out this procedure line by line produces a two-dimensional digital image.









Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 17

PROGRAM:
clc
clear all
close all
a=imread('cameraman.tif');
imshow(a)
title('Original image')
% Down sampling of an image
b=imresize(a,2);
figure, imshow(b)
title('Sampled image')
% Quantization of an Image
x1=grayslice(a,128);
figure,imshow(x1,gray(128))
title('Quantized image with 128 graylevels')
x2=grayslice(a,64);
figure,imshow(x2,gray(64))
title('Quantized image with 64 graylevels')
x3=grayslice(a,32);
figure,imshow(x3,gray(32))
title('Quantized image with 32 graylevels')
x4=grayslice(a,8);
figure,imshow(x4,gray(8))
title('Quantized image with 8 graylevels')
x5=grayslice(a,2);
figure,imshow(x5,gray(2))
title('Quantized image with 2 graylevels')















Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 18

RESULT:

























CONCLUSION: Effect of sampling and quantization of digital image is studied by
using MATLAB.
Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 19

FOURIER TRANSFORM

AIM: To implement Fourier transform on digital image by using MATLAB.

THEORY:
The discrete Fourier transform of two dimensional function f(x, y) of
size M x N is given by



Where, u=0,1,2,3..(M-1)
v=0,1,2,3..(N-1)
Inverse discrete transform
( ) ( )
|
.
|

\
|
+

=
N
vy
M
ux
j
M
u
N
v
e v u f y x F
t 2
1
0
1
0
* , ,


Where, x=0,1,2,3..(M-1)
y=0,1,2,3..(N-1)

The variables u and v represents transform or frequency variables and x and y
represents spatial coordinates.








( ) ( )
|
.
|

\
|
+

=
N
vy
M
ux
j
M
x
N
y
e y x f v u F
t 2
1
0
1
0
* , ,
Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 20

PROGRAM:
clc
clear all
close all
a=zeros(30,30);
a(5:24,13:17)=1;
subplot(2,2,1),imshow(a)
title('original image')
b=fft2(a);
subplot(2,2,2),imshow(b)
title('Fourier transformed image')
c=ifft2(b);
subplot(2,2,3),imagesc(c)
title('inverse fourier transformed image')


















Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 21

RESULT:





CONCLUSION: Fourier transform on digital image is implemented by using
MATLAB.








Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 22

HADAMARD TRANSFORM

AIM: To implement Hadamard Transform on digital image by using MATLAB.

THEORY:
Hadamard transform depends upon the hadamard matrix. The matrix,
which consists of square array of plus and minus ones rows and columns is said
to be hadamard matrix. The columns and rows in hadamard matrix are orthogonal
.
The hadamard matrix of size N is given by





Hadamard matrix divided by 2 is called the sequence of the row. It is possible to
construct a Hadamard matrix of order N=2
n
whose number of sign changes per row
increases from 0 to N-1.




Where, v= Transformed Image
U= inverse Transform







(

=
N N
N N
N
H H
H H
H
2
HvH u
HuH v
=
=
Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 23

PROGRAM:
clc
clear all
close all
a=8;
n=2^a;
m=hadamard(n)
b=imread('cameraman.tif');
subplot(2,2,1),imshow(b)
title('original image')
c = double(b) + 1;
d=m*c*m;
subplot(2,2,2),imshow(d)
title('hadamard tranformed image')
x=m*d*m;
subplot(2,2,3),imagesc(x)
title('inverse hadamard transformed image')



















Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 24

RESULT:





















CONCLUSION: Hadamard Transform on digital image is implemented by using
MATLAB.





Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 25

ENHANCEMENT TECHNIQUE IN SPATIAL FREQUENCY DOMAIN

AIM: To implement enhancement technique in spatial frequency domain by using
MATLAB.


THEORY:
Gray level transformation is the transformation using which powerful
processing approaches can be formulated. Because enhancement at any point
depends only on the gray level at that point, techniques in this category are often
referred to a point processing techniques.
The main objective of image enhancement is to improve the quality of an
image event if no prior model of the degradation is available. This can be achieved
by increasing the dominance of some features or by decreasing the ambiguity
between different regions of the image.

















Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 26

PROGRAM:
clc
clear all
close all
a=imread('cameraman.tif');
h = fspecial('motion',50,0);
i = imfilter(a,h,'circular','conv');
w2=deconvwnr(i,h);
subplot(2,2,1),imshow(a)
title('Original image')
subplot(2,2,2),imshow(i)
title('Blurred image')
subplot(2,2,3),imshow(w2)
title('Deblurred image')




















Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 27

RESULT:





















CONCLUSION: Enhancement technique in spatial frequency domain is
implemented by using MATLAB.





Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 28


POINT, LINE AND EDGE DETECTION TECHNIQUES USING DERIVATIVE OPERATIONS

AIM: To implement point, line and edge detection techniques using derivative
operations by using MATLAB.

THEORY:
Consider an analog f(x) which represents a typical 1-D edge it is reasonable
to consider the value x0 as edge point. One way to determine x0 is to find f(x) or
f(x). The value of x0 can be found by looking at the max or min of f(x) or by
looking at the zero crossing of f(x) where f(x) changes its sign. The additional to
determining x0 (the edge point). F(x) can also be used in estimating the strength
and direction of the edge. If ( ) x f ' is large => f(x) is changing very rapidly and a
rapid change in intensity is indicated. If f(x) is positive => f(x) is increasing. If all
values of x such that ( ) x f ' is greater than a certain threshold are detected to be
edges, an edge will appear as a line rather than a point. To avoid this problem we
further require ( ) x f ' having a local maximum at the edge points. The informing
about direction of edge is contained in f(x) at x=xo (either positive or negative). The
choice of threshold depends on its application. It is possible to choose the threshold
adaptively.
The generalization of f(x) to 2-Dimensional function f(x,y) is the gradient
( ) y x f , V given by
( )
( ) ( )
y x
L
y
y x f
L
x
y x f
y x f

,

,
,
c
c
+
c
c
= V

Where,
x
L

and
y
L

are unit vectors in x and y directions respectively.









Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 29

PROGRAM:
clear all
clc
close all
a=imread('flowers.tif');
b=rgb2gray(a);
% point detection
w1=[-1 -1 -1; -1 7 -1; -1 -1 -1];
g=imfilter(double(b),w1);
figure,imshow(g)
title('point detected image')
% Line detection
w2=[-1 2 -1; -1 2 -1; -1 2 -1];
g3=imfilter(double(b),w2);
figure,imshow(g3)
title('line detected image')
% edge detection
e1 = edge(b,'sobel');
e2 = edge(b,'canny');
e3 = edge(b,'prewitt');
e4 = edge(b,'roberts');
figure,imshow(b)
title('gray scale image')
figure,imshow(e1)
title('Sobel edge detector')
figure,imshow(e2)
title('canny edge detector')
figure,imshow(e3)
title('prewitt edge detector')
figure,imshow(e4)
title('roberts edge detector')












RESULT:

Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 30


























CONCLUSION: Point, line and edge detection techniques using derivative
operations are implemented by using MATLAB.

Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 31

COLOR CANCELLATION ENHANCEMENT TECHNIQUES

AIM: To implement color cancellation enhancement technique by using MATLAB.

THEORY:
The local enhancement is used to enhance the pixels in an area in the
image, where the pixel size is almost negligible. Local enhancement has an
advantage over histogram equalization and histogram specifications, i.e., it can
enhance the information over small areas in an image.
The histogram equalization or histogram specification is performed on a
center pixel, the center of the neighborhood region is moved to adjacent pixel
location and the above process is repeated. While changing the center location the
histogram obtained in the earlier location is updated. By using this process, it is
possible to compute the histogram over every pixel.


















Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 32

PROGRAM:
clc
clear all
close all
a=imread('office_1.jpg');
%Conversion of RGB to YIQ format
b=rgb2ntsc(a);
figure,hist(b)
%Histogram equalization of Y component alone
b(:,:,1)=histeq(b(:,:,1));
figure,hist(b)
%Conversion of YIQ to RGB format
c=ntsc2rgb(b);
figure,imshow(a),title('original image')
figure,imshow(c),title('Histogram equalized image')




















Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 33

RESULT:





















CONCLUSION: Color cancellation enhancement technique is implemented by
using MATLAB.





Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 34

ECHO CANCELLATION IN SPEECH SIGNAL

AIM: To implement echo cancellation in speech signal by using MATLAB.

THEORY:
Echoes in speech cause a major problem in speaker recognition, speech
enhancement ect. These echoes being caused at transmitter size increases its effect
along with the noise. Echo cancellation is a priority for speech processing spectrum
analysis is a non linear technique for detection of echoes. In this program read any
speech file and calculate the number of samples and set a sample value from which
instant an echo starts. Add a delayed signal to the original signal to obtain speech
signal with echo. Now subtract the original signal from the echo signal In order to
find the original signal without echo.


















Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 35

PROGRAM:
clc
clear all
close all
[x,fs,nbits]=wavread('SIREN.wav');
wavplay(x,fs);
subplot(3,1,1),plot(x)
title('original signal')
xlen=length(x);
a=5;
R=ceil(fs);
t=1:1:xlen;

% y=zero(size(x));
for i=1:1:R+1
y(i)=x(i);
end
for i=R+1:1:xlen
y(i)=x(i)+x(i-R);
end
wavplay(y,fs)
subplot(3,1,2),plot(y)
title('echo added signal')
z=zeros(size(y));
for i=1:1:R+1
z(i)=y(i);
end
for i=R+1:1:xlen
z(i)=y(i)-x(i-R);
end
wavplay(z,fs)
subplot(3,1,3),plot(z)
title('echo removed signal')












Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 36

RESULT:




CONCLUSION: Echo cancellation in speech signal is implemented by using
MATLAB.





Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 37


LMS ALGORITHM

AIM: To implement LMS algorithm by using MATLAB.

THEORY:
In much application requiring Neural Networks the necessary weights and
bias may not be known. In such applications a learning algorithm which can design
automatically the weights and bias is extremely useful. The simplest and most
commonly used algorithm is LMS algorithm which is given by the following
equations:
) ( 2 ) ( ) 1 (
) ( ) ( 2 ) ( ) 1 (
k e k b k b
k P k e k W k W
T
o
o
+ = +
+ = +

Where w=weights
b= Bias
=Step size
e(k)=error












Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 38


PROGRAM:
clc
clear all
p1=[1; -1; -1];%orange
t1=-1;
p2=[1 ;1 ;-1];%apple
t2=1;
w=zeros(1,3);
a=w*p1;
while(a~=t1)
w=w+2*0.2*(t1-a)*p1';
a=w*p1;

end
a=w*p2;
while(a~=t2)
w=w+2*0.2*(t2-a)*p2';
a=w*p2;

end
z=[1; -1; -1];
z1=w*z;
hold on
plot(z1,'*'),plot(t1,'o')
title('error plot for orange')
hold off
z2=[1 ;1 ;-1];
z3=w*z2;
figure, hold on
plot(z3,'*'),plot(t2,'o')
title('error plot for apple')











Exp No: Date:


Sri Mittapalli College of Engineering, Guntur Page 39


RESULT:




















CONCLUSION: LMS algorithm is implemented by using MATLAB.

Potrebbero piacerti anche