FIR ADAPTIVE FILTER USIG LEAST MEA SQUARE ALGORITHM
Transcript of FIR ADAPTIVE FILTER USIG LEAST MEA SQUARE ALGORITHM
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
1/74
1
EX.O: 1 FIR ADAPTIVE FILTER USIG LEAST MEA
SQUARE ALGORITHMDate:
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 stationaryprocesses, 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).
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
2/74
2
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
3/74
3
ALGORITHM
1. Generate the desired output signal and plot it.
2. Generate noise sequence and plot it.
3. Add the noise to the desired signal and to get the observed signal.
4.
Initialize the step size in such a way that the mean square error is minimized.5. 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)
forn=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');
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
4/74
OUTPUT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
5/74
RESULT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
6/74
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
7/74
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
8/74
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
9/74
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.
Initialize code length n and msg vector length k
2. Specify the k bit msg vectors to be transmitted and the generator matrix of order k*n
3. Encode the message in linear format to get n bit code vector
4. Add a random noise to code vector
5. Decode the noisy code at receiver
6. The message vectors have to be received, displayed and those which are corrupted withnoise has to be specified.
PROGRAM
clc;
clear all;
close all;
n=6,k=4msg=[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] % generator matrix
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)
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
10/74
10
OUTPUT
n = 6
k= 4
msg =
1 1 0 0
1 1 1 10 1 1 0
genmat =
1 0 0 0 1 0
0 1 0 0 1 1
0 0 1 0 0 10 0 0 1 0 0
code =
1 1 0 0 0 1
1 1 1 1 0 0
0 1 1 0 1 0
noisycode1 =
1 1 0 0 0 11 1 1 1 0 10 1 1 0 1 0
newmsg =
1 1 0 01 1 0 1
0 1 1 0
err =
01
0
err_word =
2
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
11/74
11
RESULT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
12/74
12
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
13/74
13
EX.O: 3CYCLIC 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 afixed 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-calledgenerator polynomialis
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 ascendingpowers 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.
Initialize cyclic code length n and msg vector length k2. Generate generator polynomial from a cyclic code of length n and msg length k.
3. Specify the k bit msg vectors to be transmitted4. Encode the message in cyclic format to get n bit code vector
5. Add a random noise to code vector
6. Decode the noisy code at receiver
7. The message vectors have to be received, displayed and those which are corrupted withnoise need to be specified.
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
14/74
1
OUTPUT
n=7
k=3
genpoly =
1 0 1 1 1
msg =
1 1 0
1 1 1
0 1 0
code =
0 1 0 1 1 1 0
0 0 1 0 1 1 1
1 1 1 0 0 1 0
noise =
0 0 0 1 0 1 0
0 0 0 0 0 0 0
0 0 1 0 1 0 0
noisycode =
0 1 0 0 1 0 0
0 0 1 0 1 1 1
1 1 0 0 1 1 0
rxmsg =
1 0 1
1 1 1
1 1 0
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
15/74
1
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)
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
16/74
1
nerr =
2
0
2
There is error in code
err_codes =
1
3
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
17/74
1
RESULT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
18/74
1
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
19/74
1
EX.O: 4A-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) for 0= =V/A;
Y=sgn(x) V (1+log (A /V))/ (1+logA) for V/A= =V;
The formula for the A-law expander is
Y= (1+logA)/A for 0= =V/ (1+logA);
X= (V/A) sgn(Y) (e^ (1+logA)/V)-1for 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.
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
20/74
20
OUTPUT
0 10 20 30 40 50 60 70 80 900
50
100
given signal
0 10 20 30 40 50 60 70 80 90-100
0
100compressed signal
0 10 20 30 40 50 60 70 80 90-5
0
5expanded signal
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
21/74
21
ALGORITHM
1. Set the constant value for A-law=87.6.
2. Define input signal.
3. Define required range for signal.
4.
Plot the input signal.5. Compress the signal using the formula.
6. Plot the compressed image.
7. Expand the compressed signal using the formula.
8. 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):vy=sign(x).*(v*(1+log(A*abs(x)/v)))/(1+log(A));
subplot(3,1,2);
plot(y);
title('compressed signal');
end
%A-law Expanderc=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
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
22/74
22
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
23/74
23
RESULT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
24/74
2
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
25/74
2
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-1Where,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. Set the constant value for -law=255.
2. Define input signal.
3. Define required range for signal.
4. Plot the input signal.
5. Compress the signal using the formula.
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
26/74
2
OUTPUT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
27/74
2
6. Plot the compressed image.
7. Expand the compressed signal using the formula.
8. Plot the reconstructed signal.
PROGRAM
%Mu-law compressorclose 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');
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
28/74
2
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
29/74
2
RESULT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
30/74
30
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
31/74
31
EX.O: 6M-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 ct+ i) 0
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
32/74
32
OUTPUT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
33/74
33
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
endsemilogy(snr(1,:),err(1,:),'r',snr(1,:),err(2,:),'k',snr(1,:),err(3,:),'b');
xlabel('snr');
ylabel('BER');
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
34/74
3
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
35/74
3
RESULT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
36/74
3
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
37/74
3
EX.O: 7M-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) = cos 2 [fo+ (i-1) ]t 0 t T , i=1,2,.,M
( min =1/2T is the minimum frequency spacing such that adjacent signals are orthogonal.
ALGORITHM
1. Start
2. Initialize various values of M for which error performance has to be plotted.3. Define the range of SNR required in performance curve.
4. 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 datae) 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
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
38/74
3
OUTPUT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
39/74
3
PROGRAM
clc;
close all;
clear all;
m=[4 8 16]fs=64
freqsep=4;
nsamp=8;
snr=-25:25;
err=zeros(1,length(snr));
fori=1:3forj=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
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
40/74
0
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
41/74
1
RESULT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
42/74
2
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
43/74
3
EX.O: 8M-ary QUADRATURE AMPLITUDE
MODULATIODate:
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) = aicos(2 ct) + bisin(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. Start
2. Initialize various values of M for which error performance has to be plotted.3. Define the range of SNR required in performance curve.4. 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.
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
44/74
d) QAM modulate the random input data
e) Pass the modulated signal through Gaussian noise channel.
f) Demodulate the received signal.
OUTPUT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
45/74
g) Calculate BER for each SNR and arr5.
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:3for 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
endsemilogy(snr(1,:),err(1,:),'r',snr(1,:),err(2,:),'k',snr(1,:),err(3,:),'b');
xlabel('snr');ylabel('BER');
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
46/74
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
47/74
RESULT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
48/74
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
49/74
EX.O: 9ATEA RADIATIO PATTER
Date:
AIM
To plot the radiation pattern and find out the gain of a waveguide antenna.
COMPOETS REQUIRED
1. Microwave source(Klystron) with power supply
2. Frequency meter
3. Isolator4. Variable attenuator5. Detector mount antenna
6.
SWR meter and accessoriesTHEORY
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, 0is the free space wavelength.
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
50/74
0
SETUP FOR THE ATEA RADIATIO PATTER PLOTTIG
TABULATIO
POWER
SUPPLY
MICROWAVE
SOURCE
ISOLATOR
VARAIBLE
ATTENUATOR
FREQUENCY
METER
DETECTOR
MOUNT
SWR
METER
CRO
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
51/74
1
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.
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
52/74
2
CALCULATIO:
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
53/74
3
RESULT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
54/74
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
55/74
EX.O: 10ORTHOGOAL FREQUECY DIVISIO
MULTIPLEXIGDate:
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 bit-
rate 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
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
56/74
BLOCK DIAGRAM
()
()
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
57/74
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/IFFTno_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 datacp_start = block_size-cp_len;
cp_end = block_size;
% Third: Operate columnwise & do CPfor 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 blockifft_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;
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
58/74
OUTPUT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
59/74
% 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 HPAavg=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) < -avgofdm_signal(i) = ofdm_signal(i)+noise(i);
end
endfigure(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 channelafter_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 FFTrecvd_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,% FFTfft_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');
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
60/74
0
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
61/74
1
% 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"')
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
62/74
2
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
63/74
3
RESULT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
64/74
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
65/74
EX.O: 11AALOG DATA TRASMISSIO THROUGH FIBER
OPTIC LIKDate:
AIM
To setup fiber optic analog link and to study the relationship between the input signal
and received signal.
COMPOETS REQUIRED
1. Fiber optic trainer kit
2. Fiber optic cable
3.
Probe
4. 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.
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
66/74
BLOCK DIAGRAM OF FIBER OPTIC AALOG LIK
TABULATIO:-
S. o Wave form Transmitter/receiver Amplitude (V)
1 Analog Transmitted data
2 Analog Received data
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
67/74
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 originalinformation 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.
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
68/74
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
69/74
RESULT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
70/74
0
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
71/74
1
EX.O: 12DIGITAL DATA TRASMISSIO THROUGH FIBER
OPTIC LIKDate:
AIM
To setup fiber optic digital link and to study the relationship between the input and received
signal.
COMPOETS REQUIRED
1. Fiber optic trainer kit2. Fiber optic cable3. Probe
4.
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, untilDC level on the input lies midway between the high and low level of the signal on thepositive input.
7. Observe the input to emitter 1 with the output from AC amplifier 1 and note that the two
signals are same.
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
72/74
2
BLOCK DIAGRAM OF A FIBER OPTICAL DIGITAL LIK
TABULATIO:-
S. o Wave form Transmitter/receiver Amplitude (V)
1 Digital Transmitted data
2 Digital Received data
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
73/74
3
RESULT
-
7/21/2019 FIR ADAPTIVE FILTER USI G LEAST MEA SQUARE ALGORITHM
74/74