Monday, 11 August 2014

AMPLITUDE MODULATION USING MULTIPLIERS AND SYNCHRNOUS DEMODULATION USING PHASE AND FREQUENCY OFFSET ERRORS

Task1:                                                                                                                                                                            
  Consider a single tone modulating signal m(t)= cos10^3*pi*t , and  carrier signal c(t) =cos10^4*pi*t     
      Given that  Am=1,fm=500,Ac=1,fc=5000   µ=Am/Ac =1
A.M signal in time domain description is

            
In the time domain  
   Sam(t)= cos(2 π*5000*t)+1/2[cos2 π *(4500)*t]+1/2[cos2 π*(5500)*t]
In the frequency domain
                S(f)=1/2[δ (f-5000)+ δ (f+5000)]+ 1/4 [δ (f-5500)+ δ (f+5500)]
                                                                 +  1/4 [δ (f-4500)+ δ (f+4500)]

MULTITONE SIGNLAS:
Task2:
        Let us consider a multi tone modulating signal
                                  m(t) = 2cos1000p t -sin1500p +1.5cos2000p
For the given multi tone signal Am1=2,Am2=-1,Am3=1.5 &Ac=1 for carrier signal which is used in task 1 .  
Now A.m signal in time domain & frequency domain  as shown below
In time domain
                           S(t)= cos ( 10000pt)+[cos(2 *p*4500 *t)+ cos(2 *p*5500*t) ]
                                -1/2[sin(2*p*250* t)+ sin(2*p*1250* t)]
                            +3/4[cos(2 *p*4000 *t)+ cos(2 *p*6000*t)]
In the frequency domain
S(f)=1/2[δ (f-5000)+ δ (f+5000)]+ 1/2 [δ (f-5500)+ δ (f+5500)+ δ (f-4500)+ δ +4500)]
-1/4 [δ (f-5750)+ δ (f+5750)+ δ (f-4250)+ δ(f+4250)                                                          + 3/8[δ (f-6000)+ δ (f+6000)+ δ (f-4000)+ δ (f+4000)]
 
 

 
TASK-3:
 
DEMODULATED SIGNAL:
 
 
 

 
 
 
 
PHASE DEVIATION ERRORS:        Φ=45˚,90˚,135˚
 

 
 
FREQUENCY DEVIATION ERROS: Df = 500hz,1000hz,1500hz
 

 
 
DEMODULATION WITH PHASE AND FREQUENCY ERRORS:
 

MAT LAB program:
clc;
clear all;
close all;
fc=6000;% carrier frequency
fs=50000;%sampling frequency
f=500;%tone modulation
Am=1;
Ac=1;
t=0:1/fs:((4/f)-(1/fs));
 
%Task-1--------------Modulating wave-----------------
     
M=Am.*cos(2*pi*f*t);
m1=2*cos(2*pi*500*t)-1*sin(2*pi*750*t)+1.5*cos(2*pi*1000*t);
figure(1);
subplot(3,2,1);plot(t,M,'linewidth',2);
plot(t,M);
axis([0 0.008 -1.5 1.5])
xlabel('Time (sec)');
ylabel('Amplitude');
title(['Message Signal']);
grid on;
f_M=abs((fft(M,1024)));
f_M=[f_M(514:1024) f_M(1:513)];
f=(-511*fs/1024):(fs/1024):(512*fs/1024);
subplot(3,2,2);
plot(f,f_M);
xlabel('Frequency in Hz');
ylabel('Amplitude');
title('Spectrum of Message Signal');
%----------MULTITONE SIGNAL---------%
figure(6);
subplot(3,2,1);plot(t,m1,'linewidth',2);
plot(t,m1);
axis([0 0.008 -1.5 1.5])
xlabel('Time (sec)');
ylabel('Amplitude');
title(['multitone Signal']);
grid on;
f_m1=abs((fft(m1,1024)));
f_m1=[f_m1(514:1024) f_m1(1:513)];
f=(-511*fs/1024):(fs/1024):(512*fs/1024);
subplot(3,2,2);
plot(f,f_m1);
xlabel('Frequency in Hz');
ylabel('Amplitude');
title('Spectrum of multitone Signal');
 
%---------------------------carrier wave----------------------
 
C=Ac*cos(2*pi*fc*t);
subplot(3,2,3);
plot(t,C);
xlabel('Time (sec)');
ylabel('Amplitude');
title(['Carrier Signal']);
%grid on;
f_C=abs((fft(C,1024)));
f_C=[f_C(514:1024) f_C(1:513)];
f=(-511*fs/1024):(fs/1024):(512*fs/1024);
subplot(3,2,4);
plot(f,f_C);
xlabel('Frequen;cy in Hz');
ylabel('Amplitude');
title('Spectrum of Carrier Signal');
%-------------------------------modulated wave---------------------
sam=Ac*(1+M).*cos(2*pi*fc*t);
subplot(3,2,5);
plot(t,sam);
xlabel('Time (sec)');
ylabel('Amplitude');
title('Amplitude Modulated Signal');
grid on;
f_sam=abs((fft(sam,1024)));
f_sam=[f_sam(514:1024) f_sam(1:513)];
f=(-511*fs/1024):(fs/1024):(512*fs/1024);
subplot(3,2,6);
plot(f,f_sam);
xlabel('Frequency in Hz');
ylabel('Amplitude');
title('Spectrum of Amplitude Modulated Signal');
 
 
%----------------------Demodulation signal--------------------------
 
XC1=Ac*cos(2*pi*fc*t);
demod=XC1.*sam;
figure(2);
subplot(2,2,1);
plot(t,demod,'r','linewidth',2)
xlabel('time');
ylabel('Amplitude');
title(' Amplitude demodulated Signal1');
f_demod=abs((fft(demod,1024)));
f_demod=[f_demod(514:1024) f_demod(1:513)];
f=(-511*fs/1024):(fs/1024):(512*fs/1024);
subplot(2,2,2);
plot(f,f_demod,'r','linewidth',2)
xlabel('Frequency in Hz');
ylabel('Amplitude');
title('Spectrum of Demodulated Signal1');
 
F=1000;s=15000;
x1=demod;
[b,a] = butter(3,F*2/s,'low');
y1 = filtfilt(b,a,x1);
subplot(2,2,3)
plot(t,y1,'r','linewidth',2)
title('Demodulated Signal1');
xlabel('Time');
ylabel('amplitude');
 
 
%----------------------1st phase deviation--------------
 
XC1=Ac*cos((2*pi*fc*t)+45);
demod1=XC1.*sam;
figure(3);
subplot(3,2,1);
plot(t,demod1);plot(t,demod1,'y','linewidth',2)
xlabel('time');
ylabel('Amplitude');
title('demodulated Signal1 with 45deg');
f_demod1=abs((fft(demod1,1024)));
f_demod1=[f_demod1(514:1024) f_demod1(1:513)];
f=(-511*fs/1024):(fs/1024):(512*fs/1024);
subplot(3,2,2);
plot(f,f_demod1,'y','linewidth',2)
xlabel('Frequency in Hz');
ylabel('Amplitude');
title('Spectrum of Demodulated Signal1 with 45deg');
 
 
%----------------------2nd phase deviation--------------
 
XC2=Ac*cos((2*pi*fc*t)+90);
demod2=XC2.*sam;
subplot(3,2,3);
plot(t,demod2,'y','linewidth',2)
xlabel('time');
ylabel('Amplitude');
title(' demodulated Signal2 with 90deg');
f_demod2=abs((fft(demod1,1024)));
f_demod2=[f_demod2(514:1024) f_demod2(1:513)];
f=(-511*fs/1024):(fs/1024):(512*fs/1024);
subplot(3,2,4);
plot(f,f_demod2,'y','linewidth',2)
xlabel('Frequency in Hz');
ylabel('Amplitude');
title('Spectrum of demodulated Signal2 with 90deg');
 
 
%----------------------3rd phase deviation--------------
 
XC3=Ac*cos((2*pi*fc*t)+120);
demod3=XC3.*sam;
subplot(3,2,5);
plot(t,demod3,'y','linewidth',2)
xlabel('time');
ylabel('Amplitude');
title(' demodulated Signal3 with 120deg');
f_demod3=abs((fft(demod1,1024)));
f_demod3=[f_demod3(514:1024) f_demod3(1:513)];
f=(-511*fs/1024):(fs/1024):(512*fs/1024);
subplot(3,2,6);
plot(f,f_demod3,'y','linewidth',2)
xlabel('Frequency in Hz');
ylabel('Amplitude');
title('Spectrum of demodulated Signal3 with 120deg');
 
%----------------------1st frequency deviation--------------
 
XC4=Ac*cos(2*pi*(fc+500)*t);
demod4=XC4.*sam;
figure(4);
subplot(3,2,1);
plot(t,demod4);
xlabel('time');
ylabel('Amplitude');
title(' Amplitude demodulated Signal4freq deviation 500hz');
f_demod4=abs((fft(demod4,1024)));
f_demod4=[f_demod4(514:1024) f_demod4(1:513)];
f=(-511*fs/1024):(fs/1024):(512*fs/1024);
subplot(3,2,2);
plot(f,f_demod4);
xlabel('Frequency in Hz');
ylabel('Amplitude');
title('Spectrum of demodulated Signal4 of freq deviation 500hz');
 
%----------------------2nd frequency deviation--------------
 
XC5=Ac*cos(2*pi*(fc+1000)*t);
demod5=XC5.*sam;
subplot(3,2,3);
plot(t,demod5);
xlabel('time');
ylabel('Amplitude');
title(' Amplitude demodulated Signal5 freq deviation 1000hz');
f_demod5=abs((fft(demod5,1024)));
f_demod5=[f_demod5(514:1024) f_demod5(1:513)];
f=(-511*fs/1024):(fs/1024):(512*fs/1024);
subplot(3,2,4);
plot(f,f_demod5);
xlabel('Frequency in Hz');
ylabel('Amplitude');
title('Spectrum of demodulated Signal5 freq deviation 1000hz');
 
 
 
%----------------------3rd frequency deviation--------------
XC6=Ac*cos(2*pi*(fc+1500)*t);
demod6=XC6.*sam;
subplot(3,2,5);
plot(t,demod6);
xlabel('time');
ylabel('Amplitude');
title(' Amplitude demodulated Signal6 freq deviation 1500hz');
f_demod6=abs((fft(demod6,1024)));
f_demod6=[f_demod6(514:1024) f_demod6(1:513)];
f=(-511*fs/1024):(fs/1024):(512*fs/1024);
subplot(3,2,6);
plot(f,f_demod6);
xlabel('Frequency in Hz');
ylabel('Amplitude');
title('Spectrum of demodulated Signal6 freq deviation 1500hz');
 
 
%-----------------1st phase error demodulation using filter-------------
F=1000;s=15000;
x1=demod1;
[b,a] = butter(3,F*2/s,'low');
y1 = filtfilt(b,a,x1);
figure(5);
subplot(3,2,1)
plot(t,y1)
title('Demodulated Signal1 with phase deviaton 45degrees');
xlabel('Time');
ylabel('amplitude');
 
%-----------------2nd phase error demodulation using filter-------------
 
x2=demod2;
[b,a] = butter(3,F*2/s,'low');
y2 = filtfilt(b,a,x2);
subplot(3,2,2)
plot(t,y2)
title('Demodulated Signal2 with phase deviaton 90degrees');
xlabel('Time'); ylabel('amplitude');
%-----------------3rd phase error demodulation using filter-------------
 
x3=demod3;
[b,a] = butter(3,F*2/s,'low');
y3 = filtfilt(b,a,x3);
subplot(3,2,3)
plot(t,y3)
title('Demodulated Signal3 with phase deviaton 120degrees');
xlabel('Time'); ylabel('amplitude');
 
%---------------frequency error demodulation using filter-------
x6=demod6;
axis([0 0.005 -1 1])
[b,a] = butter(3,F*2/s,'low');
y6 = filtfilt(b,a,x6);
subplot(3,2,6);
plot(t,y6);
title('Demodulated Signal1 with freq deviation 500hz');
xlabel('Time'); ylabel('amplitude');
 
x5=demod5;
[b,a] = butter(3,F*2/s,'low');
y5 = filtfilt(b,a,x6);
subplot(3,2,5);
plot(t,y5);
title('Demodulated Signal with freq deviation 1000hz');
xlabel('Time'); ylabel('amplitude');
 
x4=demod4;
[b,a] = butter(3,F*2/s,'low');
y4 = filtfilt(b,a,x4);
subplot(3,2,4);
plot(t,y4);
title('Demodulated Signal with freq deviation 1500hz');
xlabel('Time'); ylabel('amplitude');