function test_am()
% this m file demonstrate the testing of AM modulation demod signal, now i
% am going to generate m(t) signal
%santosh shah, The LNM IIT Jaipur (India)(santosh.jnt@gmail.com) 20/04/07
Fm = 500; % modulating frequency
Fc = 3000; % carrier frequency
A = 1; % amplitudeof the carrier signal
K = 1; % modulation constant
Fs = 20000; % sampling frequency
d = 2; % signal duration 2 second
% time vector
t = linspace(0, d, d*Fs + 1);
% creat the modulating signal and its modulation
m = .5*cos(2*pi*Fm*t);
s = my_ammod(m, K, A, Fc, Fs);
% plot both messege and modulate d signal
tfplot(m, Fs, 'Vm', 'messege signal');
tfplot(s, Fs, 'Vam', 'modulated signal');
% decoding of the signal and ploting
s_demod = my_amdemod(s, Fc, Fs);
tfplot(s_demod, Fs, 'Vm', 'recovered messege signal');
%close all
%distiguish the signals by playing
fprintf('Playing original signal \n');
sound(m, Fs);
fprintf('Playing recovered signal \n');
sound(s_demod, Fs);