Академический Документы
Профессиональный Документы
Культура Документы
K L University ECE 1
Department of Computer Science & Engineering
K.L. UNIVERSITY
__________________________________________________________________
CERTIFICATE
This is to certify that this project based lab report entitled “ADC
and DAC with squaring of signals” is a bonafide work done by K.SAI
KRISHNA 150040356, K. SARATH KUMAR 150040370 and K.
DURGA BHAVANI 150040369 in partial fulfilment of the
requirement for the award of degree in Bachelor of Technology in
Electronics and Communication Engineering during the academic year
2016-2017.
I also declare that this project based lab report is of our own
effort and it has not been submitted to any other university for the
award of any degree.
K L University ECE 2
ACKNOWLEDGMENT
My sincere thanks to in the Lab for their outstanding support throughout the
Computer Science & Engineering for providing us with adequate facilities, ways
and means by which we are able to complete this project based work.
We would like to place on record the deep sense of gratitude to the honourable
Vice Chancellor, K L University for providing the necessary facilities to carry the
Last but not the least, we thank all Teaching and Non-Teaching Staff of our
department and especially my classmates and my friends for their support in the
Place: KL University
Date:
K L University ECE 3
CONTENTS
Content Page No
Abstract 5
List of Figures 29
References 30
K L University ECE 4
ABSTRACT
Objectives:
(b) To investigate the phase and frequency deviations (offset errors) in the
Task1: Consider a single tone modulating signal m(t ) cos1000t , and carrier
signal with frequency of 5000 Hz.
K L University ECE 5
6. Determine the maximum and minimum amplitudes of the envelope.
7. Find the powers of USB, LSB, total sideband and modulated waves.
m(t ) 2 cos1000t sin1500t + 1.5cos 2000t and repeat the steps (1) to
(7) above from the Task1 .
Task 3: Assume that the demodulation process is shown in Fig.1. The objective is
to study the effect of phase and frequency offset errors in demodulation of DSB-
SC wave. Now consider a single tone case.
1. The phase angle , denoting the phase difference between c (t ) and m(t ) at
time t= 0, is variable. Derive the expression for the demodulated wave and sketch
for the following values of 0o , 45o ,90o and 135o . Comment on the results.
1. INTRODUCTION
K L University ECE 6
Double-sideband suppressed-carrier transmission (DSB-SC)
is transmission in which frequencies produced by amplitude modulation (AM) are
symmetrically spaced above and below the carrier frequency and the carrier level
is reduced to the lowest practical level, ideally being completely suppressed.
K L University ECE 7
The aim of digital modulation is to transfer a digital bit stream over an analog
bandpass channel, for example over the public switched telephone network (where
a bandpass filter limits the frequency range to 300–3400 Hz) or over a limited
radio frequency band.
Demodulation was first used in radio receivers. In the wireless telegraphy radio
systems used during the first 3 decades of radio (1884-1914) the transmitter did
not communicate audio (sound) but transmitted information in the form of pulses
of radio waves that represented text messages in Morse code. Therefore, the
receiver merely had to detect the presence or absence of the radio signal, and
produce a click sound. The device that did this was called a detector. The first
detectors were coherers, simple devices that acted as a switch. The term detector
stuck, was used for other types of demodulators and continues to be used to the
present day for a demodulator in a radio receiver.
The first type of modulation used to transmit sound over radio waves was
amplitude modulation (AM), invented by Reginald Fessendon around 1900. An
AM radio signal can be demodulated by rectifying it, removing the radio
frequency pulses on one side of the carrier, converting it from alternating current
(AC) to a pulsating direct current (DC). The amplitude of the DC varies with the
modulating audio signal, so it can drive an earphone. Fessendon invented the first
AM demodulator in 1904 called the electrolytic detector, consisting of a short
needle dipping into a cup of dilute acid. The same year John Ambrose Fleming
invented the Fleming valve or thermionic diode which could also rectify an AM
signal.
K L University ECE 8
Task 1: Consider a single tone modulating signal m(t ) cos1000t , and carrier
signal with frequency of 5000 Hz.
Code:
clear all;close all;clc;
t=-10:0.00001:10;
x=cos(1000*pi*t);
y=cos(pi*2*5000*t);
r=x.*y;
figure();
subplot(3,1,1);
plot(t,x,'r','LineWidth',1.5);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);ylabel('Amplitude ----->','FontSize',14);
title('C.T. Sinusoidal signal cos(1000*pi*t) ','FontSize',14);
axis([-0.03, 0.03,-2.15,2.15]);grid on
subplot(3,1,2);
plot(t,y,'m','LineWidth',1.5);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);ylabel('Amplitude ----->','FontSize',14);
title('C.T. Sinusoidal signal cos(10000*pi*t) ','FontSize',14);
axis([-.003, .003,-2.15, 2.15]);grid on
subplot(3,1,3)
plot(t,r,'b','LineWidth',1.5);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);ylabel('Amplitude ----->','FontSize',14);
title('C.T. Sinusoidal signal r ','FontSize',14);
axis([-0.03, 0.03,-2.15, 2.15]);grid on
K L University ECE 9
0
C.T. Sinusoidal signal cos(1000*pi*t)
2
Amplitude ----->
-2
-0.03 -0.02 -0.01 0 0.01 0.02 0.03
time ----->
C.T. Sinusoidal signal cos(10000*pi*t)
2
Amplitude ----->
-2
-3 -2 -1 0 1 2 3
time -----> -3
x 10
C.T. Sinusoidal signal r
2
Amplitude ----->
-2
-0.03 -0.02 -0.01 0 0.01 0.02 0.03
time ----->
K L University ECE 10
grid on;
500 Hz Sinusoidal signal
1
Amplitude 0.5
-0.5
-1
-5 -4 -3 -2 -1 0 1 2 3 4 5
Time (seconds) -3
x 10
Magnitude Spectrum
1
Magnitude|
0.5
2
Phase angle
-2
-4
-800 -600 -400 -200 0 200 400 600 800
frequency
freq = fs * (0 : N/2) / N;
close all;
figure(2)
subplot(221);
plot(10*t(1:200),sbu(1:200),'r');%Time Domain Plot of USB DSB
title('Time Domain Representation === USB');
xlabel('Time'); ylabel('Modulated Signal');
subplot(222)
plot(10*t(1:200),sbl(1:200),'b');%Time Domain Plot of LSB DSB
title('Time Domain Representation === LSB');
K L University ECE 11
xlabel('Time'); ylabel('Modulated Signal');
subplot(223);
plot(freq,SBU(1:N/2+1))
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('USB');
subplot(224)
plot(freq,SBL(1:N/2+1)); %Frequency domain plot
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('LSB');
figure(4)
plot(freq,SBU(1:N/2+1),freq,SBL(1:N/2+1));
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('USB','LSB');
%%%Demodulation:
md=sbu.*cos(2*pi*fc*t);
[b,a]=butter(2,0.1);
mf=filter(b,a,md);
figure(3)
plot(t,mf)
title('Demodulated Signal');
xlabel('Time'); ylabel('Demodulated Signal');
figure(1);
plot(t,m);
title('Time Domain Representation of Orignal Signal');
xlabel('Time'); ylabel('Original Signal');
Time Domain Representation === USB Time Domain Representation === LSB
M odulated S ignal
M odulated S ignal
2 2
1 1
0 0
-1 -1
-2 -2
0 0.5 1 0 0.5 1
Time Time
S pectral M agnitude
S pectral M agnitude
0 0
0 500 1000 1500 0 500 1000 1500
Frequency(Hz) Frequency(Hz)
K L University ECE 12
Frequency Domain Representation
2.5
USB
LSB
2
Spectral Magnitude
1.5
0.5
0
0 200 400 600 800 1000 1200
Frequency(Hz)
Demodulated Signal
0.3
0.25
0.2
Demodulated Signal
0.15
0.1
0.05
-0.05
-0.1
-0.15
-0.2
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Time
K L University ECE 13
Time Domain Representation of Orignal Signal
1
0.8
0.6
0.4
Original Signal
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Time
K L University ECE 14
y=abs(a);
sig_f=abs(fft(y(1:N)',N));
sig_n=sig_f/(norm(sig_f));
freq_s=(0:N-1)/Ts;
z1=sbl;
a1=hilbert(z1);
y1=abs(a1);
sig_f1=abs(fft(y1(1:N)',N));
sig_n1=sig_f1/(norm(sig_f1));
freq_s=(0:N-1)/Ts;
figure()
subplot(2,2,1);
plot(freq_s(2:250),sig_n(2:250));
title('Envelope Detection: USB');
subplot(2,2,2);
plot(freq_s(2:250), sig_f(2:250));
title('max value of USB');
subplot(2,2,3);
plot(freq_s(2:250),sig_n1(2:250));
title('Envelope Detection : LSB');
subplot(2,2,4);
plot(freq_s(2:250), sig_f1(2:250));
title('max value of LSB');
-5
x 10 Envelope Detection : USB max value of USB
9 0.95
0.9
8.5
0.85
8
0.8
7.5
0.75
7 0.7
0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8
6 6
x 10 x 10
-15 -11
x 10 Envelope Detection : LSB x 10 max value of LSB
8 8
6 6
4 4
2 2
0 0
0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8
6 6
x 10 x 10
K L University ECE 15
fs=30000;%Sample frequency
N=5000;%Number of samples
Ts=1/fs; % Sampling interval
t = (-N/2:1:(N/2)-1)*Ts;
fm=500
%%% Signal generation
m = cos(2*pi*fm*t);
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
M = (2/N)*fftshift(fft(m));
fc=5000
%%% Signal generation
c = cos(2*pi*fc*t);
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
C = (2/N)*fftshift(fft(c));
m1=sin(2*pi*fm*t);
c1=sin(2*pi*fc*t);
s=m.*c+m1.*c1;
S = (2/N)*fftshift(fft(s));
%Expression for USB DSB
sbu = m.*2.*cos(2*pi*fc*t) -m1.*2.*sin(2*pi*fc*t);
%Expression for LSB DSB
sbl = m.*2.*cos(2*pi*fc*t) + m1.*2.*sin(2*pi*fc*t);
DBU = 2/N*abs(fft(sbu)); %Fourier Transform of USB DSB
DBL = 2/N*abs(fft(sbl)); %Fourier Transform of LSB DSB
P_S= (norm(S)^2)/length(S)
P_USB = (norm(DBU)^2)/length(DBU)
P_LSB = (norm(DBL)^2)/length(DBL)
K L University ECE 16
Task 2: : Now consider a multi tone modulating signal
m(t ) 2 cos1000t sin1500t + 1.5cos 2000t and repeat the steps (1) to
(7) above from the Task1 .
Code:
clear all;close all;clc;
t=-10:0.0001:10;
x=2*cos(1000*pi*t)-sin(1500*pi*t)+1.5*cos(2000*pi*t);
y=cos(pi*2*5000*t);
r=x.*y;
figure();
subplot(3,1,1);
plot(t,x,'r','LineWidth',1.5);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);ylabel('Amplitude ----->','FontSize',14);
title('C.T. Sinusoidal signal 2*cos(1000*pi*t)-sin(1500*pi*t)+1.5*cos(2000*pi*t)
','FontSize',14);
axis([-0.03, 0.03,-2.15,2.15]);grid on
subplot(3,1,2);
plot(t,y,'m','LineWidth',1.5);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);ylabel('Amplitude ----->','FontSize',14);
title('C.T. Sinusoidal signal cos(10000*pi*t) ','FontSize',14);
axis([-0.03, 0.03,-2.15, 2.15]);grid on
subplot(3,1,3)
plot(t,r,'b','LineWidth',1.5);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);ylabel('Amplitude ----->','FontSize',14);
title('C.T. Sinusoidal signal r ','FontSize',14);
axis([-0.03, 0.03,-2.15, 2.15]);grid on
K L University ECE 17
C.T. Sinusoidal signal 2*cos(1000*pi*t)-sin(1500*pi*t)+1.5*cos(2000*pi*t)
2
Amplitude -----> 0
-2
-0.03 -0.02 -0.01 0 0.01 0.02 0.03
time ----->
C.T. Sinusoidal signal cos(10000*pi*t)
2
Amplitude ----->
-2
-0.03 -0.02 -0.01 0 0.01 0.02 0.03
time ----->
C.T. Sinusoidal signal r
2
Amplitude ----->
-2
-0.03 -0.02 -0.01 0 0.01 0.02 0.03
time ----->
K L University ECE 18
figure(2)
subplot(221);
plot(10*t(1:200),sbu(1:200),'r');%Time Domain Plot of USB DSB
title('Time Domain Representation === USB');
xlabel('Time'); ylabel('Modulated Signal');
subplot(222)
plot(10*t(1:200),sbl(1:200),'b');%Time Domain Plot of LSB DSB
title('Time Domain Representation === LSB');
xlabel('Time'); ylabel('Modulated Signal');
subplot(223);
plot(freq,SBU(1:N/2+1))
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('USB');
subplot(224)
plot(freq,SBL(1:N/2+1));%Frequency domain plot
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('LSB');
figure(4)
plot(freq,SBU(1:N/2+1),freq,SBL(1:N/2+1));
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('USB','LSB');
Time Domain Representation === USB Time Domain Representation === LSB
10 10
5 5
Modulated Signal
Modulated Signal
0 0
-5 -5
-10 -10
-0.84 -0.83 -0.82 -0.81 -0.8 -0.79 -0.78 -0.77 -0.76 -0.84 -0.83 -0.82 -0.81 -0.8 -0.79 -0.78 -0.77 -0.76
Time Time
Spectral Magnitude
2.5
2
2
1.5
1
1
0.5
0 0
0 5000 10000 15000 0 5000 10000 15000
Frequency(Hz) Frequency(Hz)
K L University ECE 19
Frequency Domain Representation
4
USB
3.5 LSB
3
Spectral Magnitude
2.5
1.5
0.5
0
0 5000 10000 15000
Frequency(Hz)
K L University ECE 20
z=sbu;
a=hilbert(z);
y=abs(a);
sig_f=abs(fft(y(1:N)',N));
sig_n=sig_f/(norm(sig_f));
freq_s=(0:N-1)/Ts;
z1=sbl;
a1=hilbert(z1);
y1=abs(a1);
sig_f1=abs(fft(y1(1:N)',N));
sig_n1=sig_f1/(norm(sig_f1));
freq_s=(0:N-1)/Ts;
figure()
subplot(2,1,1);
plot(freq_s(2:250),sig_n(2:250));title('Envelope Detection: USB');
subplot(2,1,2);
plot(freq_s(2:250),sig_n1(2:250));title('Envelope Detection: LSB');
0.15
0.1
0.05
0
0 1 2 3 4 5 6 7 8
6
x 10
Envelope Detection : LSB
0.2
0.15
0.1
0.05
0
0 1 2 3 4 5 6 7 8
6
x 10
K L University ECE 21
N = 1024;
fs = 2048;
ts = 1/fs;
%t = (0:ts:1);
t=(0:N-1)/fs;
fc = 5000; %Carrier frequency !! Limit fc<800 to avoid freqdomain aliasing
fm1 =500;
Em1 = 1;
figure(4)
plot(freq,SBU(1:N/2+1),freq,SBL(1:N/2+1));
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('USB','LSB');
%%%Demodulation:
md=sbu.*cos(2*pi*fc*t);
[b,a]=butter(2,0.1);
mf=filter(b,a,md);
K L University ECE 22
figure(3)
plot(t,mf)
title('Demodulated Signal');
xlabel('Time'); ylabel('Demodulated Signal');
figure(1);
plot(t,m);
title('Time Domain Representation of Orignal Signal');
xlabel('Time'); ylabel('Original Signal');
Time Domain Representation === USB Time Domain Representation === LSB
10 10
Modulated Signal
Modulated Signal
5 5
0 0
-5 -5
-10 -10
0 0.5 1 0 0.5 1
Time Time
Frequency Domain Representation Frequency Domain Representation
3 4
Spectral Magnitude
Spectral Magnitude
USB LSB
3
2
2
1
1
0 0
0 500 1000 1500 0 500 1000 1500
Frequency(Hz) Frequency(Hz)
K L University ECE 23
Frequency Domain Representation
3.5
USB
LSB
3
2.5
Spectral Magnitude
1.5
0.5
0
0 200 400 600 800 1000 1200
Frequency(Hz)
Demodulated Signal
0.7
0.6
0.5
0.4
Demodulated Signal
0.3
0.2
0.1
-0.1
-0.2
-0.3
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Time
K L University ECE 24
Time Domain Representation of Orignal Signal
4
2
Original Signal
-1
-2
-3
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Time
Calculate Power
clear all; close all; clc;
fs=30000;%Sample frequency
N=5000;%Number of samples
Ts=1/fs; % Sampling
t = (-N/2:1:(N/2)-1)*Ts;
fm=500
%%% Signal generation
m = 2*(cos(1000*pi*t)) -sin(1500*pi*t)+ 1.5*(cos(2000*pi*t));
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
M = (2/N)*fftshift(fft(m));
fc=5000
c = cos(2*pi*fc*t); %%% Signal generation
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
C = (2/N)*fftshift(fft(c));
m1=sin(2*pi*fm*t);
c1=sin(2*pi*fc*t);
s=m.*c+m1.*c1;
S = (2/N)*fftshift(fft(s));
%Expression for USB DSB
sbu = m.*2.*cos(2*pi*fc*t) -m1.*2.*sin(2*pi*fc*t);
K L University ECE 25
%Expression for LSB DSB
sbl = m.*2.*cos(2*pi*fc*t) + m1.*2.*sin(2*pi*fc*t);
DBU = 2/N*abs(fft(sbu)); %Fourier Transform of USB DSB
DBL = 2/N*abs(fft(sbl)); %Fourier Transform of LSB DSB
P_S= (norm(S)^2)/length(S)
P_USB = (norm(DBU)^2)/length(DBU)
P_LSB = (norm(DBL)^2)/length(DBL)
Task 3: Assume that the demodulation process is shown in Fig.1. The objective
is to study the effect of phase and frequency offset errors in demodulation of
DSB-SC wave. Now consider a single tone case.
1. The phase angle , denoting the phase difference between c (t ) and m(t ) at
time t= 0, is variable. Derive the expression for the demodulated wave and
sketch for the following values of 0o , 45o ,90o and 135o . Comment on the
results.
K L University ECE 26
Code:
K L University ECE 27
subplot(3,2,4);
plot(t,mf2);
title('Demodulated Signal phi=pi/4=45');
xlabel('Time'); ylabel('Demodulated Signal');
subplot(3,2,5);
plot(t,mf3);
title('Demodulated Signal phi=pi/2=90');
xlabel('Time'); ylabel('Demodulated Signal');
subplot(3,2,6);
plot(t,mf4);
title('Demodulated Signal phi=3*pi/4=135');
xlabel('Time'); ylabel('Demodulated Signal');
-1
-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1
Time
Demodulated Signal phi=0 Demodulated Signal phi=pi/4=45
Demodulated Signal
Demodulated Signal
1 1
0
0
-1
-2 -1
-0.1 -0.05 0 0.05 0.1 -0.1 -0.05 0 0.05 0.1
Demodulated Signal phi=pi/2=90 Demodulated Signal phi=3*pi/4=135
Time Time
Demodulated Signal
Demodulated Signal
1 1
0 0
-1 -1
-0.1 -0.05 0 0.05 0.1 -0.1 -0.05 0 0.05 0.1
Time Time
K L University ECE 28
clear all; close all; clc;
fs=30000;%Sample frequency
N=5000;%Number of samples
Ts=1/fs; % Sampling interval
t = (-N/2:1:(N/2)-1)*Ts;
fm=500;
m = cos(2*pi*fm*t); %%% Signal generation
%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
M = (2/N)*fftshift(fft(m));
fc=5000;
%%% Signal generation
c = cos(2*pi*fc*t);
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
C = (2/N)*fftshift(fft(c));
m1=sin(2*pi*fm*t);
c1=sin(2*pi*fc*t);
s=m.*c;
K L University ECE 29
title('Demodulated Signal fc=100');
xlabel('Time'); ylabel('Demodulated Signal');
subplot(3,2,5);
plot(t,mf3);
title('Demodulated Signal fc=300');
xlabel('Time'); ylabel('Demodulated Signal');
subplot(3,2,6);
plot(t,mf4);
title('Demodulated Signal fc=500');
xlabel('Time'); ylabel('Demodulated Signal');
-1
-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1
Time
Demodulated Signal fc=50 Demodulated Signal fc=100
2 2
Demodulated Signal
Demodulated Signal
0 0
-2 -2
-0.1 -0.05 0 0.05 0.1 -0.1 -0.05 0 0.05 0.1
Demodulated Signal fc=300 Demodulated Signal fc=500
Time Time
2 1.5
Demodulated Signal
Demodulated Signal
1
0
0.5
-2 0
-0.1 -0.05 0 0.05 0.1 -0.1 -0.05 0 0.05 0.1
Time Time
K L University ECE 30
Task4: Repeat the above tasks for an analog signal xa(t) = 2sin 200π t-
1.2cos800πt for the sampling frequencies (i) Fs =600Hz (ii) Fs =1200Hz.
Code:
This project concludes that the output signal does not vary weather we apply the
Fast Fourier transformation to the input signals, and convolute them or weather if
we convolute the signals and then apply Fast Fourier transformation to the signal
obtained.
LIST OF FIGURES
S. No Figure No Page No
1 2.1 9
2 2.2 13
3 2.3 14
4 2.4 18
5 2.5 18
6 2.6 24
7 2.7 25
8 2.8 25
9 2.9 28
10 2.3.0 28
K L University ECE 31
REFERENCES
1.http://ocw.usu.edu/Communication_Systems_I/sampling_sinusoids.pdf
2. www.mathworks.com/
3. “Digital Signal Processing System Level Design using Lab VIEW”, Elsevier.
4. Alan V. Oppenheium, Alan S. Willsky and Ian T. Young, ‘Signals and Systems’,
Prentice hall of India Private Limited, 1994.
5. Andreas Antonious, “Digital Signal Processing, Signals, Systems and Filters”
Mc-Graw Hill,
K L University ECE 32