%Modulation AM-DBAP (amdsb-tc) :
%1. Le signal modulé y(t) pour m = 0.5 :
fc = 100 ;
fs = 1000 ;
f1 = 10 ;
t = 0 : 1/fs : 1 ;
x = cos(2 * pi * f1 * t);
subplot(3,2,1)
plot(t,x);
title('Le signal message en AM-DBAP pour m = 0.5')
;
xlabel('t en seconde') ;
ylabel('Amplitude') ;
m = 0.5 ;
K = 1/m ;
y = ammod(x, fc, fs, K);
subplot(3,2,3)
plot(t,y) ;
title('Le signal modulé'' en AM-DBAP pour m =
0.5') ;
xlabel('t en seconde') ;
ylabel('Amplitude') ;
%2. Le spectre du signal modulé en AM-DBAP :
X = fft(x);
subplot(3,2,2)
plot(x,X);
xlabel('La frequence en Hertz') ;
ylabel('Amplitude') ;
title('Le spectre du signal message en AM-DBAP
pour m=0.5')
Y = fft(y);
N = length(Y );
k = 1 : 1 : N/2 ;
P0 = abs(Y (1)/N);
P = 2 * abs(Y (k + 1)/N);
subplot(3,2,4)
%plot(y,Y) ;
plot(0,P0,k*fs/N,P) ;
xlabel('La frequence en Hertz') ;
ylabel('Amplitude') ;
title('Le spectre du signal modulé'' en AM-DBAP
pour m=0.5')
%3. Le signal demodulé z(t) pour m = 0.5 :
z = amdemod(y, fc, fs, K);
subplot(3,2,5)
plot(t,z) ;
title('Le signal demodulé'' en AM-DBAP pour m =
0.5') ;
xlabel('t en seconde') ;
ylabel('Amplitude') ;
%4. Le spectre du signal demodulé en AM-DBAP :
Z = fft(z);
subplot(3,2,6)
plot(z,Z);
xlabel('La frequence en Hertz') ;
ylabel('Amplitude') ;
title('Le spectre du signal demodulé'' en AM-DBAP
pour m=0.5')
% AM Modulation and Demodulation using Functions in
MATLAB
% Modulation index
h = input('Modulation index = ');
% Time Pereiod of Simulation :
t = linspace(0, 0.2, 100000);
% Message Signal :
Am = 10;
fm = 200;
ym = Am*cos(2*pi*fm*t);
figure;
subplot(4, 1, 1);
plot(t(1:10000), ym(1:10000));
title('Message Signal');
xlabel('time(t)');
ylabel('Amplitude');
% Carrier Signal :
Ac = Am/h;
fc = 2000;
yc = Ac*cos(2*pi*fc*t);
subplot(4, 1, 2);
plot(t(1:10000), yc(1:10000));
title('Carrier Signal');
xlabel('time(t)');
ylabel('Amplitude');
% Modulated Signal :
y = ammod(ym, fc, 100000, 0, Ac);
subplot(4, 1, 3);
plot(t(1:10000), y(1:10000));
title('Modulated Signal');
xlabel('time(t)');
ylabel('Amplitude');
% Demodulated Signal :
z = amdemod(y, fc, 100000, 0, Ac);
subplot(4, 1, 4);
plot(t(1:10000), z(1:10000));
title('Demodulated Signal');
xlabel('time(t)');
ylabel('Amplitude');
ylim([-10, 10]);
%% FM Modulation and Demodulation
Fs = 8000; % smapling frequency
Fc = 100; % carrier frequency
t = linspace(0, 1, 10000);
x = sin(2 * pi * 10 * t); % message signal
dev = 50; % frequency deviation
y = fmmod(x, Fc, Fs, dev); % modulation
z = fmdemod(y, Fc, Fs, dev); % demodulation
%% Message signal plot
subplot(4, 1, 1);
plot(t, x);
xlabel('time(sec)')
ylabel('Amplitude(V)')
title('MODULATING SIGNAL')
%% Carrier signal plot
subplot(4, 1, 2);
plot(t, sin(2 * pi * Fc * t));
xlabel('time(sec)')
ylabel('Amplitude(V)')
title('CARRIER SIGNAL')
%% Modulated signal plot
subplot(4, 1, 3);
plot(t, y);
xlabel('time(sec)')
ylabel('Amplitude(V)')
title('FREQUENCY MODULATED SIGNAL')
%% Demodulated signal plot
subplot(4, 1, 4);
plot(t, z);
xlabel('time(sec)')
ylabel('Amplitude(V)')
title('DEMODULATED SIGNAL')
%Question 5
clear all
close all
t = 0:0.01:1; % time variable
fc = 5; % carrier frequency
%------------------------------------------
% create message signal m(t)
m = sin(2*pi*t);
%------------------------------------------
kp = pi/2; % phase deviation
constant
%------------------------------------------------
% modulating the carrier with the message signal
carrier = cos(2*pi*fc*t);
modulated = cos(2*pi*fc*t + kp*m);
%------------------------------------------------
%------------------------------------------------
% Plotting the signals
plot(t,m,'b',t,carrier,'r',t,modulated,'k--')
axis([0 1 -1.5 1.5]);
xlabel('Time(seconds)');
ylabel('Amplitude(volt)');
title('Phase modulation');
legend('Message','Carrier','Modulated');