You are on page 1of 31

1

EXPERIMENT-1
AIM - Write a Matlab code to generate sine, cosine, exponential, unit step, unit
impulse and unit ramp function.

THEORY- A signal as referred to in communication systems, signal processing, and electrical


engineering "is a function that conveys information about the behavior or attributes of some
phenomenon".There are different types of signals like:

1.Sine wave-The sine wave or sinusoid is a mathematical curve that describes a smooth
repetitive oscillation.The signal repeats itself after a period of 2pi. Its most basic form as a
function of time (t) is:

The sine function attains maximum value of 1 at angles (n+i)pi/2 and value 0 at n*pi.

2.Cosine wave- A cosine wave is a signal waveform with a shape identical to that of a sine
wave , except each point on the cosine wave occurs exactly 1/4 cycle earlier than the
corresponding point on the sine wave. A cosine wave and its corresponding sine wave have the
same frequency, but the cosine wave leads the sine wave by 90 degrees of phase .
3.Exponential signal-A real exponential signal is defined as

Where both "A" and "" are real. Depending on the value of "" the signals will be different.
If "" is positive the signal x(t) is a growing exponential and if "" is negative then the
signal x(t) is a decaying exponential. For =0, signal x(t) will be constant.

4.Impulse signal-The Dirac delta function or unit impulse or often referred to as the delta
function, is the function that defines the idea of a unit impulse in continuous-time. Informally,
this function is one that is infinitesimally narrow, infinitely tall, yet integrates to one. Perhaps the
simplest way to visualize this as a rectangular pulse from a -D/2 to a +D/2 with a height of 1/D.
As we take the limit of this setup as D approaches 0, we see that the width tends to zero and the
height tends to infinity as the total area remains constant at one.
The impulse function is often written as

If the magnitude at 0 is 1 unit then the function is termed as unit impulse function.
5.Unit step function-The Heaviside step function, or the unit step function, usually denoted
by H (but sometimes u or ), is adiscontinuous function whose value is zero for negative
argument and one for positive argument.
An alternative form of the unit step, as a function of a discrete variable n:

6.Ramp functionThe ramp function (


definition is:

) may be defined analytically in several ways. Possible

It has a value 0 for x<0 and a value r(x)=x for positive x. Thus forming a line with slope 1 for
x>0.

CODE:

t= [0:pi/12:2*pi];
m=[-20:1:20];
j=[-1:0.1:1];
l=[-20:20];
x=sin(t);
y=cos(t);
e=exp(j);
k=1;
for i= -20:20;
if i<0
r(k)=0;
else
r(k)=i;
end
k=k+1;
end
u=[zeros(1,20),ones(1,1),ones(1,20)]
d=[zeros(1,20),ones(1,1),zeros(1,20)]
subplot(3,2,1)
plot(t,x)
title('sine curve')
subplot(3,2,2)
plot(t,y)
title('cosine curve')
subplot(3,2,3)
plot(j,e)

title('exponential curve')
subplot(3,2,4)
plot(l,r)
title('ramp function')
subplot(3,2,5)
plot(m,u)
title('unit step function')
subplot(3,2,6)

stem(m,d)
title('impulse function')

OUTPUT:

EXPERIMENT-2
AIM- Write a MATLAB code to generate an amplitude modulated wave (AM).
THEORY- Amplitude Modulation (AM) is a method of impressing data on to an
alternating current carrier waveform. The instantaneous amplitude varies
depending on the instantaneous amplitude of the modulating signal.
The general expression for AM wave is:v(t)= [ AC + vm(t) ] sin( wct )

CODE:
Am=input('enter
wm=input('enter
Ac=input('enter
wc=input('enter

the
the
the
the

message
message
carrier
carrier

t=0:pi/60:2*pi;
m=Am*sin(wm*t);
c=Ac*sin(wc*t);
v=(m + Ac).*sin(wc*t);
subplot(3,1,1)
plot(t,m)
xlabel('time')
ylabel('m(t)')
title('Message Signal')
subplot(3,1,2)

signal amplitude');
signal frequency');
wave amplitude');
wave frequency');

plot(t,c)
xlabel('time')
ylabel('c(t)')
title('Carrier Signal')
subplot(3,1,3)
plot(t,v)
xlabel('time')
ylabel('v(t)')
title('AM Signal')

OUTPUT:

10

EXPERIMENT-3
AIM: Write a MATLAB code to generate a frequency modulated wave (FM).
THEORY:
Frequency Modulation (FM) is a method of changing the rest frequency of the
carrier signal in accordance with the instantaneous amplitude of the modulating
signal.
The general expression for FM wave is :V(t) = Asin
= wc t + kf m(t)
Kf = Frequency Deviation constant
V(t) = A sin[ [wc t + kf m(t)] ]
V(t)=Asin (wc t + mf sin(wmt))
CODE:
Am=input('enter
wm=input('enter
Ac=input('enter
wc=input('enter
mf=input('enter

the
the
the
the
the

message signal amplitude');


message signal frequency');
carrier wave amplitude');
carrier wave frequency');
modulation index');

t=0:pi/108:2*pi;
m=Am*sin(wm*t);
c=Ac*sin(wc*t);
v=Ac*sin(wc*t + mf*sin(wm*t));
subplot(2,2,1)
plot(t,m)

11

xlabel('time')
ylabel('m(t)')
title('Message Signal')
subplot(2,2,2)
plot(t,c)
xlabel('time')
ylabel('c(t)')
title('Carrier Signal')
subplot(2,2,3.5)
plot(t,v)
xlabel('time')
ylabel('v(t)')
title('Frequency Modulated Signal')

12

OUTPUT:

13

EXPERIMENT-4

14

AIM: Write a MATLAB program to generate a DSB-SC (Double side


band suppressed carrier) modulated wave.
THEORY: A signal is said to be DSB-SC or Product Modulated when it
is generated by the multiplication of message signal and carrier wave
part. The carrier wave is suppressed in the resultant modulated wave and
the upper and lower side bands are present. The general expression is:
y = m(t) x sin (wct)
CODE:
Am=input('enter
wm=input('enter
Ac=input('enter
wc=input('enter

the
the
the
the

message
message
carrier
carrier

t=0:pi/60:4*pi;
m=Am*sin(wm*t);
c=Ac*sin(wc*t);
v=m.*sin(wc*t);
subplot(2,2,1)
plot(t,m)
xlabel('time')
ylabel('m(t)')
title('Message Signal')
subplot(2,2,2)
plot(t,c)
xlabel('time')
ylabel('c(t)')
title('Carrier Signal')
subplot(2,2,3.5)
plot(t,v)
xlabel('time')
ylabel('v(t)')
title('DSB-SC Signal')

signal amplitude');
signal frequency');
wave amplitude');
wave frequency');

15

OUTPUT:

16

EXPERIMENT-5

17

AIM: Write a MATLAB code to generate an SSB-SC (Single Side BandSuppressed Carrier) signal.
THEORY:
When we have equal frequency added on either side of an Amplitude Modulated
signal, so we can use only one side band for our information and other side band
can be utilized for some other information. The other side band can be removed
using a suitable Band Pass Filter (BPF).
Hilbert transform is used to obtain ninety degree phase shift in the modulated wave
and hence use it to generate SSB-SC.
This process is known as Single Side Band-Suppressed Carrier method (SSB-SC).
m(t) x cos(wct) => Xdsb-sc ----> B.P.F. -----> Xssb-sc
SSB signal is given as follows:
vSSB(t)= m(t)cos(wct) mhsin(wct)
CODE:
Am=input('enter
wm=input('enter
Ac=input('enter
wc=input('enter

the
the
the
the

message
message
carrier
carrier

signal amplitude');
signal frequency');
wave amplitude');
wave frequency');

t=0:pi/60:4*pi;
m=Am*sin(wm*t);
c=Ac*sin(wc*t);
mh=hilbert(m);
vlsb=m.*cos(wc*t) + mh.*sin(wc*t);
vusb=m.*cos(wc*t) - mh.*sin(wc*t);
subplot(2,2,1)
plot(t,m)

18

xlabel('time')
ylabel('m(t)')
title('Message Signal')
subplot(2,2,2)
plot(t,c)
xlabel('time')
ylabel('c(t)')
title('Carrier Signal')
subplot(2,2,3)
plot(t,vlsb)
xlabel('time')
ylabel('vlsb')
title('SSB-SC Signal(LSB)')
subplot(2,2,4)
plot(t,vusb)
xlabel('time')
ylabel('usb')
title('SSB-SC Signal(USB)')

OUTPUT:

19

EXPERIMENT-6

20

AIM: Write a MATLAB code to generate a phase modulated wave (PM).


THEORY:
Phase Modulation (PM) is a method of changing the rest frequency of the carrier
signal in accordance with the instantaneous amplitude of the modulating signal
with some additional phase change.
The general expression for PM wave is:V(t) = Asin
= wct + kp m(t)
Kp = Phase Deviation constant
V(t) = A sin (wc t + kp m(t) )
CODE:

Am=input('enter
wm=input('enter
Ac=input('enter
wc=input('enter
kp=input('enter

the
the
the
the
the

message signal amplitude');


message signal frequency');
carrier wave amplitude');
carrier wave frequency');
modulation index');

t=0:pi/108:2*pi;
m=Am*sin(wm*t);
c=Ac*sin(wc*t);
v=Ac*sin(wc*t + kp*m);
subplot(2,2,1)

21

plot(t,m)
xlabel('time')
ylabel('m(t)')
title('Message Signal')
subplot(2,2,2)
plot(t,c)
xlabel('time')
ylabel('c(t)')
title('Carrier Signal')
subplot(2,2,3.5)
plot(t,v)
xlabel('time')
ylabel('v(t)')
title('Phase Modulated Signal')

OUTPUT:

22

EXPERIMENT-7

23

AIM: Write a MATLAB code to generate envelope detector


THEORY:
An envelope detector is an electronic circuit that takes a high-frequency signal as
input and provides an output which is the envelope of the original signal. The
capacitor in the circuit stores up charge on the rising edge, and releases it slowly
through the resistor when the signal falls. The diode in series rectifies the incoming
signal, allowing current flow only when the positive input terminal is at a higher
potential than the negative input terminal.
If x(t)=[ac+m(t)]*coswt is amplitude modulated wave
Then ac+m(t) = envelope of x(t)

CODE:

Am=input('enter
wm=input('enter
Ac=input('enter
wc=input('enter
m=Am/Ac

the
the
the
the

message
message
carrier
carrier

signal amplitude');
signal frequency');
wave amplitude');
wave frequency');

t=0:0.001:1;
m=Am*sin(2*pi*fm*t);
c=Ac*cos(2*pi*fc*t);
V=Ac*(m*sin(2*pi*fm*t)+1).*cos(2*pi*fc*t);
subplot(2,2,1);
plot(t,m);
title('m(t)');
xlabel('time');
ylabel('amplitude');
subplot(2,2,2);

24

plot(t,c);
title('c(t)');
xlabel('time');
ylabel('amplitude');
subplot(2,2,3);
plot(t,V);
title('AM signal');
xlabel('time');
ylabel('amplitude');
x(1)=0;
for l=2:length(V);
if V(l)>x(l-1);
x(l)=V(l);
else x(l)=x(l-1)*0.937;
end;
end;
subplot(2,2,4);
plot(t,x);
title('envelope detector output');
xlabel('time');
ylabel('amplitude');

OUTPUT:

25

26

EXPERIMENT-8
AIM: Write a MATLAB code for Amplitude Shift Keying (A.S.K.) encoding
technique
THEORY:
Amplitude-shift keying (ASK) is a form of amplitude modulation that represents
digital data as variations in the amplitude of a carrier wave. In an ASK system, the
binary symbol 1 is represented by transmitting a fixed-amplitude carrier wave and
fixed frequency for a bit duration of T seconds. If the signal value is 1 then the
carrier signal will be transmitted; otherwise, a signal value of 0 will be transmitted.

CODE:

t=0:0.01:9.99;
c=20*sin(2*pi*t);
x=zeros(1,t);
l=length(c);
m=[1 1 0 1 1 0 0 0 1 1];
for i=1:l;
x(i)=m(ceil(i/100));
end
ASK=c.*x;
subplot(2,2,1);
plot(t,c);
title('carrier signal');
subplot(2,2,2);
plot(t,x);
title('modulating signal');

27

subplot(2,2,[3,4]);
plot(t,ASK);
title('ASK');

28

OUTPUT:

29

EXPERIMENT-9
AIM: Write a MATLAB code for frequency shift keying (F.S.K.) encoding
technique
THEORY:
Frequency-shift keying (FSK) is a frequency modulation scheme in which digital
information is transmitted through discrete frequency changes of a carrier wave.
The simplest FSK is binary FSK (BFSK). BFSK uses a pair of discrete frequencies
to transmit binary (0s and 1s) information
CODE:
t=0:0.1:100;
w=1;
w1=1.5;
w2=.5;
c=50*sin(w*t);
subplot(2,3,1);
plot(t,c);
title('carrier wave');
c1=sin(w1*t);
subplot(2,3,2);
plot(t,c1);
title('frequency 1');
c2=sin(w2*t);
subplot(2,3,3);
plot(t,c2);
title('frequency 2');
m=square(2*pi*.03*t);
subplot(2,3,4);

30

plot(t,m);
title('modulating signal');
s=zeros(1001);
for x=1:1000
if m(x)>0
s(x)=c1(x);
else s(x)=c2(x);
end;
end;
subplot(2,3,[5,6]);
plot(t,s);
title('FSK');

OUTPUT:

31

You might also like