Sie sind auf Seite 1von 74

EX.

O: 1
Date:

FIR ADAPTIVE FILTER USIG LEAST MEA


SQUARE ALGORITHM

AIM
To design a FIR adaptive filter using least mean square algorithm.

APPARATUS USED/TOOLS RERQUIRED


MATLAB 2009 Software

THEORY
There are number of techniques for processing nonstationary signals using adaptive
filters. These techniques have been exclusively used in a variety of applications including system
identification, signal modeling, spectrum estimation, noise cancellation and adaptive
equalization. The FIR adaptive filters are designed in such a way to minimize the mean square
error (n)=E |e(n)| between a desired process d(n) and an estimate of this process that is formed
by filtering another process x(n).Since the gradient of (n) involves an expectation of
e(n)x*(n),this approach requires knowledge of statistics of x(n) and d(n) and therefore is of
limited one in practice. Next if we replace the ensemble average E{|e(n)|} with the
instantaneous squared error |e(n)| this leads to the LMS algorithm, a simple and often effective
algorithm, that does not require any ensemble average to be known. For wide sense stationary
processes, the LMS algorithm converges in the mean, if the step size is positive and not larger
than 2/max (where max is the maximum Eigen value of autocorrelation matrix Rx) and it
converges in the mean-square. If the step size is positive and no larger than 2/tr (Rx) there are
several types of LMS algorithm available. The first is the normalized LMS algorithm, which
simplifies the selection of the step size to ensure that the coefficients converge. Next is the leaky
LMS algorithm, which is useful in overcoming the problems that occur when the autocorrelation
matrix of the input process is singular. There are also block LMS algorithm and the sign
algorithms, which are designed to increase the efficiency of the LMS algorithm. In the block
LMS algorithm, the filter coefficients are held constant over blocks of length L, which allows for
the use of fast convolution algorithm to compute the filter output .The sign algorithm, on the
other hand ,achieve their simplicity by replacing e(n) with sgn{e(n)} or x(n) with sgn{x(n)} or
both. A lattice filter can be used as an alternative structure for adaptive filter. Due to the
orthogonalization of the input process, the gradient adaptive lattice filter converges more rapidly
than the LMS adaptive filter and tends to be less sensitive to Eigen value spread in the
autocorrelation matrix of x (n).

ALGORITHM
1.
2.
3.
4.
5.

Generate the desired output signal and plot it.


Generate noise sequence and plot it.
Add the noise to the desired signal and to get the observed signal.
Initialize the step size in such a way that the mean square error is minimized.
Noise is minimized using the filter coefficient update equation using LMS algorithm.

PROGRAM
clc;
clear all; close all;
n=0:150;
d=sin(.125*pi*n);
subplot(2,2,1);
plot(n,d);
xlabel('n'); ylabel('d(n)'); title('desired signal');
v=.75*rand(size(n));
subplot(2,2,2);
plot(n,v);
xlabel('n'); ylabel('v(n)'); title('noise signal');
x=sin(.125*pi*n)+.75*rand(size(n));
subplot(2,2,3);
plot(n,x);
xlabel('n'); ylabel('x(n)'); title('observed signal');
N=21;
mu=0.01;
M=length(x)
y=zeros(1,M)
h=zeros(1,N)
for n=N:M
x1=x(n:-1:n-N+1);
y=h*x1'
e=d(n)-y;
h=h+mu*e*x1;
end
disp(h);
y1=conv(x,h);
n1=0:150;
y1=y1(:,1:151);
subplot(2,2,4);
plot(n1,y1); xlabel('n'); ylabel('y(n)'); title('filtered signal');
3

OUTPUT

RESULT

EX.O: 2

LIEAR BLOCK CODES

Date:
AIM

To generate linear block code for data transmission and identify the errors in received
message.

APPARATUS USED/TOOLS REQUIRED


MATLAB 2009 software

FORMULA USED:
In matrix form,
C=UG
C: Codeword
U: Message vector
G: Generator matrix

THEORY
Block coding is a special case of error-control coding. Block coding techniques map a
fixed number of message symbols to a fixed number of code symbols. A block coder treats each
block of data independently and is a memory less device.
The Binary Linear Encoder block creates a binary linear block code using a generator
matrix that you specify. If K is the message length of the code, then the Generator matrix
parameter must have K rows. If N is the codeword length of the code, then Generator matrix
must have N columns.
The input must contain exactly K elements. If it is frame-based, then it must be a column
vector. The output is a vector of length N.
The Binary Linear Decoder block recovers a binary message vector from a binary
codeword vector of a linear block code.
The input must contain exactly N elements. If it is frame-based, then it must be a column
vector. The output is a vector of length K.
The decoder tries to correct errors, using the Decoding table parameter. Decoding table
must be a 2N-K-by-N binary matrix. The rth row of this matrix is the correction vector for a
7

received binary codeword whose syndrome has decimal integer value r-1. The syndrome of a
received codeword is its product with the transpose of the parity-check matrix.

ALGORITHM
1.
2.
3.
4.
5.
6.

Initialize code length n and msg vector length k


Specify the k bit msg vectors to be transmitted and the generator matrix of order k*n
Encode the message in linear format to get n bit code vector
Add a random noise to code vector
Decode the noisy code at receiver
The message vectors have to be received, displayed and those which are corrupted with
noise has to be specified.

PROGRAM
clc;
clear all;
close all;
n=6,k=4
msg=[1 1 0 0;1 1 1 1 ;0 1 1 0]
% input message
genmat=[1 0 0 0 1 0;0 1 0 0 1 1 ;0 0 1 0 0 1;0 0 0 1 0 0]
code=encode(msg,n,k,'linear',genmat)
noisycode1=rem(code+randerr(3,6,[0 1]),4)
noisycode=sign(noisycode1);
[newmsg, err]=decode(noisycode,n,k,'linear',genmat)
err_word = find(err~=0)

% generator matrix

OUTPUT
n=

k=

msg =
1
1
0

1
1
1

0
1
1

0
1
0

0
1
0
0

0
0
1
0

0
0
0
1

1
1
0
0

0
1
1
0

1
1
1

0
1
1

0
1
0

0
0
1

1
0
0

0
1
1

0
1
0

0
0
1

1
1
0

0
0
1

0
1
0

genmat =
1
0
0
0
code =
1
1
0

noisycode1 =
1
1
0

1
1
1

newmsg =
1
1
0

1
1
1

err =
0
1
0

err_word =
2
10

RESULT

11

12

EX.O: 3

CYCLIC CODES
Date:

AIM
To generate a cyclic block code for transmission and to detect the errors in the received
message

APPARATUS USED/TOOLS RERQUIRED


MATLAB 2009 Software

THEORY
Block coding is a special case of error-control coding. Block coding techniques map a
fixed number of message symbols to a fixed number of code symbols. A block coder treats each
block of data independently and is a memory less device.
Cyclic codes are subset of linear block codes with additional property that every cyclic
shift of a codeword is also a codeword. If X={X1,X2,.Xn)is a codeword ,then the shifted
version is X=[Xn,X1,..,X(n-1) ) is also a codeword..They have algebraic properties that allow
a polynomial to determine the coding process completely. This so-called generator polynomial is
a degree-(n-k) divisor of the polynomial xn-1.
The cyclpoly function produces generator polynomials for cyclic codes. Cyclpoly
represents a generator polynomial using a row vector that lists the polynomial's coefficients in
order of ascending powers of the variable.
Cyclic codes are usually easier to encode and decode than all other linear block codes.
The encoding operation is performed using shift registers, and decoding is more practical due to
the algebraic structure.

ALGORITHM:
1.
2.
3.
4.
5.
6.
7.

Initialize cyclic code length n and msg vector length k


Generate generator polynomial from a cyclic code of length n and msg length k.
Specify the k bit msg vectors to be transmitted
Encode the message in cyclic format to get n bit code vector
Add a random noise to code vector
Decode the noisy code at receiver
The message vectors have to be received, displayed and those which are corrupted with
noise need to be specified.

13

OUTPUT
n=7
k=3
genpoly =
1

msg =

code =

noise =

noisycode =
0

rxmsg =
1

0
14

PROGRAM
clc;
clear all;
close all;
n=7;
k=3;
genpoly = cyclpoly(7,3)
% generator polynomial
msg=[1 1 0 ;1 1 1 ;0 1 0]
% input message
code = encode(msg,n,k,'cyclic',genpoly)
noise=randerr(3,n,[0,2])
% 3rows n columns of noise matrix
noisycode=xor(code,noise) % noise addition
[rxmsg,nerr] = decode(noisycode,n,k,'cyclic',genpoly)
chk=isequal(noisycode,code);
if chk==1
display ('no error in codes');
else
display('ther is error in code');
end
err_codes = find(nerr~=0)

15

nerr =
2
0
2
There is error in code
err_codes =
1
3

16

RESULT

17

18

EX.O: 4

A-LAW COMPADER

Date:

AIM
To implement A-law compressor and expander for source coding.

APPARATUS USED/TOOLS RERQUIRED


MATLAB 2009 Software

THEORY
A simple logarithm-based function is used by international standard (ITU) to encode
digitized audio samples for ISDN digital telephony services by means of non linear quantization.
The A-law encoder inputs 13 bit samples and outputs 8-bit codeword.
The formula for a-law compressor is
Y=sgn(x) A

/ (1+logA)

Y=sgn(x) V (1+log (A

for 0=

=V/A;

/V))/ (1+logA) for V/A=

=V;

The formula for the A-law expander is


Y= (1+logA)/A for 0=
X= (V/A) sgn(Y) (e^

=V/ (1+logA);
(1+logA)/V)-1 for V/ (1+log A) =

=V;

Where,
A is the A-law parameter v is the peak signal magnitude for x.
Sgn is the signum function. The commonly used A value is 87.6.

19

OUTPUT
given signal
100
50
0

10

20

30

40

50

60

70

80

90

60

70

80

90

60

70

80

90

compressed signal
100
0
-100

10

20

30

40

50

expanded signal
5
0
-5

10

20

30

40

50

20

ALGORITHM
1.
2.
3.
4.
5.
6.
7.
8.

Set the constant value for A-law=87.6.


Define input signal.
Define required range for signal.
Plot the input signal.
Compress the signal using the formula.
Plot the compressed image.
Expand the compressed signal using the formula.
Plot the reconstructed signal.

PROGRAM
close all; clear all;
A=87.6;
x=exp(-4:0.1:4);
subplot(3,1,1);
plot(x);
title('given signal');
b=abs(x);
v=max(x);
for b=0:(v/A)
y=sign(x).*(A*abs(x))/(1+log(A));
subplot(3,1,2);
plot(y);
title('compressed signal');
end
for b=(v/A):v
y=sign(x).*(v*(1+log(A*abs(x)/v)))/(1+log(A));
subplot(3,1,2);
plot(y);
title('compressed signal');
end
%A-law Expander
c=abs(y);
for c=0:(v/(1+log(A)))
newx=y*(1+log(A))/A;
subplot(3,1,3);
plot(newx);
title('expanded signal');
end
for c=(v/(1+log(A))):v
newx=sign(y).*exp(abs(y)*(1+log(A))/v-1)*v/A;
subplot(3,1,3); title('expanded signal');
end
21

22

RESULT

23

24

EX.O: 5

-LAW COMPADER

Date:

AIM
To implement -law compressor and expander for source coding.

APPARATUS USED/TOOLS RERQUIRED


MATLAB 2009 Software

FORMULAE USED
The formula for -law compressor is
Y=sgn(x) V log (1+

/V)/ (log +1)

The formula for the -law expander is


X= (V/ ) sgn(Y) (e^

(log +1)/V-1.

THEORY
A simple logarithm-based function is used by international standard (ITU) to encode
digitized audio samples for ISDN digital telephony services by means of non linear quantization.
The -law encoder inputs 13 bit samples and outputs 8-bit codeword.
The formula for -law compressor is
Y=sgn(x) V log (1+

/V)/ (log +1)

The formula for the -law expander is


X= (V/ ) sgn(Y) (e^

(log +1)/V-1 Where, is the -law parameter, V is the peak signal

magnitude for x. Sgn is the signum function. The commonly used value is 255.

ALGORITHM
1.
2.
3.
4.
5.

Set the constant value for -law=255.


Define input signal.
Define required range for signal.
Plot the input signal.
Compress the signal using the formula.
25

OUTPUT

26

6. Plot the compressed image.


7. Expand the compressed signal using the formula.
8. Plot the reconstructed signal.

PROGRAM
%Mu-law compressor
close all;
clear all;
mu=255;
x=exp(-4:0.1:4);%given signal
subplot(3,1,1);
plot(x);
title('given signal');
v=max(x);
y=sign(x).*(v*log(1+mu*abs(x)/v)/log(1+mu));
subplot(3,1,2);
plot(y);
title('compressed signal');
%Mu-law Expander
newx=sign(y).*((exp(abs(y)*log(1+mu)/v)-1)*v/mu);
subplot(3,1,3);
plot (newx);
title('expanded signal');

27

28

RESULT

29

30

EX.O: 6

M-ary PHASE SHIFT KEYIG

Date:
AIM
To obtain bit error performance curve for M-ary PSK for various values of M.

APPARATUS USED/TOOLS REQUIRED


MATLAB 2009 software

THEORY
Phase Shift Keying (PSK) is a method of digital communication in which the phase of a
transmitted signal is varied to convey information. In M-ary or multiple Phase Shift Keying
(MPSK), there are more than two phases, usually four (0,+90,-90 and 180 degrees) or eight
(0,+45,-45,+90,-90,+135 and 180 degrees) . If there are four phases (m=4), the MPSK mode is
called Quadrature Phase-Shift Keying.
Multi-level modulation techniques permit high data rates within fixed bandwidth
constraints. A convenient set of signals for M-ary PSK is,
i(t)

=A

i=0,

ct+ i)

0<t Ts

,2(M-1) /M
,

M number of Phase Angles.


The symbol duration Ts , so the information rate Tb satisfies,
Ts =Tblog2M
The potential bandwidth efficiency of M-ary PSK can be shown to be,
b

= log2 M bps/Hz.

ALGORITHM
1.
2.
3.
4.

Start
Initialize various values of M for which error performance has to be plotted.
Define the range of SNR required in performance curve.
Initialize an array variable err with zeros to store BER of corresponding SNR.
a) In a loop for each values of M, proceed till the end of step 5
b) In a loop for each values of SNR proceed till end of step of step 5
31

OUTPUT

32

c) Initialize a random input to x.


d) PSK modulate the random input data
e) Pass the modulated signal through Gaussian noise channel.
f) Demodulate the received signal.
g) Calculate BER for each SNR and arr
5. Plot the graph with SNR along X axis and BER along y axis.
6. End

PROGRAM
clc;
clear all;
close all;
M=[4 8 16];
snr=-25:25;
err=zeros(1,length(snr));
for i=1:3
for j=1:length(snr)
x=randsrc(1,20000,[0,M(i)-1]);
msg_tx=pskmod(x,M(i));
msg_nois = awgn(msg_tx,snr(j),...
'measured');
msg_rx=pskdemod(msg_nois,M(i));
display(msg_rx);
[num,BER]=biterr(x,msg_rx);
err(i,j)=BER;
end
end
semilogy(snr(1,:),err(1,:),'r',snr(1,:),err(2,:),'k',snr(1,:),err(3,:),'b');
xlabel('snr');
ylabel('BER');

33

34

RESULT

35

36

EX.O: 7

M-ary FREQUECY SHIFT KEYIG


Date:
AIM
To obtain bit error performance curve for M-ary FSK for various values of M.

APPARATUS USED/TOOLS REQUIRED


MATLAB 2009 software

THEORY
In Binary Frequency-Shift Keying (BFSK) carrier is shifted between two frequencies. A
convenient way of trading bandwidth for signaling speed is to increase the spread between the
lowest and highest frequency (increasing the bandwidth) but to increase the signaling speed by
extending the number of frequencies to a number M. Such a system is called an M-ary
frequency shift keying system.
The transmitted signals are defined by,

Si(t) =

min =1/2T

cos 2 [fo + (i-1)

]t

0 t T , i=1,2,.,M

is the minimum frequency spacing such that adjacent signals are orthogonal.

ALGORITHM
1.
2.
3.
4.

Start
Initialize various values of M for which error performance has to be plotted.
Define the range of SNR required in performance curve.
Initialize an array variable err with zeros to store BER of corresponding SNR.
a) In a loop for each values of M, proceed till the end of step 5
b) In a loop for each values of SNR proceed till end of step of step 5
c) Initialize a random input to x.
d) FSK modulate the random input data
e) Pass the modulated signal through Gaussian noise channel.
f) Demodulate the received signal.
g) Calculate BER for each SNR and arr
5. Plot the graph with SNR along X axis and BER along y axis.
6. End
37

OUTPUT

38

PROGRAM
clc;
close all;
clear all;
m=[4 8 16]
fs=64
freqsep=4;
nsamp=8;
snr=-25:25;
err=zeros(1,length(snr));
for i=1:3
for j=1:length(snr)
x=randsrc(1,20000,[0,m(i)-1]);
msg_tx=fskmod(x,m(i),freqsep,nsamp,fs);
msg_noise=awgn(msg_tx,snr(j),'measured');
msg_rx=fskdemod(msg_noise,m(i),freqsep,nsamp,fs);
[num,BER]=biterr(x,msg_rx);
err(i,j)=BER;
end
end

39

40

RESULT

41

42

EX.O: 8

M-ary QUADRATURE AMPLITUDE


MODULATIO

Date:
AIM

To obtain bit error performance curve for M-ary QAM for various values of M.

APPARATUS USED/TOOLS REQUIRED


MATLAB 2009 software

THEORY
By allowing the amplitude to vary along with the phase, a new modulation scheme called
Quadrature Amplitude Modulation (QAM) is obtained. The general form of an M-ary QAM
signal can be defined as,

Si(t) =

ai cos(2

ct)

bi sin(2

ct)

0 t T, i=1, 2,., M
Where,
Emin is the energy of the signal with lowest amplitude, ai and bi are integers chosen
according to the location of the particular signal point.

M-ary QAM does not have constant energy per symbol; nor does it have constant
distance between possible symbol states.
The power spectrum and bandwidth efficiency of QAM modulation is identical to M-ary
PSK Modulation. But in terms of power efficiency, QAM is superior to M-ary PSK.

ALGORITHM
1.
2.
3.
4.

Start
Initialize various values of M for which error performance has to be plotted.
Define the range of SNR required in performance curve.
Initialize an array variable err with zeros to store BER of corresponding SNR.
a) In a loop for each values of M, proceed till the end of step 5
b) In a loop for each values of SNR proceed till end of step of step 5
c) Initialize a random input to x.
43

d) QAM modulate the random input data


e) Pass the modulated signal through Gaussian noise channel.
f) Demodulate the received signal.

OUTPUT

44

g) Calculate BER for each SNR and arr


5. Plot the graph with SNR along X axis and BER along y axis.
6. End

PROGRAM
clc;
clear all;
close all;
M=[4 8 16];
snr=-25:25;
err=zeros(1,length(snr));
for i=1:3
for j=1:length(snr)
x=randsrc(1,20000,[0,M(i)-1]);
msg_tx=qammod(x,M(i));
msg_nois = awgn(msg_tx,snr(j),'measured');
msg_rx=qamdemod(msg_nois,M(i));
display(msg_rx);
[num,BER]=biterr(x,msg_rx);
err(i,j)=BER;
end
end
semilogy(snr(1,:),err(1,:),'r',snr(1,:),err(2,:),'k',snr(1,:),err(3,:),'b');
xlabel('snr');
ylabel('BER');

45

46

RESULT

47

48

EX.O: 9

ATEA RADIATIO PATTER


Date:
AIM
To plot the radiation pattern and find out the gain of a waveguide antenna.

COMPOETS REQUIRED
1.
2.
3.
4.
5.
6.

Microwave source(Klystron) with power supply


Frequency meter
Isolator
Variable attenuator
Detector mount antenna
SWR meter and accessories

THEORY
If a transmission line propagating energy is left open at one end, there will be radiation
from this end. In case of a rectangular wave-guide, this presents a mismatch of about 2:1 and it
radiates in many directions. The match will improve if the open wave-guide is a horn-shape.
The radiation pattern of an antenna is a diagram of field strength or more often the power
intensity as a function of the aspect angle at a constant distance from the radiating antenna. An
antenna pattern is of course three dimensional but for practical reasons, it is normally presented
as a two dimensional pattern in one or several planes. An antenna pattern consists of several
lobes, the main lobe, side lobes and the back lobe. The major power is concentrated in the main
lobe and it is required to keep the power in the side lobes and the back lobe as low as possible.
The power intensity at the maximum of the main lobe compared to the power intensity achieved
from an imaginary Omni-directional antenna (radiating equally in all directions) with the same
power fed to the antenna is defined as gain of the antenna.
3dB BEAM WIDTH:
This is the angle between the two points on a main lobe where the power intensity is half
the maximum power intensity.
When measuring an antenna pattern, it is normally most interesting to plot the pattern far
from the antenna.
Far field pattern is achieved at a minimum distance of
2D2/0(for rectangular horn antenna)
Where, D is the size of the broad wall of horn aperture, 0 is the free space wavelength.
49

SETUP FOR THE ATEA RADIATIO PATTER PLOTTIG

VARAIBLE
ATTENUATOR
POWER
SUPPLY

MICROWAVE
SOURCE

ISOLATOR

FREQUENCY
METER

DETECTOR
MOUNT

SWR
METER

CRO

TABULATIO

50

PROCEDURE
ATEA RADIATIO PATTER PLOTTIG:
1. Set up the equipments as shown in the figure, keeping the axis of both antennas in same
axis line & for start connect the horn antennas at both the ends.
2. Energize the microwave source for maximum output at desired frequency with square
wave modulation by tuning square wave amplitude and frequency of modulating signal
of Klystron Power Supply and by tuning the detector.
3. Obtain maximum reading (0 dB) at any convenient range switch position of the SWR
meter by gain control knob of SWR meter or by variable attenuator.
4. Rotate the receiving horn in 2 or 5steps and note the corresponding dB reading. When
necessary change the range switches to next higher range and add 10dB to the observed
value.
5. Draw a radiation pattern.
6. Now replace the antenna by another given antenna at receiver position.
7. From polar plot, determine the 3dB beam width of the horn antenna.

51

CALCULATIO:

52

RESULT

53

54

EX.O: 10
Date:

ORTHOGOAL FREQUECY DIVISIO


MULTIPLEXIG

AIM
To stimulate the MATLAB program for construction of the OFDM signal.

SOFTWARE REQUIREMETS
MATLAB 2009 Software

THEORY
OFDM belongs to a family of transmission schemes called multicarrier modulation, which
is based on the idea of dividing a given high-bit-rate data stream into several parallel lower bitrate streams and modulating each stream on separate carriers-often called subcarriers, or tones.
Orthogonal frequency-division multiplexing (OFDM) is a method of encoding digital data
on multiple carrier frequencies. OFDM has developed into a popular scheme for wideband
digital communication.

ALGORITHM
1. Start
2. Assign QPSK signal constellation, m as 4, data points as 64 and OFDM block size as 8.
3. In the Transmitter Side,
a) Obtain the data source using m and data points.
b) Perform QPSK Modulation on the data source.
c) Reshape the modulated data into matrix form.
d) Perform IFFT on the obtained data matrix.
e) For each value of i from 1 to cp_length, append the cyclic prefix.
f) Reconvert the appended matrix to data signal.
g) Combine the Noise with the data signal and transmit it to the receiver/destination.
4. In the Receiver Side,
a) Filter the received OFDM signal.
b) Reconstruct the processed signal into matrix form.
c) Remove the appended cyclic prefix.
d) Perform FFT on the obtained matrix.
e) Reshape the matrix into signal form.
f) Perform the PSK demodulation on the reconstructed signal and retrieve the original
message.
5. Stop
55

BLOCK DIAGRAM

RF TX

Binary

Coding

Interleaving

QPSK
mapping

serial to
Parallel

Pilot
insertion

DAC

parallel
to serial

Input

IFFT (TX)

Add cyclic
extension and
windowing

FFT (RX)
Binary

Decoding

Deinterleaving

QPSK
demapping

Channel
correction

parallel
to serial

serial to
Parallel

Remove cyclic
extension
Frequency
corrected
Symbol timing
signal

output

RF RX

56

ADC

Timing and
frequency
synchronization

PROGRAM
clear all;
clc;
close all;
M = 4;
% QPSK signal constellation
no_of_data_points = 64;
% have 64 data points
block_size = 8;
% size of each ofdm block
cp_len = ceil(0.1*block_size); % length of cyclic prefix
no_of_ifft_points = block_size;
% 8 points for the FFT/IFFT
no_of_fft_points = block_size;
% TRANSMITTER +++++
data_source = randsrc(1, no_of_data_points, 0:M-1);
figure(1)
stem(data_source); grid on; xlabel('Data Points'); ylabel('Amplitude')
title('Transmitted Data "O"')
% 2. Perform QPSK modulation
qpsk_modulated_data = pskmod(data_source, M);
scatterplot(qpsk_modulated_data);title('MODULATED TRANSMITTED DATA');
num_cols=length(qpsk_modulated_data)/block_size;
data_matrix = reshape(qpsk_modulated_data, block_size, num_cols);
% Second: Create empty matix to put the IFFT'd data
cp_start = block_size-cp_len;
cp_end = block_size;
% Third: Operate columnwise & do CP
for i=1:num_cols,
ifft_data_matrix(:,i) = ifft((data_matrix(:,i)),no_of_ifft_points);
% Compute and append Cyclic Prefix
for j=1:cp_len,
actual_cp(j,i) = ifft_data_matrix(j+cp_start,i);
end
% Append the CP to the existing block to create the actual OFDM block
ifft_data(:,i) = vertcat(actual_cp(:,i),ifft_data_matrix(:,i));
end
% 4. Convert to serial stream for transmission
[rows_ifft_data cols_ifft_data]=size(ifft_data);
len_ofdm_data = rows_ifft_data*cols_ifft_data;

57

OUTPUT

58

% Actual OFDM signal to be transmitted


ofdm_signal = reshape(ifft_data, 1, len_ofdm_data);
figure(3)
plot(real(ofdm_signal)); xlabel('Time'); ylabel('Amplitude');
title('OFDM Signal');grid on;
% C: HPA +++++
% 1. Generate random complex noise
noise = randn(1,len_ofdm_data) + sqrt(-1)*randn(1,len_ofdm_data);
% 2. Transmitted OFDM signal after passing through HPA
avg=0.4;
for i=1:length(ofdm_signal)
if ofdm_signal(i) > avg
ofdm_signal(i) = ofdm_signal(i)+noise(i);
end
if ofdm_signal(i) < -avg
ofdm_signal(i) = ofdm_signal(i)+noise(i);
end
end
figure(4)
plot(real(ofdm_signal)); xlabel('Time'); ylabel('Amplitude');
title('OFDM Signal after HPA');grid on;
% D: CHANNEL
channel = randn(1,block_size) + sqrt(-1)*randn(1,block_size);
% E: RECEIVER +++++
% 1. Pass the ofdm signal through the channel
after_channel = filter(channel, 1, ofdm_signal);
% 2. Add Noise
awgn_noise = awgn(zeros(1,length(after_channel)),0);
% 3. Add noise to signal...
recvd_signal = awgn_noise+after_channel;
% 4. Convert Data back to "parallel" form to perform FFT
recvd_signal_matrix = reshape(recvd_signal,rows_ifft_data, cols_ifft_data);
% 5. Remove CP
recvd_signal_matrix(1:cp_len,:)=[];
% 6. Perform FFT
for i=1:cols_ifft_data,
% FFT
fft_data_matrix(:,i) = fft(recvd_signal_matrix(:,i),no_of_fft_points);
end
% 7. Convert to serial stream
recvd_serial_data = reshape(fft_data_matrix, 1,(block_size*num_cols));
scatterplot(recvd_serial_data);title('MODULATED RECEIVED DATA');

59

60

% 8. Demodulate the data


qpsk_demodulated_data = pskdemod(recvd_serial_data,M);
scatterplot(recvd_serial_data);title('MODULATED RECEIVED DATA');
figure(5)
stem(qpsk_demodulated_data,'rx');
grid on;xlabel('Data Points');ylabel('Amplitude');title('Received Data "X"')

61

62

RESULT

63

64

EX.O: 11
Date:

AALOG DATA TRASMISSIO THROUGH FIBER


OPTIC LIK

AIM
To setup fiber optic analog link and to study the relationship between the input signal
and received signal.

COMPOETS REQUIRED
1.
2.
3.
4.

Fiber optic trainer kit


Fiber optic cable
Probe
CRO

THEORY
Fiber optic links can be used for transmission of digital as well as analog signals.
Basically a fiber optic link contains three elements, a transmitter, an optical fiber and a receiver.
The transmitter module takes the input signal in electric form and then transforms it into optical
energy containing the same information. The optical fiber is the medium which takes the energy
to the receiver. At the receiver, light is coming back into electrical form with the same pattern as
originally fed to the transmitter.
TRASMITTER
Fiber optic transmitters are typically composed of a buffer, driver and optical source. The
buffer provides both an electrical connection and isolation between the transmitter & the
electrical system supplying the data. The driver provides electrical power to the optical source.
Finally, the optical source converts the electrical current to the light energy with the same
pattern. Commonly used optical source are light emitting diodes (LEDs) and beam. Simple LED
circuits, for digital and analog transmissions are shown below.
Figure shows transconductance drive circuits for analog transmission-common emitter
configuration. The transmitter section comprises of:
1. Function generator
2. Frequency modulator &
3. Pulse Width Modulator block.
65

BLOCK DIAGRAM OF FIBER OPTIC AALOG LIK

Fiber optic cable

AC
Amplifier
Circuit

Function
generator
Emitter circuit

Detector circuit

TABULATIO:-

S. o

Wave form

Transmitter/receiver

Analog

Transmitted data

Analog

Received data

66

Amplitude (V)

The function generator generates the input signals that are going to be used as
information to transmit through the fiber optic link. The output voltage available is 1 KHz
sinusoidal signal of adjustable amplitude and fixed amplitude 1 KHz square wave signal. The
modulator section accepts the information signal and converts it into suitable form for
transmission through the fiber optic link.
THE FIBER OPTIC LIK
The emitter and detector circuit on board form the fiber optic link. This section provides
the light source for the optic fiber and the light detector at the far field of the fiber optic links.
The optic fiber plugs into the connectors provided in this part of the board.
THE RECEIVER:
The comparator circuit, low pass filter, phase locked loop, AC amplifier circuits form
receiver on the board. It is able to undo the modulation process in order to recover the original
information signal. In this experiment, the trainer board is used to illustrate one way
communication between digital transmitter and receiver circuits.

PROCEDURE
1. Connect the power supply to the board.
2. Ensure that all switched faults are OFF.
3. Make the following connections:
a) Connect the 1 KHz sine wave output to emitter 1s input.
b) Connect the fiber optics cable between emitter output and detectors input.
c) Detector 1s output to amplifier 1 input.
4. On the board, switch emitter 1s driver to analog mode.
5. Switch on the power.
6. Observe the input to emitter 1 with the output from AC amplifier 1 and note that the two
signals are same.

67

68

RESULT

69

70

EX.O: 12
Date:

DIGITAL DATA TRASMISSIO THROUGH FIBER


OPTIC LIK

AIM
To setup fiber optic digital link and to study the relationship between the input and received
signal.

COMPOETS REQUIRED
1.
2.
3.
4.

Fiber optic trainer kit


Fiber optic cable
Probe
CRO

PROCEDURE
1. Connect the power supply to the board.
2. Ensure that all switched faults are OFF.
3. Make the following connections:
a. Connect the 1 KHz square wave output to emitter 1s input.
b. Connect the fiber optic cable between emitter output and detectors input.
c. Detector 1s output to comparator 1s input.
d. Comparator 1s output to AC amplifier 1s input.
4. On the board, switch emitter 1s driver to digital mode.
5. Switch on the power.
6. Monitor both the inputs to comparator 1. Slowly adjust the comparators bias preset, until
DC level on the input lies midway between the high and low level of the signal on the
positive input.
7. Observe the input to emitter 1 with the output from AC amplifier 1 and note that the two
signals are same.

71

BLOCK DIAGRAM OF A FIBER OPTICAL DIGITAL LIK

Fiber optic cable


Function
generato
Emitter

Detector

Comparator
circuits

AC
Amplifier
Circuit

TABULATIO:-

S. o

Wave form

Transmitter/receiver

Digital

Transmitted data

Digital

Received data

72

Amplitude (V)

RESULT

73

74

Das könnte Ihnen auch gefallen