%practical 8 am generation
%poc Amplitude modulation
%AM PRACTICAL
fc=100000;
fm=1000;
fs=1000000;
m=1.5;
A=1/m;
opt=-A;
t=0:1/fs:((2/fm)-(1/fs));
vc=cos(2*pi*fc*t);
vm=cos(2*pi*fm*t);
y=modulate(vm,fc,fs,'amdsb-tc',opt);
subplot(3,2,1);
plot(t,vm);
title('original modulating signal');
xlabel('Time');
ylabel('amplitude of original signal');
subplot(3,2,2);
plot(t,vc);
title('unmodulted carrier signal');
xlabel('Time');
ylabel('amplitude of carrier signal');
subplot(3,2,3);
plot(t,y);
%Practical 3rd FM GENERATION
%FM GENERATION PRACTICAL
clc
clear all
close all
t = 0:0.001:1; %upto 1000 samples
vm = input('Enter Amplitude (Message) = ');
vc = input('Enter Amplitude (Carrier) = ');
fM = input('Enter Message frequency = ');
fc = input('Enter Carrier frequency = ');
m = input('Enter Modulation Index = ');
msg = vm*sin(2*pi*fM*t);
subplot(3,1,1); %plotting message signal
plot(t,msg);
xlabel('Time');
ylabel('Amplitude');
title('Message ');
carrier = vc*sin(2*pi*fc*t);
subplot(3,1,2); %plotting carrier signal
plot(t,carrier);
xlabel('Time');
ylabel('Amplitude');
title('Carrier Signal');
y = vc*sin(2*pi*fc*t+m.*cos(2*pi*fM*t));
subplot(3,1,3);
%plotting FM (Frequency Modulated) signal
plot(t,y);
xlabel('Time');
ylabel('Amplitude');
title('FM Signal');