Академический Документы
Профессиональный Документы
Культура Документы
PERCOBAAN 1
clc
close all;
clear all;
t=0:0.0001:1;
fm=10;
am=5;
fc=100;
ac=5;
m=am.*cos(2*pi*fm*t);
c=cos(2*pi*fc*t);
x=m.*c;
mod=x+(ac.*c);
%plot
subplot(4,1,1),plot(t,m);
xlabel('time');
ylabel('amplitude');
legend('message signal m(t)');
title('message');
subplot(4,1,2),plot(t,c);
xlabel('time');
ylabel('amplitude');
legend('carrier signal c(t)');
title('carrier');
subplot(4,1,3),plot(t,mod);
xlabel('time');
ylabel('amplitude');
legend('amplitude modulate signal s(t)');
title('mod');
%fm signal
b=(fc-fm)/fm;
modfm=ac.*cos(2*pi*fc.*t+sin(2*pi*fm.*t));
subplot(4,1,4)
plot(t,modfm);
xlabel('time---(sec)');
ylabel('amp');
legend('frequency modulate signal s(t)');
title('FM signal')
message signal m(t)
0
-5
am plitude
message
0.1
0.2
0.3
0.4
0.6
0.7
0.8
0.9
0.1
0.2
0.3
0.4
10
am plitude
0.5
time
carrier
0.5
time
mod
0.6
0.7
0.8
0.9
0.1
0.2
0.3
0.4
am p
0.5
time
FM signal
0.6
0.7
0.8
0.9
0.1
0.2
0.3
0.4
0.5
time---(s ec)
0.6
0.7
0.8
0.9
PERCOBAAN 2
%prepare to sample a signal for two seconds,
%at a rate of 100 samples per second.
fs=100;%sampling rate
t=[0:2*fs+1]'/fs;%time points for sampling
%create the signal, a sum of sinusoids.
x=sin(2*pi*t)+sin(4*pi*t);
fc=10;%carrier frequency in modulation
phasedev=pi/2;%phase deviation for phase modulation
y=pmmod(x,fc,fs,phasedev);%modulate.
y=awgn(y,10,'measured',103);%add noise.
z=pmdemod(y,fc,fs,phasedev);%demodulate.
%plot the original and recovered signals.
figure;plot(t,x,'k-',t,z,'g-');
legend('original signal','recovered signal');
%prepare to sample a signal for two seconds,
%at a rate of 100 samples per second.
fs=100;%sampling rate
t=[0:2*fs+1]'/fs;%time points for sampling
%create the signal, a sum of sinusoids.
x=sin(2*pi*t)+sin(4*pi*t);
fc=10;%carrier frequency in modulation
phasedev=pi/2;%phase deviation for phase modulation
y=pmmod(x,fc,fs,phasedev);%modulate.
y=awgn(y,10,'measured',103);%add noise.
z=pmdemod(y,fc,fs,phasedev);%demodulate.
%plot the original and recovered signals.
figure;plot(t,x,'k-',t,z,'g-');
legend('original signal','recovered signal');
2
original signal
recovered signal
1.5
1
0.5
0
-0.5
-1
-1.5
-2
0.5
1.5
2.5