You are on page 1of 7

Nama : Muhammad Abdul Hadi

NPM : 140910150019
Subj : Tugas Embedded System 3

Experiment 2

SECTION-1
% Program Exp2
% Amplitude Modulation
%

fs = input('\nSynchronous Amplitude Modulation\nType in freq of sampling in


Hertz = ');

f1 = input('Type in freq of first(information) cosine sequence in Hertz =


');
fc = input('Type in freq of carrier cosine sequence in Hertz = ');

K1 = input('Type in the first gain constant = ');


Kc = input('Type in the carrier gain constant = ');

N = input ('Type in length of sequence = ');


n = 0:N;
%x = K*exp(c*n);%Generate the sequence
xa1=K1*cos(2*pi*(n)*f1/fs);
xac=Kc*cos(2*pi*(n)*fc/fs);
xaf=xa1.*xac;
dt=1/fs;

subplot(3,2,1);
stem(n,xa1);%Plot the first cosine signal
xlabel('Time index n');ylabel('Amplitude');
title('Cosine Signal');
% pause;
% Calling the ploting of the magnitude spectrum function
subplot(3,2,2);
plot(xa1,dt);
L=length(xa1);
Nfft=round(2.^round(log2(5*L)));
Xa1=fft(xa1,Nfft);
range=0:((Nfft/2)-1);
ff=range/Nfft/dt;
% ff=(1:Nfft);
plot(ff/1000,abs(Xa1(1:Nfft/2)))
title('CONT-TIME FOURIER TRANSFORM (MAG)')
xlabel('FREQUENCY (kHz)'),grid

subplot(3,2,3);
stem(n,xac);%Plot the carrier cosine signal
xlabel('Time index n');ylabel('Amplitude');
title('Carrier Signal');
% pause;
% Calling the ploting of the magnitude spectrum function
subplot(3,2,4);
plot(xac,dt);
L=length(xac);
Nfft=round(2.^round(log2(5*L)));
Xac=fft(xac,Nfft);
range=0:((Nfft/2)-1);
ff=range/Nfft/dt;
% ff=(1:Nfft);
plot(ff/1000,abs(Xac(1:Nfft/2)))
title('CONT-TIME FOURIER TRANSFORM (MAG)')
xlabel('FREQUENCY (kHz)'),grid

subplot(3,2,5);
stem(n,xaf);%Plot the first cosine signal X carrier signal)
xlabel('Time index n');ylabel('Amplitude');
title('Modulated Signal');
% pause;
% Calling the ploting of the magnitude spectrum function
subplot(3,2,6);
plot(xaf,dt);
L=length(xaf);
Nfft=round(2.^round(log2(5*L)));
Xaf=fft(xaf,Nfft);
range=0:((Nfft/2)-1);
ff=range/Nfft/dt;
% ff=(1:Nfft);
plot(ff/1000,abs(Xaf(1:Nfft/2)))
title('CONT-TIME FOURIER TRANSFORM (MAG)')
xlabel('FREQUENCY (kHz)'),grid
Cosine Signal CONT-TIME FOURIER TRANSFORM (MAG)
Amplitude 5 1000

0 500

-5 0
0 200 400 600 0 1 2 3 4
Time index n FREQUENCY (kHz)
Carrier Signal CONT-TIME FOURIER TRANSFORM (MAG)
5 1000
Amplitude

0 500

-5 0
0 200 400 600 0 1 2 3 4
Time index n FREQUENCY (kHz)
Modulated Signal CONT-TIME FOURIER TRANSFORM (MAG)
10 2000
Amplitude

0 1000

-10 0
0 200 400 600 0 1 2 3 4
Time index n FREQUENCY (kHz)

SECTION-2
% Program Exp2a
% Amplitude Modulation
%

fs = input('\nSynchronous Amplitude Modulation\nType in freq of sampling in


Hertz = ');

f1 = input('Type in freq of first(information) cosine sequence in Hertz =


');
fc = input('Type in freq of carrier cosine sequence in Hertz = ');

K1 = input('Type in the first gain constant = ');


Kc = input('Type in the carrier gain constant = ');

N = input ('Type in length of sequence = ');


n = 0:N;
%x = K*exp(c*n);%Generate the sequence
f2 = input('Type in freq of second(information) cosine sequence in Hertz =
');
f3 = input('Type in freq of third(information) cosine sequence in Hertz =
');
K2 = input('Type in the second gain constant = ');
K3 = input('Type in the third gain constant = ');
Sc = input('Type in the shift constant = ');
xa1 = Sc + K1*cos(2*pi*n*f1/fs) + K2*cos(2*pi*n*f2/fs) +
K3*cos(2*pi*n*f3/fs);
xac=Kc*cos(2*pi*(n)*fc/fs);
xaf=xa1.*xac;
dt=1/fs;
subplot(3,2,1);
stem(n,xa1);%Plot the first cosine signal
xlabel('Time index n');ylabel('Amplitude');
title('Cosine Signal');
% pause;
% Calling the ploting of the magnitude spectrum function
subplot(3,2,2);
plot(xa1,dt);
L=length(xa1);
Nfft=round(2.^round(log2(5*L)));
Xa1=fft(xa1,Nfft);
range=0:((Nfft/2)-1);
ff=range/Nfft/dt;
% ff=(1:Nfft);
plot(ff/1000,abs(Xa1(1:Nfft/2)))
title('CONT-TIME FOURIER TRANSFORM (MAG)')
xlabel('FREQUENCY (kHz)'),grid

subplot(3,2,3);
stem(n,xac);%Plot the carrier cosine signal
xlabel('Time index n');ylabel('Amplitude');
title('Carrier Signal');
% pause;
% Calling the ploting of the magnitude spectrum function
subplot(3,2,4);
plot(xac,dt);
L=length(xac);
Nfft=round(2.^round(log2(5*L)));
Xac=fft(xac,Nfft);
range=0:((Nfft/2)-1);
ff=range/Nfft/dt;
% ff=(1:Nfft);
plot(ff/1000,abs(Xac(1:Nfft/2)))
title('CONT-TIME FOURIER TRANSFORM (MAG)')
xlabel('FREQUENCY (kHz)'),grid

subplot(3,2,5);
stem(n,xaf);%Plot the first cosine signal X carrier signal)
xlabel('Time index n');ylabel('Amplitude');
title('Modulated Signal');
% pause;
% Calling the ploting of the magnitude spectrum function
subplot(3,2,6);
plot(xaf,dt);
L=length(xaf);
Nfft=round(2.^round(log2(5*L)));
Xaf=fft(xaf,Nfft);
range=0:((Nfft/2)-1);
ff=range/Nfft/dt;
% ff=(1:Nfft);
plot(ff/1000,abs(Xaf(1:Nfft/2)))
title('CONT-TIME FOURIER TRANSFORM (MAG)')
xlabel('FREQUENCY (kHz)'),grid
Cosine Signal CONT-TIME FOURIER TRANSFORM (MAG)
15 3000
Amplitude

10 2000

5 1000

0 0
0 100 200 300 400 500 600 0 0.5 1 1.5 2 2.5 3 3.5 4
Time index n FREQUENCY (kHz)
Carrier Signal CONT-TIME FOURIER TRANSFORM (MAG)
2 600

1
Amplitude

400
0
200
-1

-2 0
0 100 200 300 400 500 600 0 0.5 1 1.5 2 2.5 3 3.5 4
Time index n FREQUENCY (kHz)
Modulated Signal CONT-TIME FOURIER TRANSFORM (MAG)
40 3000
Amplitude

20 2000

0 1000

-20 0
0 100 200 300 400 500 600 0 0.5 1 1.5 2 2.5 3 3.5 4
Time index n FREQUENCY (kHz)

Kc=40
Cosine Signal CONT-TIME FOURIER TRANSFORM (MAG)
15 3000

Amplitude
10 2000

5 1000

0 0
0 100 200 300 400 500 600 0 0.5 1 1.5 2 2.5 3 3.5 4
Time index n FREQUENCY (kHz)
Carrier Signal CONT-TIME FOURIER TRANSFORM (MAG)
40 15000

20
Amplitude

10000
0
5000
-20

-40 0
0 100 200 300 400 500 600 0 0.5 1 1.5 2 2.5 3 3.5 4
Time index n FREQUENCY (kHz)
4
Modulated Signal x 10 CONT-TIME FOURIER TRANSFORM (MAG)
500 6
Amplitude

4
0
2

-500 0
0 100 200 300 400 500 600 0 0.5 1 1.5 2 2.5 3 3.5 4
Time index n FREQUENCY (kHz)

Fc=100

Cosine Signal CONT-TIME FOURIER TRANSFORM (MAG)


15 3000
Amplitude

10 2000

5 1000

0 0
0 100 200 300 400 500 600 0 0.5 1 1.5 2 2.5 3 3.5 4
Time index n FREQUENCY (kHz)
Carrier Signal CONT-TIME FOURIER TRANSFORM (MAG)
2 600

1
Amplitude

400
0
200
-1

-2 0
0 100 200 300 400 500 600 0 0.5 1 1.5 2 2.5 3 3.5 4
Time index n FREQUENCY (kHz)
Modulated Signal CONT-TIME FOURIER TRANSFORM (MAG)
30 4000

20 3000
Amplitude

10 2000

0 1000

-10 0
0 100 200 300 400 500 600 0 0.5 1 1.5 2 2.5 3 3.5 4
Time index n FREQUENCY (kHz)
Exercise

1- Refer to the Matlab code above (Synchronous Modulation)

a) From this code

A = Em1*sin(2*pi*fm1*t) + Em2*sin(2*pi*fm2*t) + Em3*sin(2*pi*fm3*t);

m = A.*[sin(2*pi*fc*t)];

What is A, m and sin(2*pi*fc*t)]?

b) What is the frequency for all message signal?


c) What is the amplitude for carrier frequency?
d) When you change the carrier amplitude to 2 and 40. What do you see? Explain.
e) What happen when you set the carrier frequency to 100, fc=100.?

2- Why the DSB(Synchronous)-SC is consider more efficient than DSB(Asynchronous)- AM?


Jawab

1.a) A merupakan penjumlahan dari 3 messages signal


M merupakan modulasi dasi messages signal yang mengandung carrier signal
sin(2*pi*fc*t)] merupakan carrier signal
b) 100+200+300=600
c) 2- 40
d) Ketika amplitudo carrier signal diubah dari 2 menjadi 40, terjadi peningkatan pada sinyal yang
dimodulasi. Hal ini dikarenakan modulasi amplitudo adalah proses pengubahan amplitudo carrier
signal frekuensi yang relatif tinggi sebanding dengan nilai sesaat dari message signal
e) Ketika frekuensi carrier diatur ke 100, bentuk atau selubung sinyal carrier dan sinyal yang
termodulasi berbeda dari ketika frekuensi pembawa diatur ke 1000

2) Karena DSBSC menghasilkan frekuensi sum(fusb) dan difference(flsb) tetapi membatalkan


operator(fc).Akibatnya, ini membantu mengurangi total daya yang ditransmisikan yang diambil oleh
operator.

You might also like