Top Banner
EXP.NO: DATE: SIMULATION OF DCT BASED SPEECH/AUDIO COMPRESSION METHOD AIM: To simulate and analyze an audio signal compression using discrete cosine transform. EQUIPMENTS REQUIRED: 1. MATLAB 7.0.1 2. Personal Computer THEORY: Audio compression is removal of redundant or irrelevant information from the audio signal. Audio compression allows efficient storage and transmission of audio signal. Discrete cosine transform of an audio signal converts an audio block into its equivalent frequency coefficients. An audio sample is a sequence of real numbers X ={ x 1 ,… xN } . The dct of this audio sample is the sequence, DCT ( X )= Y ={ y 1 ,…, yN } such that Y 1
103
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS-II

EXP.NO:

DATE:

SIMULATION OF DCT BASED SPEECH/AUDIO

COMPRESSION METHOD

AIM:

To simulate and analyze an audio signal compression using discrete cosine transform.

EQUIPMENTS REQUIRED:

1. MATLAB 7.0.1

2. Personal Computer

THEORY:

Audio compression is removal of redundant or irrelevant information from the audio

signal. Audio compression allows efficient storage and transmission of audio signal. Discrete

cosine transform of an audio signal converts an audio block into its equivalent frequency

coefficients.

An audio sample is a sequence of real numbers X={x1,…xN}. The  dct of this

audio sample is the sequence, DCT(X)=Y={y1,…,yN} such that

Y

where

1

Page 2: CS-II

w(k) =

The compression scheme

The coefficients of the DCT are amplitudes of cosines that are “within” the original

single. Small coefficients will result in cosines with small amplitudes, which we are less

likely to hear. So instead of storing the original sample we could take the DCT of the sample,

discard small coefficients, and keep that. We would store fewer numbers and so compress the

audio data.

Filling in the details

When compressing with DCTs we typically compress small slices (windows) of the

audio at once. This is partly so that seeking through the compressed stream is easier but

mostly because we want the coefficients in our window to represent frequencies we hear

(with large window the majority of the coefficients would represent frequencies well out of

the human hearing range).

ALGORITHM:

Initialize the Matlab.

Read the audio signal as input for compression.

Initialize the compression matrices for compression factors 2,4 & 8.

Compress the audio files by taking discrete cosine transform.

Plot the original and compressed audio signals.

Plot the expanded view of original and compressed audio signals.

Plot the spectrogram of original and compressed audio signal

2

Page 3: CS-II

FLOW CHART:

3

Compress the audio signal using discrete cosine transform

START

STOP

Initialize the compression matrices

Read the input signal

Display the original and compressed audio signal

Page 4: CS-II

PROGRAM:

function[]=myDCT()

[funky,f]=wavread('F:\SS\funky.wav');

windowsize=8192;

sampleshalf=windowsize/2;

samplesquarter=windowsize/4;

sampleseighth= windowsize/8;

funkycompressed2=[];

funkycompressed4=[];

funkycompressed8=[];

for i=1:windowsize:length(funky)-windowsize

windowDCT=dct(funky(i:i+windowsize-1));

funkycompressed2(i:i+windowsize-

1)=idct(windowDCT(1:sampleshalf),windowsize);

funkycompressed4(i:i+windowsize-1)=idct(windowDCT(1:samplesquarter),

windowsize);

funkycompressed8(i:i+windowsize-1)=idct(windowDCT(1:sampleseighth),

windowsize);

end

figure(1);

h1=subplot(4,1,1);

plot(funky)

title('original waveform');

subplot(4,1,2);

4

Page 5: CS-II

plot(funkycompressed2)

title('compression factor 2'),axis(axis(h1));

subplot(4,1,3);

plot(funkycompressed4)

title('compression factor 4'),axis(axis(h1));

subplot(4,1,4);

plot(funkycompressed8)

title('compression factor 8'),axis(axis(h1));

%expanded view of audio signal

figure(2)

h1=subplot(4,1,1);plot(funky(100000:120000)),title('portion of original

waveform');

subplot(4,1,2)

plot(funkycompressed2(100000:120000)),title('portion of compression factor2');

subplot(4,1,3)

plot(funkycompressed4(100000:120000)),title('portion of compression factor4');

subplot(4,1,4)

plot(funkycompressed8(100000:120000)),title('portion of compression factor8');

%spectogram of audio signals

figure(3)

subplot(4,1,1)

specgram('funky'),title('original waveform');

subplot(4,1,2)

specgram(funkycompressed2),title('compressionfactor2');

subplot(4,1,3)

specgram(funkycompressed4),title('compressionfactor4');

subplot(4,1,4)

specgram(funkycompressed8),title('compressionfactor8');

%saving to wave files

wavwrite(funkycompressed2,'funky2')

wavwrite(funkycompressed4,'funky4')

wavwrite(funkycompressed8,'funky8')

%playing files

5

Page 6: CS-II

disp('original');

wavplay(funky,f);

disp('compression factor2');

wavplay(funkycompressed2,f);

disp('compression factor4');

wavplay(funkycompressed4,f);

disp('compression factor8');

wavplay(funkycompressed8,f);

OUTPUT:

0 0.5 1 1.5 2 2.5

x 104

-0.50

0.5Portion of Original Waveform

0 0.5 1 1.5 2 2.5

x 104

-0.50

0.5Portion of Compression Factor 2

0 0.5 1 1.5 2 2.5

x 104

-0.50

0.5Portion of Compression Factor 4

0 0.5 1 1.5 2 2.5

x 104

-0.50

0.5Portion of Compression Factor 8

6

Page 7: CS-II

0 0.5 1 1.5 2 2.5 3 3.5 4

x 105

-0.50

0.5Original Waveform

0 0.5 1 1.5 2 2.5 3 3.5 4

x 105

-0.50

0.5Compression Factor 2

0 0.5 1 1.5 2 2.5 3 3.5 4

x 105

-0.50

0.5Compression Factor 4

0 0.5 1 1.5 2 2.5 3 3.5 4

x 105

-0.50

0.5Compression Factor 8

Time

Fre

quen

cy

Original Waveform

2 4 6 8 10 12 14 16 18

x 104

00.5

1

Time

Fre

quen

cy

Compression Factor 2

2 4 6 8 10 12 14 16 18

x 104

00.5

1

Time

Fre

quen

cy

Compression Factor 4

2 4 6 8 10 12 14 16 18

x 104

00.5

1

Time

Fre

quen

cy

Compression Factor 8

2 4 6 8 10 12 14 16 18

x 104

00.5

1

7

Page 8: CS-II

RESULT:

Thus the given audio signal has been compressed using discrete cosine transform.

And its output was verified successfully.

EXP.NO:

DATE:

SIMULATION OF DWT BASED SPEECH /AUDIO

COMPRESSION METHOD

AIM:

To compress and provide substantial improvements in audio quality at higher compression ratios using Wavelet Transform.

APPARATUS REQUIRED:

1. MATLAB 7.0.1

2. Personal Computer

THEORY:

WAVELET COMPRESSION:

8

Page 9: CS-II

The wavelet transform has emerged as a cutting edge technology, Wavelet

compression is a form of data compression well suited for image compression (sometimes

also video compression and audio compression). Notable implementations are MPEG, MP1,

MP2 and MP3 for Audio signals. The goal of audio compression is to encode audio data to

take up less storage space and less bandwidth for transmission .Wavelet compression can be

either lossless or lossy.

Using a wavelet transform, the wavelet compression methods are adequate for

representing transients, such as percussion sounds in audio, or high-frequency components in

two-dimensional images, for example an image of stars on a night sky. This means that the

transient elements of a data signal can be represented by a smaller amount of information

than would be the case if some other transform, such as the more widespread discrete cosine

transform, had been used.

METHOD OF COMPRESSION:

In order to determine what information in an audio signal is perceptually irrelevant,

most lossy compression algorithms use transforms such as the (MDCT) to convert sampled

waveforms into a transform domain. Once transformed, typically into the, component

frequencies can be allocated bits according to how audible they are. Audibility of spectral

components is determined by first calculating a, below which it is estimated that sounds will be

beyond the limits of human perception.

ALGORITHM:

Initialize the Matlab

Read the input audio given for compression

Add the multiplicative noise to the audio signal

Transform the image using HAAR Transform

Get the decomposition level from the user

Compression ratio is calculated in percentage

The image is compressed using the ratio

Finalize by displaying the compressed audio

9

Page 10: CS-II

FLOW CHART:

10

Transform the Audio using Haar Transform

Get the decomposition level

Add multiplicative noise to the Audio

START

Initialize by reading input Audio file

Page 11: CS-II

PROGRAM:

clc;

clear all;

close all;

[y, Fs, nbits, readinfo] = wavread('C:\Documents and Settings\WELCOME\Desktop\

jjj.wav');

subplot(1,3,1);

plot(y);

n=input('enter the decomposition level');

[Lo_D,Hi_D,Lo_R,Hi_R]=wfilters('haar');

[c,s]=wavedec2(y,n,Lo_D,Hi_D);

disp('the decomposition level is');

[THR,NKEEP]=wdcbm2(c,s,1.5,3*prod(s(1)));

[compressed_image,TREED,comp_ratio,PERFL2]=wpdencmp(THR,'s',n,'haar','threshol

d',5,1);

disp('compression ratio in percentage');

disp(comp_ratio);

11

Calculate the compression ratio

STOP

Display compression ratio and compressed Audio

Page 12: CS-II

subplot(1,3,2);

plot(compressed_image);

re_im1=waverec2(c,s,'haar');

subplot(1,3,3);

plot(re_im1);

OUTPUT:

12

Page 13: CS-II

Enter the decomposition level: 5

Compression ratio in percentage is: 20

RESULT:

Thus the given Audio signal has been compressed using the Wavelet Transform

and its output was verified successfully.

EXP.NO:

DATE:

SIMULATION OF LPC BASED SPEECH /AUDIO

COMPRESSION METHOD

AIM:

To simulate and analyze an audio signal compression using linear predictive coding algorithm.

EQUIPMENTS REQUIRED:

1. MATLAB 7.0.1

2. Personal Computer

THEORY:

LPC:

13

Page 14: CS-II

Linear predictive coding (LPC) is a tool used mostly in audio signal processing and

speech processing for representing the spectral envelope of a digital signal of speech in

compressed form, using the information of a linear predictive model. It is one of the most

powerful analysis methods for encoding good quality speech at a low bit rate and provides

extremely accurate estimates of speech parameters. It expresses each sample of the signal as a

linear combination of previous samples. Such an equation is called a linear predictor, which

is called as Linear Predictive Coding. The coefficients of the difference equation characterize

the formants, so the LPC system needs to estimate these coefficients. The estimate is done by

minimizing the mean-square error between the predicted signal and the actual signal. It

involves the computation of a matrix of coefficient values and the solution of a set of linear

equations may be used to assure convergence to a unique solution with efficient computation.

ALGORITHM:

Initialize the Matlab.

Read the audio signal as input for compression.

Take transpose to the product of window signal and filtered input signal.

Computation of a matrix of coefficient vaules used for convergence.

Convergence of audio signal may also be obtained by set of linear

equations.

Plot the durbin algorithm for linear prediction coefficients.

Plot the predictor residual energy

14

Page 15: CS-II

FLOW CHART:

15

Express each sample as a linear combination of previous

Transpose the product of window and the filtered input signal

START

Initialize by reading input image

Page 16: CS-II

PROGRAM:

clc;

close all;

clear all;

[x,fs]=wavread('C:\Documents and Settings\WELCOME\desktop\123.wav');% read

into the data

% Preemphasis filter

xx=double(x);

y=filter([1 -0.9495],1,xx);

N=160;

y1=y(1:N);

w1=hamming(1,N);

y2=(y1.*w1)';

p=30;% predict the order of

r=zeros(1,p+1);

16

Estimation of coefficients by minimizing mean square error

STOP

Display original and compressed signal

Page 17: CS-II

for k=1:p+1

sum=0;

for m=1:N+1-k

sum=sum+y2(m).*y2(m-1+k)';

end

r(k)=sum;

end

k=zeros(1,p);

k(1)=r(2)/r(1);

a=zeros(p,p);

a(1,1)=k(1);

e=zeros(1,p);

e(1)=(1-k(1)^2)*r(1);

for i=2:p

c=zeros(1,i);

sum=0;

for j=1:i-1

sum=sum+(a(i-1,j).*r(i+1-j));

end

c(i)=sum;

k(i)=(r(i+1)-c(i))/e(i-1);

if find(abs(k)>1)

disp('default')

else

subplot(413);plot(abs(k));title('|k(i)|<=1')

end

a(i,i)=k(i);

for j=1:i-1

a(i,j)=a(i-1,j)-k(i).*a(i-1,i-j);

end

e(i)=(1-k(i)^2)*e(i-1);

subplot(414);plot(e);

title('predictor residual energy E(i)');

end

17

Page 18: CS-II

d=zeros(1,p);

for t=1:p

d(t)=a(p,t);

end

z=zeros(1,N);

for i=1:p

z(i)=y2(i);

end

figure(1);

subplot(411);

plot(y2);

title('Original Data');

subplot(412);

plot(z);

title('durbin algorithm for linear prediction coefficients');

OUTPUT:

18

Page 19: CS-II

0 5 10 15 20 25 300

0.2

0.4|k(i)|<=1

0 5 10 15 20 25 300.5

1

1.5x 10

-3 predictor residual energy E(i)

0 20 40 60 80 100 120 140 160-0.01

0

0.01Original Data

0 20 40 60 80 100 120 140 160-1

0

1durbin algorithm for linear prediction coefficients

RESULT:

Thus the compression of given audio signal using linear predictive coding was

simulated and its output has been plotted.

EXP.NO: SIMULATION OF SUBBAND BASED SPEECH/ AUDIO

19

Page 20: CS-II

DATE: COMPRESSION METHOD

AIM:

To simulate audio and speech compression algorithm of subband coding using MATLAB.

APPARATUS REQUIRED:

1. MATLAB 7.0.1

2. Personal computer

THEORY:

A popular approach to decomposing the image into different frequency bands without

the imposition of an arbitrary block structure is sub band coding. After the input has been

decomposed into its constituents, we can use the coding technique best suited to each

constituent to improve compression performance. Furthermore, each component of the source

output may have different perceptual characteristics. Quantization error that is perceptually

objectionable in one component may be acceptable in a different component of the source

output. Therefore, a coarser quantizer may be used for perceptually less important

components. This is how the concept of sub-band coding comes into picture

ALGORITHM:

Initialize the Matlab.

Read the audio file given for sub band coding.

Plot the signals of speech and filter in time domain.

Take Fourier transform for converting signals in time domain to frequency

domain.

Plot the signals of speech and filter in frequency domain.

Decimate the signals to get the four bands in synthesis.

Compare the original band with synthesized band.

FLOW CHART:

20

Page 21: CS-II

PROGRAM:

21

Decimate the signals to get the bands in synthesis

Compare the original band with synthesized band

Convert the signals to frequency domain.

START

STOP

Initialize by reading the audio files.

Display the output

waveforms

Page 22: CS-II

clc;

close all;

clear all;

num=36000;

[x,fs,nbits] = wavread(' sub1.wav',num);

x=x(:,1)';

lnx=length(x);

L = 2;

len = 25;

wc = 1/L; %cut-off frequency is pi/2.

freq=-pi:2*pi/(lnx-1):pi;% the frequency vector

lp = fir1(len-1, wc,'low');

hp = fir1(len-1, wc,'high');

yl=conv(x,lp);

yh=conv(x,hp);

%Time domain plots of signal and filters

figure(1);

subplot(311);

plot(x);axis([0 lnx min(x) max(x)]);ylabel('speech');

Title('Speech and filters in time domain');

subplot(312);

stem(lp);axis([0 length(lp) (min(lp)+0.1) (max(lp)+0.1)]);

ylabel('lp');

subplot(313);

stem(hp);axis([0 length(hp) min(hp)+0.1 max(hp)+0.1]);

ylabel('hp');

pause

%plotting filter response of filters and the two speech bands(lower and upper) in freq

domian

figure(2);

X=fftshift(fft(x,lnx));

Lp=fftshift(fft(lp,lnx));

Hp=fftshift(fft(hp,lnx));

YL=fftshift(fft(yl,lnx));

22

Page 23: CS-II

Yh=fftshift(fft(yh,lnx));

subplot(3,2,1);

plot(freq/pi, abs(X));

ylabel('|X|');

axis([0 pi/pi min(abs(X)) max(abs(X))]);

title('Freq domain representation of speech and the two bands');

subplot(3,2,3);

plot(freq/pi, abs(Lp),'g');

ylabel('|Lp|');

axis([0 pi/pi min(abs(Lp)) max(abs(Lp))]);

subplot(3,2,4);

plot(freq/pi, abs(Hp), 'g');

ylabel('|Hp|');

axis([0 pi/pi min(abs(Hp)) max(abs(Hp))]);

subplot(3,2,5);

plot(freq/pi, abs(YL), 'y');

ylabel('|YL|');

axis([0 pi/pi min(abs(YL)) max(abs(YL))]);

legend('Low bandafter filtering');

subplot(3,2,6);

plot(freq/pi, abs(Yh), 'y');

ylabel('|Yh|');

axis([0 pi/pi min(abs(Yh)) max(abs(Yh))]);

legend('High band after filtering');

pause

ydl =yl(1:2:length(yl));

ydh=yh(1:2:length(yh));

s0=conv(ydl,lp);

s1=conv(ydl,hp);

s2=conv(ydh,lp);

s3=conv(ydh,hp);

% now finally decimating to get the four bands

b0 =s0(1:2:length(s0));

b1=s1(1:2:length(s1));

23

Page 24: CS-II

b2 =s2(1:2:length(s2));

b3=s3(1:2:length(s3));

%freq plots of decimated signals(four bands)

figure(3);

title('Four bands in freq domain');

subplot(4,1,1);

plot(freq/pi,abs(fftshift(fft(b0,lnx))));

ylabel('|B0|');

axis([0 pi/pi min(abs(fft(b0))) max(abs(fft(b0)))]);

title('Four bands in freq domain');

subplot(4,1,2);

plot(freq/pi,abs(fftshift(fft(b1,lnx))));

ylabel('|B1|');

axis([0 pi/pi min(abs(fft(b0))) max(abs(fft(b1)))]);

subplot(4,1,3);

plot(freq/pi,abs(fftshift(fft(b2,lnx))));

ylabel('|B2|');

axis([0 pi/pi min(abs(fft(b2))) max(abs(fft(b2)))]);

subplot(4,1,4);

plot(freq/pi,abs(fftshift(fft(b3,lnx))));

ylabel('|B3|');

axis([0 pi/pi min(abs(fft(b3))) max(abs(fft(b3)))]);

pause;

% now synthesizing

L=2;

N1=length(b0);

Ss0=zeros(1,L*N1);

Ss1=zeros(1,L*N1);

Ss2=zeros(1,L*N1);

Ss3=zeros(1,L*N1);

Ss0(L:L:end)=b0;

Ss1(L:L:end)=b1;

Ss2(L:L:end)=b2;

Ss3(L:L:end)=b3;

24

Page 25: CS-II

%Passing through reconstruction filters

% making a low pass filter with cutoff at 1/L and gain L

reconst_fil=L*fir1(len-1,1/L);

% finding the freq response of the filter

sb0=conv(reconst_fil,Ss0);

sb1=conv(reconst_fil,Ss1);

sb2=conv(reconst_fil,Ss2);

sb3=conv(reconst_fil,Ss3);

Slow=sb0-sb1;

Shigh=sb2-sb3;

subl=zeros(1,length(Slow)*2);

subh=zeros(1,length(Shigh)*2);

subl(L:L:end)=Slow;

subh(L:L:end)=Shigh;

subll=conv(reconst_fil,subl);

subhh=conv(reconst_fil,subh);

sub=subll-subhh;

%Freq plots of final two bands and their merging into a single band

figure(4);

subplot(3,1,1);

plot(freq/pi,abs(fftshift(fft(subll,lnx))));

ylabel('|low band|');

axis([0 pi/pi min(abs(fft(subll))) max(abs(fft(subll)))]);

title('Final two bands in synthesis');

subplot(3,1,2);

plot(freq/pi,abs(fftshift(fft(subhh,lnx))));

ylabel('|High band|');

axis([0 pi/pi min(abs(fft(subhh))) max(abs(fft(subhh)))]);

subplot(3,1,3);

plot(freq/pi,abs(fftshift(fft(sub,lnx))));

ylabel('|Band|');

axis([0 pi/pi min(abs(fft(sub))) max(abs(fft(sub)))]);

pause

25

Page 26: CS-II

%Comparison

figure(5);

subplot(2,1,1);

plot(freq/pi, abs(X));

ylabel('|X|');

axis([0 pi/pi min(abs(X)) max(abs(X))]);

title('Comparison');

legend('original band');

subplot(2,1,2);

plot(freq/pi,abs(fftshift(fft(sub,lnx))),'r');

ylabel('|Band|');

axis([0 pi/pi min(abs(fft(sub))) max(abs(fft(sub)))]);

legend('Synthesized Band');

OUTPUT:

FIGURE 1:

26

Page 27: CS-II

FIGURE2:

FIGURE 3:

27

Page 28: CS-II

FIGURE 4:

FIGURE 5:

28

Page 29: CS-II

RESULT:

Thus audio and speech compression algorithm of subband coding using MATLAB

was simulated.

29

Page 30: CS-II

EXP.NO:

DATE:

SIMULATION OF EZW IMAGE COMPRESSION

ALGORITHM

AIM:

To compress an image using simulate EZW image coding algorithm.

APPARATUS REQUIRED:

1. MATLAB 7.0.1

2. Personal Computer

THEORY:

EZW Algorithm:

Embedded Zerotrees of Wavelet Transforms is a lossy compression algorithm . At low bit

rates i.e. high compression ratios most of the coefficients produced by a such as the will be

zero, or very close to zero. This occurs because "real world" images tend to contain mostly

low frequency information

By considering the transformed coefficients as a with the lowest frequency coefficients at

the root node and with the children of each tree node being the spatially related coefficients in

the next higher frequency subband, there is a high probability that one or more subtrees will

consist entirely of coefficients which are zero or nearly zero, such subtrees are called

zerotrees. Due to this, we use the terms node and coefficient interchangeably, and when we

refer to the children of a coefficient, we mean the child coefficients of the node in the tree

where that coefficient is located. We use children to refer to directly connected nodes lower

in the tree and descendants to refer to all nodes which are below a particular node in the tree,

even if not directly connected.

In zerotree based image compression scheme such as EZW and, the intent is to use the

statistical properties of the trees in order to efficiently code the locations of the significant

coefficients. Since most of the coefficients will be zero or close to zero, the spatial locations

of the significant coefficients make up a large portion of the total size of a typical compressed

30

Page 31: CS-II

image. A coefficient is considered significant if its magnitude is above a particular threshold.

By starting with a threshold which is close to the maximum coefficient magnitudes and

iteratively decreasing the threshold, it is possible to create a compressed representation of an

image which progressively adds finer detail. Due to the structure of the trees, it is very likely

that if a coefficient in a particular frequency band is insignificant, then all its descendants will

also be insignificant.

ALGORITHM:

Initialize the Matlab

Read the input image given for compression

Specify the maximum number of steps for the compression algorithm.

Compress the image using EZW algorithm.

Uncompress the compressed image.

Finalize by plotting the compressed and uncompressed image

FLOW CHART:

31

Page 32: CS-II

PROGRAM:

32

Compress the image using EZW algorithm

Uncompress the compressed image.

Specify the number of input levels for compression

START

STOP

Initialize by reading input

image

Display original image and compressed image

Page 33: CS-II

clc;

clear all;

close all;

X = imread('wpeppers.jpg');

image(X)

axis square

colormap(pink(255))

title('Original Image: peppers')

meth = 'gbl_mmc_h'; % Method name

option = 'c'; % 'c' stands for compression

[CR,BPP] = wcompress(option,X,'peppers.wtc',meth,'BPP',0.5);

option = 'u'; % 'u' stands for uncompression

Xc = wcompress(option,'peppers.wtc');

colormap(pink(255))

figure(1)

subplot(1,2,1); image(X);

axis square;

title('Original Image')

subplot(1,2,2); image(Xc);

axis square;

title('Compressed Image')

xlabel({['Compression Ratio: ' num2str(CR,'%1.2f %%')], ...

['BPP: ' num2str(BPP,'%3.2f')]})

meth = 'ezw'; % Method name

wname = 'haar'; % Wavelet name

nbloop = 6; % Number of loops

[CR,BPP] = wcompress('c',X,'peppers.wtc',meth,'maxloop', nbloop, ...

'wname','haar');

Xc = wcompress('u','peppers.wtc');

colormap(pink(255))

figure(2)

subplot(1,2,1); image(X);

axis square;

title('Original Image')

33

Page 34: CS-II

subplot(1,2,2); image(Xc);

axis square;

title('Compressed Image - 6 steps')

xlabel({['Compression Ratio: ' num2str(CR,'%1.2f %%')], ...

['BPP: ' num2str(BPP,'%3.2f')]})

[CR,BPP] = wcompress('c',X,'peppers.wtc',meth,'maxloop',9,'wname','haar');

Xc = wcompress('u','peppers.wtc');

colormap(pink(255))

figure(3)

subplot(1,2,1); image(Xc);

axis square;

title('Compressed Image - 9 steps')

xlabel({['Compression Ratio: ' num2str(CR,'%1.2f %%')],...

['BPP: ' num2str(BPP,'%3.2f')]})

[CR,BPP] = wcompress('c',X,'peppers.wtc',meth,'maxloop',12,'wname','haar');

Xc = wcompress('u','peppers.wtc');

subplot(1,2,2); image(Xc);

axis square;

title('Compressed Image - 12 steps')

xlabel({['Compression Ratio: ' num2str(CR,'%1.2f %%')], ...

['BPP: ' num2str(BPP,'%3.2f')]})

[CR,BPP] = wcompress('c',X,'peppers.wtc','ezw','maxloop',12, ...

'wname','bior4.4');

Xc = wcompress('u','peppers.wtc');

colormap(pink(255))

figure(4)

subplot(1,2,1); image(Xc);

axis square;

title('Compressed Image - 12 steps - bior4.4')

xlabel({['Compression Ratio: ' num2str(CR,'%1.2f %%')], ...

['BPP: ' num2str(BPP,'%3.2f')]})

[CR,BPP] = wcompress('c',X,'peppers.wtc','ezw','maxloop',11, ...

34

Page 35: CS-II

'wname','bior4.4');

Xc = wcompress('u','peppers.wtc');

subplot(1,2,2); image(Xc);

axis square;

title('Compressed Image - 11 steps - bior4.4')

xlabel({['Compression Ratio: ' num2str(CR,'%1.2f %%')], ...

['BPP: ' num2str(BPP,'%3.2f')]})

[CR,BPP] = wcompress('c',X,'peppers.wtc','spiht','maxloop',12, ...

'wname','bior4.4');

Xc = wcompress('u','peppers.wtc');

colormap(pink(255))

OUTPUT:

35

Page 36: CS-II

Original Image

100 200 300 400 500

100

200

300

400

500

Compressed Image - 6 steps

Compression Ratio: 0.06 %BPP: 0.02

100 200 300 400 500

100

200

300

400

500

Original Image

100 200 300 400 500

100

200

300

400

500

Compressed Image

Compression Ratio: 1.57 %BPP: 0.38

100 200 300 400 500

100

200

300

400

500

36

Page 37: CS-II

Compressed Image - 9 steps

Compression Ratio: 0.81 %BPP: 0.19

100 200 300 400 500

100

200

300

400

500

Compressed Image - 12 steps

Compression Ratio: 7.47 %BPP: 1.79

100 200 300 400 500

100

200

300

400

500

Compressed Image - 12 steps - bior4.4

Compression Ratio: 4.92 %BPP: 1.18

100 200 300 400 500

100

200

300

400

500

Compressed Image - 11 steps - bior4.4

Compression Ratio: 2.51 %BPP: 0.60

100 200 300 400 500

100

200

300

400

500

RESULT:

Thus the given image has been compressed using the EZW algorithm.

37

Page 38: CS-II

EXP.NO:

DATE:

SIMULATION OF SPIHT IMAGE COMPRESSION

ALGORITHM

AIM:

To compress an image using simulate SPIHT image coding algorithm.

APPARATUS REQUIRED:

1. MATLAB 7.0.12. Personal Computer

THEORY:

SPIHT ALGORITHM:

One of the most efficient algorithms in the area of image compression is the Set

Partitioning in Hierarchical Trees (SPIHT). It uses a sub-band coder, to produce a pyramid

structure where an image is decomposed sequentially by applying power complementary low

pass and high pass filters and then decimating the resulting images. These are one-

dimensional filters that are applied in cascade (row then column) to an image whereby

creating four-way decomposition: LL (low-pass then another low pass), LH (low pass then

high pass), HL (high and low pass) and finally HH (high pass then another high pass). The

resulting LL version is again four-way decomposed. This process is repeated until the top of

the pyramid is reached. This pyramid structure is commonly known as spatial orientation

tree.

ALGORITHM:

Initialize the Matlab

Read the input image given for compression

Specify the maximum number of steps for the compression algorithm.

Compress the image using SPIHT algorithm.

Uncompress the compressed image.

Finalize by plotting the compressed and uncompressed image.

38

Page 39: CS-II

FLOW CHART:

39

Compress the image using SPIHT algorithm

Uncompress the compressed image.

Specify the number of input levels for compression

START

STOP

Initialize by reading input image

Display original image and compressed image

Page 40: CS-II

PROGRAM:

clc;

clear all;

close all;

x=imread(‘wpeppers.jpg’);

[cr,bpp]=wcompress(‘c’,x,’wpeppers.wtc’,’spiht’,’maxloop’,12);

xc=wcompress (‘u’,’wpeppers.wtc’);

Colormap (pink(255));

Subplot(1,2,1);

Image(x);

Axis square;

Title(‘original image’);

Subplot(1,2,2);

Image(xc);

Axis square;

Title(‘compressed image-12-steps-bior 4.4’);

xlabel({[‘compression ratio:’num2str(cr,’%1.2f%%’)]…[‘bpp:’num2str(bpp,’%3.2f’)]});

delete(‘wpeppers.wtc’);

40

Page 41: CS-II

OUTPUT:

Original Image

100 200 300 400 500

100

200

300

400

500

Compressed Image - 12 steps - bior4.4

Compression Ratio: 1.65 %BPP: 0.40

100 200 300 400 500

100

200

300

400

500

RESULT:

41

Page 42: CS-II

Thus the given image has been compressed using the SPIHT algorithm and its

output was verified successfully.

EXP.NO:

DATE:S- PARAMETER ESTIMATION OF COUPLER

AIM:

To design and analyze the characteristics of a coupler using ADS.

APPARATUS REQUIRED:

1. ADS2. Personal Computer

THEORY:

A very commonly used basic element in microwave system is the directional coupler.

Its basic function is to sample the forward and reverse travelling waves through a

transmission line or a waveguide. The common use of this element is to measure the power

level of a transmitted or received signal. The model of a directional coupler is shown in

Figure 1.

42

Page 43: CS-II

As seen in the figure, the coupler is a four-ports device. The forward travelling wave goes

into port 1 and exit from port 2. A small fraction of it goes out through port 4. In a perfect

coupler, no signal appears in port 4. Since the coupler is a lossless passive element, the sum

of the signals power at ports 1 and 2 equals to the input signal power. The reverse travelling

wave goes into port 2 and out of port 1. A small fraction of it goes out through port 3. In a

perfect coupler, no signal appears in port 4. The directional coupler S-parameters matrix is:

Where k is the coupling factor (a linear value).

One popular realization technique of the directional coupler is the coupled lines directional

coupler; two quarter wavelength line are placed close to each other. The wave travelling

through one line is coupled to the other line. Such a coupler is shown in Figure 2.

43

Page 44: CS-II

Since there is no ideal coupler available, some of the forward travelling wave is coupled into

port 3. This mean that we may think that there is a reverse travelling wave when there isn’t.

This is very critical in application where the directional coupler is used to measure the return

loss of the

device. By calculating 20 log(S31/S41) we can find the return loss of the device connected to

port 2. If out coupler has no perfect directivity then out measurement is not accurate.

There are few simple parameters to describe the functionality of a coupler:

• Insertion Loss: 20 log(S21) or 10 log(1 − k2).

• Return Loss: 20 log(S11).

• Coupling: 20 log(S31) or 20 log(k).

• Directivity: 20 log(S31) − 20 log(S41).

CIRCUIT DIAGRAM:

44

Page 45: CS-II

OUTPUT:

45

Page 46: CS-II

RESULT:

THUS THE COUPLER WAS DESIGNED AND ANALYZED USING ADS AND ITS OUTPUT WAS VERIFIED SUCCESSFULLY.

46

Page 47: CS-II

EXP.NO:

DATE:DESIGN OF OSCILLATOR

AIM:

To Design the oscillator using ADS.

APPARATUS REQUIRED:

1. ADS SOFTWARE

2. Personal Computer.

THEORY:

MICROWAVE OSCILLATOR:

An electronic oscillator is an electronic circuit that produces a repetitive electronic

signal, often a sine wave or a square wave. They are widely used in many electronic devices.

Common examples of signals generated by oscillators include signals broadcast by radio and

television transmitters, clock signals that regulate computers and quartz clocks, and the

sounds produced by electronic beepers and video games.

Oscillators are often characterized by the frequency of their output signal: an audio

oscillator produces frequencies in the audio range, about 16 Hz to 20 kHz. An RF oscillator

produces signals in the radio frequency (RF) range of about 100 kHz to 100 GHz. A low-

frequency oscillator (LFO) is an electronic oscillator that generates a frequency below ≈20

Hz. This term is typically used in the field of audio synthesizers, to distinguish it from an

audio frequency oscillator.

Oscillators designed to produce a high-power AC output from a DC supply are

usually called inverters. There are two main types of electronic oscillator: the harmonic

oscillator and the relaxation oscillator.

47

Page 48: CS-II

PROCEDURE:

1. Initialize the Advanced Design System software

2. Create a new project and save it.

3. Select the simulation format.

4. Select an application type as oscillator.

5. Select the required sample design.

6. Specify the simulation template for oscillator.

7. Simulate the project.

CIRCUIT DIAGRAM:

48

Page 49: CS-II

OUTPUT:

RESULT:

Thus the Oscillator has been designed using ADS software and its output was

verified successfully .

49

Page 50: CS-II

EXP.NO:

DATE:DESIGN OF FILTER

AIM:

To stimulate the performance of a Filter using ADS

APPARATUS REQUIRED:

1. Personal Computer

2. ADS software

THEORY:

A filter is a two port network used to control the frequency response at a certain point

in a system by providing transmission within the passband of the filter and attenuation in the

stop band of the filter. The basic filter types are low-pass, high-pass, bandpass and band-

reject (notch) filters.

CIRCUIT DIAGRAM:

50

Page 51: CS-II

Digital Filter Impulse Response

SW_DFILT_FIRX1

ImpulseFloatI1

Delay=0Period=0Level=1.0

NumericSinkN1

ControlSimulation=YESStop=DefaultNumericStopStart=DefaultNumericStartPlot=Rectangular

Numeric

1 2 3

DFDF

DefaultNumericStop=100DefaultNumericStart=0

PROCEDURE:

Step1: Open the ADS software.

Step2: Create a new project from the file menu.

Step3: Open the schematic window of ADS.

Step4: From the components library select the appropriate necessary fo the required model.

Step5: Click on the necessary components and place them on the schematic windows of ADS.

Step6: Design the filters using discrete elements

Step7: Determine the SWR of each filter using hand analysis

51

Page 52: CS-II

Step8: Compare experimental results to theory and simulation

Step9: Comment on your result

OUTPUT:

500 100

0.0

0.1

0.2

0.3

-0.1

0.4

Index

N1

52

Page 53: CS-II

RESULT:

Thus the Filter was simulated using ADS and its output was verified successfully.

EXP.NO:

DATE: DESIGN OF MIXER USING ADS

AIM:

To stimulate the performance of a Mixer using ADS

APPARATUS REQUIRED:

1. Personal Computer2. ADS software

THEORY:

Mixers are three port active or passive devices, are designed to yield both a sum and a

difference frequency at a single output port when two distinct input frequencies are inserted

into the other two ports. This process, called frequency conversion (or heterodyning), is found

in most communications gear, and is used so that we may increase or decrease a signal’s

53

Page 54: CS-II

frequency. One of the two input frequencies will normally be a CW wave, produced within

the radio by a local oscillator (LO), while the other input will be the RF signal received from

the antenna. If we would like to produce an output frequency within the mixer circuit that is

lower than the input RF signal, then this is called down conversion; if we would like to

produce an output signal that is at a higher frequency than the input signal, it is referred to as

up conversion. Indeed, most AM, SSB, and digital transmitters require mixers to convert up

to a higher frequency for transmission into space, while superheterodyne receivers require a

mixer to convert a received signal to a much lower frequency. This lower received frequency

available at the mixer’s output port is called the intermediate frequency (IF). Receivers use

this lower-frequency IF signal because it is much easier to efficiently amplify and filter with

all the IF stages tuned and optimized for a single, low band of frequencies, which increases

the receiver’s gain and selectivity. Again, the frequency conversion process within the

nonlinear mixer stage produces the intermediate frequency by the RF input signal

heterodyning, or beating, with the receiver’s own internal LO. This heterodyning mixer

circuit will consist of either a diode, BJT, or FET that is overdriven, or biased to run within

the nonlinear area of its operation. However, the beating of the mixer’s RF and LO input

signals yields not only the RF, the LO, and the sum and difference frequencies of these two

primary signals, but also many spurious frequencies at the mixer’s output port. Most of these

undesired frequencies will be filtered out within the receiver’s IF stages, resulting in the new

desired signal frequency, consisting of the converted carrier and any sidebands, now at the

difference frequency. This new, lower difference frequency will then be amplified and further

filtered as it passes through the fixed-tuned IF strip. There are three basic classifications for

both active and passive mixers: Unbalanced mixers have an IF output consisting of fS,fLO,

fS − fLO, fS + fLO, and other spurious outputs. They will also exhibit little isolation between

each of the mixer’s three ports, resulting in undesired signal interactions and feedthroughs to

another port. Singlebalanced mixers will at least strongly attenuate either the original input

signal or the LO (but not both), while sending less of the above mixing products on to its

output than the unbalanced type. A double-balanced mixer, or DBM for short, supplies

superior IF-RF-LO inter-port isolation, while outputting only the sum and difference

frequencies of the input signal and the local oscillator, while attenuating both the LO and RF

signals, and significantly attenuating three quarters of the possible mixer spurs at the output

of the IF port. This makes the job of filtering and selecting a frequency plan a much easier

task.

54

Page 55: CS-II

CIRCUIT DIAGRAM:

55

Page 56: CS-II

PROCEDURE:

56

Page 57: CS-II

Step1: Open the ADS software.

Step2: Create a new project from the file menu.

Step3: Open the schematic window of ADS.

Step4: From the components library select the appropriate necessary of the required model.

Step5: Click on the necessary components and place them on the schematic windows of ADS.

Step6: Design the Mixer using discrete elements

Step7: Determine the SWR of each filter using hand analysis

Step8: Compare experimental results to theory and simulation

Step9: Comment on your result

OUTPUT:

57

Page 58: CS-II

RESULT:

Thus the Mixer was simulated using ADS and its output was verified successfully.

EXP.NO: DESIGN OF AMPLIFIER

58

Page 59: CS-II

DATE:

AIM:

To design and analyze the characteristics of Amplifier using ADS.

APPARATUS REQUIRED:

1. ADS software

2. Personal Computer

THEORY:

An amplifier is an electronic device that increases the voltage, current, or power of a

signal. Amplifiers are used in wireless communications and broadcasting, and in audio

equipment of all kinds. They can be categorized as either weak-signal amplifiers or power

amplifiers. Weak-signal amplifiers are used primarily in wireless receivers. They are also

employed in acoustic pickups, audio tape players, and compact disc players. A weak-signal

amplifier is designed to deal with exceedingly small input signals, in some cases measuring

only a few nano volts (units of 10-9 volt). Such amplifiers must generate minimal internal

noise while increasing the signal voltage by a large factor. The most effective device for this

application is the field-effect transistor. The specification that denotes the effectiveness of a

weak-signal amplifier is sensitivity, defined as the number of micro volts (units of 10-6 volt)

of signal input that produce a certain ratio of signal output to noise output (usually 10 to 1).

Power amplifiers are used in wireless transmitters, broadcast transmitters, and hi-fi

audio equipment. The most frequently-used device for power amplification is the bipolar

transistor. However, vacuum tubes, once considered obsolete, are becoming increasingly

popular, especially among musicians. Many professional musicians believe that the vacuum

tube (known as a "valve" in England) provides superior fidelity.

59

Page 60: CS-II

CIRCUIT DIAGRAM:

PROCEDURE:

1. Initialize the Advanced Design System software

2. Create a new project and save it.

3. Select simulation format.

4. Select an application type as amplifier.

5. Select the required sample design.

6. Specify the simulation template for Amplifier.

7. Simulate the project.

60

Page 61: CS-II

OUTPUT:

RESULT:

Thus the Amplifier was simulated using ADS and its output was verified successfully.

61

Page 62: CS-II

EXP.NO:

DATE:SIMULATION OF GPS

AIM: To Simulate the GPS system using MATLAB

APPARATUS REQUIRED:

1. MATLAB 7.0.1

2. Personal Computer

THEORY:

Trilateration is a method of determining the relative position of objects using the

geometry of triangles in a similar fashion as triangulation. Unlike triangulation, which uses

angle measurements to calculate the subject’s location, triangulation uses the known locations

of two or more reference points, and the measured distance between the subject and each

reference point. To accurately and uniquely determine the relative location of a point on a 2D

plane using trilateration alone, generally at least 3 reference points are needed.

Standing at B, you want to know your location relative to the reference points P1, P2

and P3 on a 2D plane. Measuring r1 narrows your position down to a circle. Next, measuring

r2 narrows it down to two points, A and B. A third measurement, r3, gives your coordinates

at B. A fourth measurement could also be made to reduce error.

A mathematical derivation for the solution of a three-dimensional trilateration

problem can be found by taking the formulae for three spheres and setting them equa;l to

each other. To do this, we must apply three constraints to the centers of these spheres; all

three must be on the z=0 plane, one must be on the origin, and one other must be on the x-

axis.

Starting with three spheres,

62

Page 63: CS-II

and

We subtract the second from the first and solve for x:

Substituting this back into the formula for the first sphare produces the formula for a circle,

the solution to the intersection of the first two spheres:

Setting this formula equal to the formula for the third sphere finds:

Now that we have the x-and y- coordinates of the solution point, we can simply rearrange the

formula for the first sphere to find the z- coordinate:

Now we have the solution to all three points x, y and z. because z is expressed as a square

root, it is possible for there to be zero, one or two solutions to the problem.

ALGORITHM:

Initialize the Matlab

63

Page 64: CS-II

Get the co-ordinate values for x,y and z

Determine the absolute location of the points

Locate the area of intersections of three spheres

Display the latitude and longitude values

PROGRAM:clc;

clear all;

close all;

x=input('the x-coordinate value=');

if(x>100)

disp('i/p exceeds the axis value');

return

end

y=input('the y-coordinate value=');

if(y>100)

disp('i/p exceeds the axis value');

return

end

z=input('the z-coordinate value=');

if(z>100)

disp('i/p exceeds the axis value');

return

end

a=6378137;

b=6356752.31425;

f=(a-b)/b;

display(f);

doubletemp=0;

doubletemp1=0;

temp=((a*a)-(b*b))/(b*b);

e1=sqrt(temp);

disp('the value of e1 is');

display(e1);

64

Page 65: CS-II

temp=2*f-(f*f);

e=sqrt(temp);

disp('the value of e is');

disp(e);

temp=(x*x)+(y*y);

p=sqrt(temp);

disp('the value of p is');

display(p);

theta=atan(z*a/(p*b));

display(theta);

temp=z+(e1*e1*b*sin(theta)*sin(theta)*sin(theta));

disp('the value of temp is');

display(temp);

temp1=p-(e*e*a*cos(theta)*cos(theta)*cos(theta));

disp('the value of temp1 is');

display(temp1);

fi=atan(temp/temp1);

disp('the value of fi is');

display(fi);

lam=atan2(y,x);

disp('the value of lam is');

display(lam);

temp=1-(e*e*sin(fi)*sin(fi));

temp1=sqrt(temp);

n=a/temp1;

h=(p/cos(fi))-n;

disp('The value of Altitiude (h) is');

display(h);

OUTPUT:

the x-coordinate value=5

the y-coordinate value=4

65

Page 66: CS-II

the z-coordinate value=3

f =0.0034

the value of e1 is

e1 =0.0821

the value of e is

0.0820

the value of p is

p =6.4031

theta =0.4394

the value of temp is

temp =3.3018e+003

the value of temp1 is

temp1 = -3.1747e+004

the value of fi is

fi = -0.1036

the value of lam is

lam = 0.6747

The value of Altitiude (h) is

h =-6.3784e+006

66

Page 67: CS-II

RESULT:

Thus the GPS was simulated using MATLAB and its output was verified successfully.

EXP.NO:PERFORMANCE EVALUATION OF SIMULATION OF

CDMA SYSTEMDATE:

AIM:

To design and analyze the performance evaluation of simulation of CDMA system.

APPARATUS REQUIRED:

1. MATLAB Version 7.0.1

2. Personal computer

THEORY:

DMA is a spread spectrum multiple access technique. A spread spectrum technique

spreads the bandwidth of the data uniformly for the same transmitted power. A spreading

code is a pseudo-random 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. Code division multiple access (CDMA) is a channel access method used by

various radio communication technologies. It should not be confused with the mobile phone

standards called cdmaOne, CDMA2000 (the 3G evolution of cdma One) and WCDMA (the

3G standard used by GSM carriers), which are often referred to as simply CDMA, and use

CDMA as an underlying channel access method.One of the concepts in data communication

is the idea of allowing several transmitters to send information simultaneously over a single

communication channel. This allows several users to share a band of frequencies (see

bandwidth). This concept is called multiple access.

CDMA employs spread-spectrum technology and a special coding scheme (where

each transmitter is assigned a code) to allow multiple users to be multiplexed over the same

67

Page 68: CS-II

physical channel. By contrast, time division multiple access (TDMA) divides access by time,

while frequency-division multiple access (FDMA) divides it by frequency. CDMA is a form

of spread-spectrum signalling, since the modulated coded signal has a much higher data

bandwidth than the data being communicated.An analogy to the problem of multiple access is

a room (channel) in which people wish to talk to each other simultaneously. To avoid

confusion, people could take turns speaking (time division), speak at different pitches

(frequency division), or speak in different languages (code division). CDMA is analogous to

the last example where people speaking the same language can understand each other, but

other languages are perceived as noise and rejected. Similarly, in radio CDMA, each group of

users is given a shared code. Many codes occupy the same channel, but only users associated

with a particular code can communication.

BLOCK DIAGRAM OF CDMA SYSTEM:

MULTI USER:

68

Page 69: CS-II

TRANSMITTER SIDE SYSTEM:

RECEIVER SIDE SYSTEM:

69

Page 70: CS-II

SINGLE USER:

70

Page 71: CS-II

PROCEDURE:

1. Convert input bits to bipolar bits.. 1 to 1 and 0 to -1 for user1 and user2

71

Page 72: CS-II

2. Take 100 samples per bit for both user1 and user2 and then plot base band

signal which is in bipolar NRZ format.

3. Then BPSK modulate the signal. Take care that sampling rate of sinusoidal

carrier matches the sampling rate per bit. Here it is 100 samples per carrier and then

plot the BPSK signal

4. Multiply the BPSK modulated signal with the PN code. Here again the care

should be taken to match the sampling rate. i.e. no. of chip per bit* no of samples per

chip = no of samples per bit of BPSK modulated signal.

5. Same procedure is carried out for user2 bits.

6. The channel is AWGN channel with SNR 5 dbs. In channel the signal from

user1 is added to signal from user2 and white Gaussian noise is added.

7. At receiver end , first received signal is multiples with PN then BPSK

demodulated by multiplying with the carrier(coherent demod)

8. Then the samples over 1 bit interval are summed. And if the sum is greater

than 0 than the received bit is 1 else rx bit is 0. Summation is used in place of

integration because it is a discrete time system

9. Same procedure is repeated for user2.

OUTPUT:

72

Page 73: CS-II

73

Page 74: CS-II

RESULT:

Thus the performance evaluation of simulation of CDMA was simulated using MATLAB and its output was verified successfully.

74

Page 75: CS-II

EXP.NO:

DATE:DESIGN AND TESTING OF A MICROSTRIP COUPLER

AIM:

To design and analyze the characteristics of a microstrip coupler using MATLAB.

APPARATUS REQUIRED:

3. MATLAB 7.0.14. Personal Computer

THEORY:

Mini-Circuits microstrip couplers are reactive devices featuring very low insertion

loss. Most models have 3 ports, and are manufactured with an internal 50-ohm termination.

In the case, power coupled from any power incident to the output port (the reflected power) is

absorbed and not available to the user. However, all 4-port (bi-microstrip) models have both

the incident and reflected coupled power available. Examples are the ZFDC-20-1H and the

BD-suffix models. The basic function of a microstrip coupler is to operate on an input so that

two input signals are available. However, when the input is applied to the opposite port of an

internally terminated coupler, only one output signal is produced.

MICROSTRIP COUPLER CHARACTRISTICS

1. The output signals are unequal in amplitude. The larger signal is at the main-line

output port. The smaller signal is at the coupled port.

2. The main-line insertion loss depends upon the signal level at the coupled port, as

determined by design.

75

Page 76: CS-II

3. There is high isolation between the coupled port and the output of the main-line.

Key characteristics of a microstrip coupler include coupling coefficient, coupling

flatness, main-line loss and directivity, defined in the next page. Mini-Circuits full line of

microstrip couplers, spanning 5 KHz to 2GHz, provide excellent performance. They feature:

1. flat coupling over a broad bandwidth

2. low main-line loss, as low as 0.1 dB

3. directivity as high as 55 dB and

4. A wide range of coupling values, from 6dB to 30dB.

MICROSTRIP COUPLER APPLICATIONS

The high performance characteristics of these units enable the following signal processing

functions to be accomplished:

1. Measure incident and reflected power to determine VSWR

2. Signal sampling

3. Signal injection

PROGRAM:

clc;

clear all;

close all;

for(f=10^8:10^8:10^11)

C=47*10^-12;

L=1542*10^-9*((sqrt(f)^-1));

Rs=4.8*sqrt(f)*10^-6;

Re=33.9*10^12*(f^-1);

76

Page 77: CS-II

impedance1=abs((i*2*pi*f*C)^-1);

impedance=abs(i*2*pi*f*L+Rs+Re*((1+i*2*pi*f*C*Re)^-1));

axis on;

grid on;

hold on;

axis auto;

xmin=10^5;

xmax=10^11;

ymin=0;

ymax=3.5;

axis([xmin,xmax,ymin,ymax]);

xlabel('frequency');

ylabel('impedance');

plot(f,impedance,'red');

plot(f,impedance1,'blue');

end

77

Page 78: CS-II

OUTPUT:

1 2 3 4 5 6 7 8 9 10

x 1010

0

0.5

1

1.5

2

2.5

3

3.5

frequency

impe

danc

e

RESULT:

78

Page 79: CS-II

Thus the microstrip coupler was simulated using MATLAB and its output was verified successfully.

AIM:

To simulate the micro strip antenna using MATLAB.

EQUIPMENTS REQUIRED:

1. Personal computer.

2. MATLAB 7.0 version.

THEORY:

In telecommunication, there are several types of micro strip antennas (also known as

printed antennas) the most common of which is the micro strip patch antenna or patch

antenna. A patch antenna is a narrowband, wide-beam antenna fabricated by etching the

antenna element pattern in metal trace bonded to an insulating dielectric substrate, such as a

printed circuit board, with a continuous metal layer bonded to the opposite side of the

substrate which forms a ground plane.

Common micro strip antenna shapes are square, rectangular, circular and elliptical,

but any continuous shape is possible. Some patch antennas do not use a dielectric substrate

and instead made of a metal patch mounted above a ground plane using dielectric spacers; the

resulting structure is less rugged but has a wider bandwidth. Micro strip antennas are

relatively inexpensive to manufacture and design because of the simple 2-dimensional

physical geometry. They are usually employed at UHF and higher frequencies because the

size of the antenna is directly tied to the wavelength at the resonant frequency.

A single patch antenna provides a maximum directive gain of around 6-9 dB. It is relatively easy to print an array of patches on a single (large) substrate using lithographic techniques. The directivity of patch antennas is approximately 5-7 dB

79

Page 80: CS-II

EXP.NO: SIMULATION OF MICROSTRIP ANTENNA

USING MATLABDATE:

ALGORITHM:

Start the program.

Calculate the width, effective dielectric constant, length, effective length of

microstrip as follows;

w= ((sqrt (2/er+1))*c)/(2*fr)

preff =((er+1)/2)+(((er-1)/2)*(1+12*1/wbyh))

len=(c/(2*fr*sqrt(preff)))-(2*incleng)

eff=len+(2*incleng)

Where er=dielectric constant value

fr=resonant frequency

Stop the program.

80

Page 81: CS-II

FLOWCHART

81

ENTER THE DIELECTRIC CONSTANT,RESONANT FREQUENCY,HEIGHT OF MICROSTRIP ANTENNA

FIND THE WIDTH OF MICROSTRIP ANTENNA

CALCULATE EFFECTIVE DIELECTRIC CONSTANT,LENGTH,EFFECTIVE LENGTH OF MICROSTRIP ANTENNA

STOP

START

Page 82: CS-II

CODING:

clc;

close all;

clear all;

er=input('the dielectric constant value');

fr=input('the resonant frequency value in Ghz');

h=input('the height of microstrip antenna in cm');

c=30;

w=((sqrt(2/er+1))*c)/(2*fr);

disp('width of microstrip in cm');

display(w);

wbyh=w/h;

preff=((er+1)/2)+((er-1)/2)*(1+12*1/wbyh);

disp('effective dielectric constant of microstrip');

disp(preff);

a=((preff+0.3)/(preff-0.258));

b=((wbyh+0.264)/(wbyh+0.813));

incleng=0.4128*h*a*b;

disp('increase in length of microstrip in cm');

disp(incleng);

len=((c/(2*fr+sqrt(preff)))-(2*incleng));

disp('length of microstrip in cm');

disp(len);

eff=len+(2*incleng);

disp('effective length of microstrip in cm');

disp(eff);

82

Page 83: CS-II

OUTPUT:

the dielectric constant value 1

the resonant frequency value in Ghz 50

the height of micro strip antenna in cm 5

width of micro strip in cm

w = 0.5196

effective dielectric constant of micro strip

1

increase in length of micro strip in cm

1.4510

length of micro strip in cm

-2.6050

effective length of micro strip in cm

0.2970

RESULT:

Thus the micro strip antenna using MATLAB has been simulated.

83

Page 84: CS-II

84