Sie sind auf Seite 1von 23

DSC-SC MODULATION:

1. When message signal is Rectangular Pulse:

Matlab Coding:
fc=20;
fm=fc/10;
fs=100*fc;
t=-1:1/fs:1;
xc=cos(2*pi*fc*t); %carrier signal
xm=rect(t);%function of rectangle is called (Message Signal)
%plotting of message ansd carrier signal
figure(1)
subplot(2,1,1),plot(t,xc);
title('carrier signal of 20 hz');
xlabel('time (sec)');
ylabel('amplitude');
subplot(2,1,2),plot(t,xm);
title('message signal "Unit Step"');
xlabel('time (sec)');
ylabel('amplitude');
% DSB-SC MODULATION
z1= xm.*xc;
%plotting of modulated signal in time and frequenct domain
figure(2)
subplot(2,1,1),plot(t,z1);
title('DSB-SC MODULATION IN TIME DAOMAIN');
xlabel('time (sec)');
ylabel('amplitude');
l1=length(z1);%length of vector z1 that contains the modulated signal (4001)
f=linspace(-fs/2,fs/2,l1);% linspace(X1, X2, N) generates N points between X1
and X2.
Z1=fftshift(fft(z1,l1)/l1);%fftshift is useful for visualizing the Fourier
transform with the zero-frequency component in the middle of the spectrum.
subplot(2,1,2),plot(f,abs(Z1));%fft(X,N) is the N-point fft, padded with zeros
if X has less than N points and truncated if it has more.
title('DSB SC MODULATION IN FREQUENCY DOMAIN');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 0.3]);%the x-axis ranges from -50 to 50 annd y-axis is from 0
to 0.3
%DCB-SC Demodulation
s1=z1.*xc;
S1=fftshift(fft(s1,length(s1))/length(s1));
%plotting of demodulated signal in time and frequency domain
figure(3)
subplot(2,1,1);
plot(f,abs(S1));

title(' demodulated signal IN FREQUENCY DOMAIN before filtring');


xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 0.3]);
hold on
Hlp=1./sqrt(1+(f./fc).^(2*100)); %transfer function of LPF
subplot(2,1,2);
plot(f,Hlp,'red');
title(' frequency response of low pass filter');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 2]);
E1=Hlp.*S1; %passing the demodulated signal through LPF in order to get the
message siganl back
%plotting the output of LPF in time and frequency domain
figure(4)
subplot(2,1,1),plot(f,E1);
title(' Recover signal IN FREQUENCY DOMAIN after filtring');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 0.3]);
e1=ifft(ifftshift(E1))*length(E1); %inverse discrete fourier transform shift
%ifft(X) is the inverse discrete Fourier transform of X.
%ifftshift(X) swaps "half-spaces" of X along each dimension.
% ifftshift undoes the effects of FFTSHIFT.
subplot(2,1,2),plot(t,(2/20)*e1);
title(' Recover signal IN Time DOMAIN after filtring');
xlabel('time(sec)');
ylabel('amplitude')

Output Results:
carrier signal of 20 hz

amplitude

1
0.5
0
-0.5
-1
-1

-0.8

-0.6

-0.4

-0.2

-0.8

-0.6

-0.4

-0.2

amplitude

0.8

0
0.2
time (sec)

0.4

0.6

0.8

0.8

40

50

DSB-SC MODULATION IN TIME DAOMAIN

1
amplitude

0.6

0.5

0
-1

0.5
0
-0.5
-1
-1

amplitude

0
0.2
0.4
time (sec)
message signal "Unit Step"

-0.8

-0.6

-0.4

-0.2

0
0.2
0.4
0.6
time (sec)
DSB SC MODULATION IN FREQUENCY DOMAIN

-30

-20

-10
0
10
frequency(hz)

0.2
0.1
0
-50

-40

20

30

amplitude

demodulated signal IN FREQUENCY DOMAIN before filtring

0.2
0.1
0
-50

-40

-30

-40

-30

amplitude

-20

-10
0
10
20
frequency(hz)
frequency response of low pass filter

30

40

50

30

40

50

1.5
1
0.5
0
-50

-20

-10
0
10
frequency(hz)

20

amplitude

Recover signal IN FREQUENCY DOMAIN after filtring

0.2

2. Whe
n

0.1
0
-50

-40

-30

-20

-0.8

-0.6

-0.4

amplitude

0.06

-10
0
10
20
30
frequency(hz)
Recover signal IN Time DOMAIN after filtring

40

50

0.8

0.04
0.02
0
-0.02
-1

-0.2

0
0.2
time(sec)

0.4

0.6

message signal is Triangular Pulse:

Matlab Coding:

clc;
clear all;
fc=20;
fm=fc/10;
fs=100*fc;
t=-1:1/fs:1;
xc=cos(2*pi*fc*t);
xm=triangl(t);
figure(1)
subplot(2,1,1),plot(t,xc);
title('carrier signal of 20 hz');
xlabel('time (sec)');
ylabel('amplitude');
subplot(2,1,2),plot(t,xm);
title('message signal "Triangular
Pulse"');
xlabel('time (sec)');
ylabel('amplitude');
% DSB-SC MODULATION
z1= xm.*xc;
figure(2)
subplot(2,1,1),plot(t,z1);
title('DSB-SC MODULATION IN TIME
DAOMAIN');
xlabel('time (sec)');
ylabel('amplitude');
l1=length(z1);
f=linspace(-fs/2,fs/2,l1);
Z1=fftshift(fft(z1,l1)/l1);
subplot(2,1,2),plot(f,abs(Z1));
title('DSB SC MODULATION IN
FREQUENCY DOMAIN');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 0.3]);

Output Results:

s1=z1.*xc;
S1=fftshift(fft(s1,length(s1))/lengt
h(s1));
figure(3)
subplot(2,1,1);
plot(f,abs(S1));
title(' demodulated signal IN
FREQUENCY DOMAIN before filtring');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 0.3]);
hold on
Hlp=1./sqrt(1+(f./fc).^(2*100));
subplot(2,1,2);
plot(f,Hlp,'red');
title(' frequency response of low
pass filter');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 2]);
E1=Hlp.*S1;
figure(4)
subplot(2,1,1),plot(f,E1);
title(' Recover signal IN FREQUENCY
DOMAIN after filtring');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 0.2]);
e1=ifft(ifftshift(E1))*length(E1);
subplot(2,1,2),plot(t,(2/20)*e1);
title(' Recover signal IN Time
DOMAIN after filtring');
xlabel('time(sec)');
ylabel('amplitude')

carrier signal of 20 hz

amplitude

1
0.5
0
-0.5
-1
-1

-0.8

-0.6

-0.4

-0.2

0
0.2
0.4
time (sec)
message signal "Triangular Pulse"

0.6

0.8

-0.8

-0.6

-0.4

-0.2

0.6

0.8

amplitude

0.5

0
-1

amplitude

0.5
0
-0.5
-1
-1

amplitude

0.4

DSB-SC MODULATION IN TIME DAOMAIN

-0.8

-0.6

-0.4

-0.2

0
0.2
0.4
0.6
time (sec)
DSB SC MODULATION IN FREQUENCY DOMAIN

-30

-20

-10
0
10
frequency(hz)

0.8

40

50

0.2
0.1
0
-50

0
0.2
time (sec)

-40

20

30

amplitude

demodulated signal IN FREQUENCY DOMAIN before filtring

0.2
0.1
0
-50

-40

-30

-40

-30

amplitude

-20

-10
0
10
20
frequency(hz)
frequency response of low pass filter

30

40

50

0.5
-20

-10
0
10
frequency(hz)

20

Recover signal IN FREQUENCY DOMAIN after filtring

0.2
amplitude

50

0.15
0.1
0.05
0
-50

-40

-30

-20

-0.8

-0.6

-0.4

0.06
amplitude

40

1.5

0
-50

-10
0
10
20
30
frequency(hz)
Recover signal IN Time DOMAIN after filtring

40

50

0.8

0.04
0.02
0
-1

30

-0.2

0
0.2
time(sec)

0.4

0.6

3. When message signal is Saw tooth wave:

Matlab Coding:

clc;

xlabel('time (sec)');

xlabel('time (sec)');

clear all;
w=2*pi;
fc=20;
fs=10*fc;
t=-1:1/fs:1;
xc=cos(2*pi*fc*t);
xm = sawtooth(w*t);
figure(1)
subplot(2,1,1),plot(t,xc);
title('carrier signal of 20
hz');
ylabel('amplitude');
subplot(2,1,2),plot(t,xm);
title('message signal "Unit
Step"');
ylabel('amplitude');
% DSB-SC MODULATION
z1= xm.*xc;
figure(2)
subplot(2,1,1),plot(t,z1);
title('DSB-SC MODULATION IN
TIME DAOMAIN');
xlabel('time (sec)');
ylabel('amplitude');
l1=length(z1);
f=linspace(-fs/2,fs/2,l1);
Z1=fftshift(fft(z1,l1)/l1);
subplot(2,1,2),plot(f,abs(Z1))
;
title('DSB SC MODULATION IN
FREQUENCY DOMAIN');

xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 0.3]);
s1=z1.*xc;
S1=fftshift(fft(s1,length(s1))
/length(s1));
figure(3)
subplot(2,1,1);
plot(f,abs(S1));
title(' demodulated signal IN
FREQUENCY DOMAIN before
filtring');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 0.3]);
hold on
Hlp=1./sqrt(1+
(f./fc).^(2*100));
subplot(2,1,2);
plot(f,Hlp,'red');
title(' frequency response of
low pass filter');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 2]);
E1=Hlp.*S1;
figure(4)
subplot(2,1,1),plot(f,E1);
title(' Recover signal IN
FREQUENCY DOMAIN after
filtring');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 0.3]);

e1=ifft(ifftshift(E1))*length(
E1);

title(' Recover signal IN Time


DOMAIN after filtring');

subplot(2,1,2),plot(t,
(2/20)*e1);

xlabel('time(sec)');
ylabel('amplitude')

Output Results:
carrier signal of 20 hz

amplitude

1
0.5
0
-0.5
-1
-1

-0.8

-0.6

-0.4

-0.2

-0.8

-0.6

-0.4

-0.2

amplitude

0.6

0.8

0.6

0.8

0.5
0
-0.5
-1
-1

0
0.2
0.4
time (sec)
message signal "Saw Tooth"

0
0.2
time (sec)

0.4

DSB-SC MODULATION IN TIME DAOMAIN

amplitude

1
0.5
0
-0.5

amplitude

-1
-1

-0.6

-0.4

-0.2

0
0.2
0.4
0.6
time (sec)
DSB SC MODULATION IN FREQUENCY DOMAIN

-30

-20

-10
0
10
frequency(hz)

0.8

40

50

0.2
0.1
0
-50

-0.8

-40

20

30

amplitude

demodulated signal IN FREQUENCY DOMAIN before filtring

0.2
0.1
0
-50

-40

-30

-40

-30

amplitude

-10
0
10
20
frequency(hz)
frequency response of low pass filter

30

40

50

30

40

50

1.5
1
0.5
0
-50

-20

-20

-10
0
10
frequency(hz)

20

Recover signal IN FREQUENCY DOMAIN after filtring

amplitude

0.1

0.05

0
-50

-40

-30

-20

-10
0
10
20
30
frequency(hz)
Recover signal IN Time DOMAIN after filtring

-0.8

-0.6

-0.4

amplitude

0.1

40

50

0.8

0.05
0
-0.05
-0.1
-1

-0.2

0
0.2
time(sec)

0.4

0.6

AMPLITUDE MODULATION:
1. When message signal is Triangular Pulse:

Matlab Coding:

clc;

fc=20;

clear all;
A=1;%Amplitude of signal
mi=input('Modulation Index=');
%Modulation Index
fm=fc/10;
fs=100*fc;
t=-1:1/fs:1;
xm=triangl(t);

xlabel('time (sec)');

xlabel('time (sec)');

figure(2)

xc=A*sin(2*pi*fc*t);
figure(1)
subplot(2,1,1),plot(t,xm);
title('carrier signal of 20
hz');

ylabel('amplitude');
subplot(2,1,2),plot(t,xc);
title('message signal
Triangular Pulse');
ylabel('amplitude');
% Amplitude MODULATION
z1=(A+mi*xm).*sin(2*pi*fc*t);
%AM Signal, Amplitude of
Carrier changes to (A+Message)
subplot(2,1,1),plot(t,z1);
title('AMPLITUDE MODULATION IN
TIME DOMAIN');

xlabel('time (sec)');

xlabel('frequency(hz)');

ylabel('amplitude');
l1=length(z1);
f=linspace(-fs/2,fs/2,l1);
Z1=fftshift(fft(z1,l1)/l1);
subplot(2,1,2);
plot(f,abs(Z1));
title('AMPLITUDE MODULATION IN
FREQUENCY DOMAIN');
ylabel('amplitude');
axis([-50 50 0 1]);

s1=z1.*(z1>0);
S1=fftshift(fft(s1,length(s1))
/length(s1));
figure(3)
subplot(2,1,1);
plot(f,abs(S1));
title('Demodulated signal IN
FREQUENCY DOMAIN before
filtring');
xlabel('Frequency(hz)');
ylabel('Amplitude');
axis([-50 50 0 1]);
hold on

Output Results:

Hlp=1./sqrt(1+(1.25*f./fc).^(2
*100));
subplot(2,1,2);
plot(f,Hlp,'red');
title(' Frequency response of
low pass filter');
xlabel('Frequency(hz)');
ylabel('Amplitude');
axis([-50 50 0 5]);
E1=Hlp.*S1;

figure(4)
subplot(2,1,1);
plot(f,E1);
title(' Recover signal IN
FREQUENCY DOMAIN after
filtring');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 1]);
e1=ifft(ifftshift(E1))*length(
E1);

subplot(2,1,2);

xlabel('time(sec)');
ylabel('amplitude')

plot(t,(1/0.5)*e1);
title(' Recover signal IN Time
DOMAIN after filtring');

carrier signal of 20 hz

1
amplitude

0.5
0
-0.5
-1
-1

-0.8

-0.6

-0.4

-0.2

0
0.2
0.4
time (sec)
message signal "Triangular Pulse"

0.6

0.8

-0.8

-0.6

-0.4

-0.2

0.6

0.8

0
0.2
0.4
0.6
0.8
time (sec)
AMPLITUDE MODULATION IN FREQUENCY DOMAIN

amplitude

0.5

0
-1

amplitude

1
0
-1
-2
-1

-0.8

1
amplitude

0.4

AMPLITUDE MODULATION IN TIME DOMAIN

0
0.2
time (sec)

-0.6

-0.4

-0.2

-30

-20

-10
0
10
frequency(hz)

0.5

0
-50

-40

20

30

40

50

Amplitude

Demodulated signal IN FREQUENCY DOMAIN before filtring

0.5

0
-50

-40

-30

-40

-30

-20

-10
0
10
20
Frequency(hz)
Frequency response of low pass filter

30

40

50

30

40

50

Amplitude

4
3
2
1
0
-50

amplitude

20

0.5

0
-50

-40

-30

-20

-0.8

-0.6

-0.4

1
amplitude

-10
0
10
Frequency(hz)

Recover signal IN FREQUENCY DOMAIN after filtring

-20

-10
0
10
20
30
frequency(hz)
Recover signal IN Time DOMAIN after filtring

40

50

0.8

0.9
0.8
0.7
-1

-0.2

0
0.2
time(sec)

0.4

0.6

2. When message signal is sinusoidal:

Matlab Coding:

clc;

fc=154;

clear all;
A=8;%Amplitude of signal
mi=input('Modulation Index=');
%Modulation Index
fm=fc/10;
fs=100*fc;
t=0:1/fs:5/fm;
xm=A*sin(2*pi*fm*t);
xc=A*sin(2*pi*fc*t);
figure(1)
subplot(2,1,1),plot(t,xc);
title('carrier signal of 154
hz');

xlabel('time (sec)');

xlabel('time (sec)');

ylabel('amplitude');
subplot(2,1,2),plot(t,xm);
title('message signal of 15.4
hz');
ylabel('amplitude');
% Amplitude MODULATION
z1=(A+mi*xm).*sin(2*pi*fc*t);
%AM Signal, Amplitude of
Carrier changes to (A+Message)

figure(2)

xlabel('time (sec)');

subplot(2,1,1),plot(t,z1);
title('AMPLITUDE MODULATION IN
TIME DOMAIN');
ylabel('amplitude');
l1=length(z1);
f=linspace(-fs/2,fs/2,l1);
Z1=fftshift(fft(z1,l1)/l1);
subplot(2,1,2);
plot(f,abs(Z1));

title('AMPLITUDE MODULATION IN
FREQUENCY DOMAIN');

xlabel('frequency(hz)');

ylabel('amplitude');
axis([-300 300 0 5]);

s1=z1.*(z1>0);
S1=fftshift(fft(s1,length(s1))
/length(s1));
figure(3)
subplot(2,1,1);
plot(f,abs(S1));
title('Demodulated signal IN
FREQUENCY DOMAIN before
filtring');

xlabel('Frequency(hz)');

subplot(2,1,2);

xlabel('Frequency(hz)');

ylabel('Amplitude');
axis([-300 300 0 5]);
hold on
%corret
Hlp=1./sqrt(1+(2*f./fc).^(2*10
0));
plot(f,Hlp,'red');
title(' Frequency response of
low pass filter');
ylabel('Amplitude');
axis([-300 300 0 10]);
E1=Hlp.*S1;

figure(4)
subplot(2,1,1);
plot(f,E1);

title(' Recover signal IN


FREQUENCY DOMAIN after
filtring');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-300 300 0 5]);
e1=ifft(ifftshift(E1))*length(
E1);

subplot(2,1,2);

xlabel('time(sec)');

plot(t,(1/0.5)*e1-5);
title(' Recover signal IN Time
DOMAIN after filtring');
ylabel('amplitude')
grid on;

Output Results:
carrier signal of 154 hz

amplitude

10
5
0
-5
-10

0.05

0.05

amplitude

10

0.15
0.2
0.25
time (sec)
message signal is "Sinusoidal Signal"

0.3

0.35

0.3

0.35

5
0
-5
-10

0.1

0.1

0.15
0.2
time (sec)

0.25

AMPLITUDE MODULATION IN TIME DOMAIN

amplitude

20
10
0
-10
-20

0.05

0.1

0.15
0.2
0.25
0.3
time (sec)
AMPLITUDE MODULATION IN FREQUENCY DOMAIN

0.35

-200

300

amplitude

4
3
2
1
0
-300

-100

0
frequency(hz)

100

200

Demodulated signal IN FREQUENCY DOMAIN before filtring

Amplitude

4
3
2
1
0
-300

-200

Amplitude

10

0
100
Frequency(hz)
Frequency response of low pass filter

200

300

200

300

0
-300

-100

-200

-100

0
Frequency(hz)

100

Recover signal IN FREQUENCY DOMAIN after filtring

5
amplitude

4
3
2
1
0
-300

-200

10

-100

0
100
200
frequency(hz)
Recover signal IN Time DOMAIN after filtring

300

amplitude

5
0
-5
-10

0.05

0.1

0.15
0.2
time(sec)

0.25

0.3

0.35

3. When message signal is sinusoidal:

Matlab Coding:

clc;
clear all;
A=1;%Amplitude of signal
mi=input('Modulation Index=');
%Modulation Index
w=2*pi;
fc=20;
fm=fc/10;
fs=100*fc;
t=-1:1/fs:1;
xm = sawtooth(w*t);

title('carrier signal of 20
hz');

xlabel('time (sec)');

xlabel('time (sec)');

xc=A*sin(2*pi*fc*t);
figure(1)
subplot(2,1,1),plot(t,xc);

ylabel('amplitude');
subplot(2,1,2),plot(t,xm);
title('message signal Saw
Tooth');
ylabel('amplitude');
% Amplitude MODULATION
z1=(A+mi*xm).*sin(2*pi*fc*t);
%AM Signal, Amplitude of
Carrier changes to (A+Message)
figure(2)
subplot(2,1,1),plot(t,z1);
title('AMPLITUDE MODULATION IN
TIME DOMAIN');

xlabel('time (sec)');

xlabel('frequency(hz)');

ylabel('amplitude');
l1=length(z1);
f=linspace(-fs/2,fs/2,l1);
Z1=fftshift(fft(z1,l1)/l1);
subplot(2,1,2);
plot(f,abs(Z1));
title('AMPLITUDE MODULATION IN
FREQUENCY DOMAIN');
ylabel('amplitude');
axis([-50 50 0 1]);

s1=z1.*(z1>0);
S1=fftshift(fft(s1,length(s1))
/length(s1));
figure(3)
subplot(2,1,1);
plot(f,abs(S1));
title('Demodulated signal IN
FREQUENCY DOMAIN before
filtring');
xlabel('Frequency(hz)');
ylabel('Amplitude');
axis([-50 50 0 1]);
hold on

Hlp=1./sqrt(5+(2.25*f./fc).^(2
*100));
subplot(2,1,2);
plot(f,Hlp,'red');
title(' Frequency response of
low pass filter');
xlabel('Frequency(hz)');
ylabel('Amplitude');
axis([-50 50 0 5]);
E1=Hlp.*S1;

figure(4)
subplot(2,1,1);
plot(f,E1);
title(' Recover signal IN
FREQUENCY DOMAIN after
filtring');
xlabel('frequency(hz)');
ylabel('amplitude');
axis([-50 50 0 1]);
e1=ifft(ifftshift(E1))*length(
E1);

subplot(2,1,2);

xlabel('time(sec)');

plot(t,(1/0.5)*e1);
title(' Recover signal IN Time
DOMAIN after filtring');
ylabel('amplitude')

Output Results:
carrier signal of 20 hz

amplitude

1
0.5
0
-0.5
-1
-1

-0.8

-0.6

-0.4

-0.2

-0.8

-0.6

-0.4

-0.2

amplitude

0.6

0.8

0.6

0.8

0.5
0
-0.5
-1
-1

0
0.2
0.4
time (sec)
message signal Saw Tooth

0
0.2
time (sec)

0.4

AMPLITUDE MODULATION IN TIME DOMAIN

amplitude

2
1
0
-1
-2
-1

-0.8

amplitude

-0.6

-0.4

-0.2

0
0.2
0.4
0.6
0.8
time (sec)
AMPLITUDE MODULATION IN FREQUENCY DOMAIN

-30

-20

-10
0
10
frequency(hz)

0.5

0
-50

-40

1
Amplitude

20

30

40

50

Demodulated signal IN FREQUENCY DOMAIN before filtring

0.5

0
-50

-40

-30

-40

-30

-20

-10
0
10
20
Frequency(hz)
Frequency response of low pass filter

30

40

50

30

40

50

Amplitude

4
3
2
1
0
-50

-20

-10
0
10
Frequency(hz)

20

Recover signal IN FREQUENCY DOMAIN after filtring

amplitude

0.5

0
-50

-40

-30

-20

-0.8

-0.6

-0.4

amplitude

0.8

40

50

0.8

0.6
0.4
0.2
0
-1

-10
0
10
20
30
frequency(hz)
Recover signal IN Time DOMAIN after filtring

-0.2

0
0.2
time(sec)

0.4

0.6

Das könnte Ihnen auch gefallen