% Create an array of 1000 time instants, in steps of 0.001 s.
time=[0:999]*0.001;
% Create a carrier signal at frequency f
f=20; % Hz 
% Create a carrier 
carrier  = cos(2*pi*f*time);
% Modulation index
m=16*pi;
% Create a modulating signal at frequency g
g=1; % Hz 
% Create the modulating signal
modulatingsignal=sin(2*pi*g*time);
phase=-m/(2*pi*g)*cos(2*pi*g*time);
% Create the modulated signal
modulatedsignal=cos(2*pi*f.*time + phase);
% Plot the carrier, modulating signal, phase and modulated signal
subplot(4,1,1);
plot(time,carrier);
grid on;
title('Carrier');
ylabel('Amp. (V)');
subplot(4,1,2);
plot(time,modulatingsignal);
grid on;
title('Modulating Signal');
ylabel('Amp. (V)');
subplot(4,1,3);
plot(time,phase);
grid on;
title('Phase \phi(t)');
ylabel('Amp. (V)');
subplot(4,1,4);
plot(time,modulatedsignal);
grid on;
title('Modulated Signal');
xlabel('Time (s)');
ylabel('Amp. (V)');