0% found this document useful (0 votes)
22 views9 pages

Communication Matlab Project

Matlab Project

Uploaded by

tedytedros708
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views9 pages

Communication Matlab Project

Matlab Project

Uploaded by

tedytedros708
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

UNIVERSITY OF GONDAR

INSTITUTE OF TECHNOLOGY
DEPARTMENT OF ELECTRICAL ENGINEERING
INTRODUCTION TO COMMUNICATION
GROUP ASSIGNMENT

GROUP MEMBER
1 Tedros Zeleke.........................22997/13
2 Kalkidan Nibret.......................40109/13
3 Thomas Ibrahim......................40912/13
4 Werku Sisay…………………………..40478/13

Submission Date:27/07/2016 E.C


Submitted to: Habte Aregawi
1. In this computer experiment, you will simulate the modulation and demodulation of an AM
wave.
A. Develop a Matlab script to simulate the modulation of a 20kHz carrier with a 0.4 kHz
modulating wave. Use a modulation index of 50 percent and a sampling rate of 160 kHz.

% Script for AM modulation and demodulation simulation

% Parameters
fc = 20e3; % Carrier frequency (Hz)
fm = 400; % Modulating wave frequency (Hz)
mu = 0.5; % Modulation index
fs = 160e3; % Sampling rate (Hz)

% Generate time vector


t = [0:1/fs:0.01]';
% Generate carrier and message signals
Carrier = cos(2*pi*fc*t);
message = cos(2*pi*fm*t);

% Modulate the carrier with the message


modulated_signal = carrier .* (1 + mu*message);

% Envelope detector parameters


rf = 25;
C = 1e-6;
Rs = 75;
Rl = 10e3;
% a) Calculate charging time constant
tau_charge = rf*C;
% Period of modulating wave
T_mod = 1/fm;
% Comment on tracking the envelope
fprintf('Charging time constant (tau_charge): %.2f us\n', tau_charge*1e6);
fprintf('Modulating wave period (T_mod): %.2f ms\n', T_mod*1e3);
fprintf('The charging time constant is much smaller than the modulating wave
period. This allows the capacitor to follow the envelope variations effectively.\n\
n');

% b) Calculate discharge time constant


tau_discharge = (rf + Rs) * C;

% Period of carrier wave


T_carrier = 1/fc;
% Voltage decay during one sample period (approximate)
decay_fraction = exp(-t(2)/tau_discharge);
% Comment on decay
fprintf('Discharge time constant (tau_discharge): %.2f us\n', tau_discharge*1e6);
fprintf('Carrier wave period (T_carrier): %.2f us\n', T_carrier*1e6);
fprintf('Voltage decay during one sample period: %.2f%%\n',
decay_fraction*100);
fprintf('The voltage decay during one sample period is very small due to the high
sampling rate compared to the carrier frequency.\n\n');
% c) Sampled model of envelope detector
Vc = zeros(length(modulated_signal), 1);
for i = 2:length(modulated_signal)
if modulated_signal(i) > Vc(i-1)
Vc(i) = modulated_signal(i);
else
Vc(i) = Vc(i-1) - 0.023 * Vc(i-1); % Adjust coefficient for better fit
end
end
% Apply RC filter with 1ms time constant
tau_filter = 1e-3;
alpha = exp(-1/tau_filter*fs);
filtered_output = zeros(length(Vc), 1);
filtered_output(1) = Vc(1);
for i = 2:length(filtered_output)
filtered_output(i) = alpha*filtered_output(i-1) + (1-alpha)*Vc(i);
end
% Plot results
figure(1);
subplot(3,1,1);
plot(t, carrier);
title('Carrier Signal');
subplot(3,1,2);
plot(t, modulated_signal);
title('Modulated Signal');
subplot(3,1,3);
plot(t, filtered_output);
title('Envelope Detected and Filtered Output');

% Comments on results
fprintf('The envelope detector recovers the envelope of the modulated signal
with some distortion. The RC filter further smooths the envelope, removing high-
frequency components.\n');

B. An envelope detector is assumed to have a forward resistance 𝑟𝑓 = 25Ω rf of 25omega


and a capacitance of 0.01𝜇. The source resistance is 75Ω and the load resistance is 10 𝑘Ω.
I. What is the charging time constant? Compare this time constant to one
period of the modulating wave, and comment on how well it should track the
envelope.
The charging time constant is= (rf +Rs)C= 1 μs
The period of the carrier wave is 1/fc = 50 μs.
The period of the modulating wave is 1/fm = 0.025 s.
∴The time constant is much shorter than the modulating wave and
therefore should track the message signal very well.
II. What is the capacitor discharge time constant? Compare this to one period of
the carrier wave. Using a linear approximation, what fraction of the capacitor
voltage decays during one sample period?
The discharge time constant is:=R1*C= 100μs
This is twice the period of the carrier wave, and should provide some
smoothing capability.
From a maximum voltage of V0, the voltage Vc across the capacitor after
time t = Ts is:
Vc =Vo*exp(1-Ts/R1C)
Using a Taylor series expansion and retaining only the linear terms, will result in
the linear approximation of
Vc=Vo(1-Ts/R1C)
Using this approximation, the voltage will decay by a factor of 0.94 from its initial
value after a period of Ts seconds.
III. Based on these results, justify the following sampled model of an envelope
detector.
Vc = 0; % initial capacitor voltage
for i =2: length(s)
if s(i)>Vc(i-1) % diode
Vc(i) = s(i);
else % diode off
Vc(i) = Vc(i) – 0.023* Vc(i-1);
end
End
From the code, it can be seen that the voltage decay is close to this figure.
However, it is somewhat slower than what was calculated using the linear
approximation. In a real circuit, it would also be expected that the decay
would be slower, as the voltage does not simply turn off, but rather decreases
over time.
C. The output of the envelope detector is applied to a unit-gain RC filter with time constant
1ms. Develop a discrete-time truncated impulse response model of this filter. Apply this
filter model to the envelope detector output. Comment on the results

The output of a high-pass RC circuit can be described according to:


Vo(t)=I(t)R
Qc(t)=C(Vin(t)-Vo(t)
I(t)=dQc(t)
Dt
Vo(t)=RC(dVin(t)-dVo(t))
dt dt
Using first order differences to approximate the derivatives results in the following
difference equation:

Vo(t)= RC Vo(t-1) + RC(Vin(t)-Vin(t-1))


RC+Ts RC+Ts
The high-pass filter applied to the envelope detector eliminates the DC component.
2.
A. For modulation indices of 1, 2, 5, and 10 determine the power in the harmonics of the
modulating frequency about the carrier (ignore side lobes). How many side-frequencies are
required for 90% of the power in each case?

(a)The Bessel coefficients can be used to determine the power in the carrier and any side
frequency:

 PC is the power in the unmodulated carrier.


 PT is the total power and is by definition equal to the unmodulated carrier power.

For modulation index :

 m=1 ,Power (P1 )=(0.44)2 +(0.11)2 +(0.02)2 =0.2061


 m=2 , Power (P2)=(0.58)2 +(0.35)2 +(0.13)2+(0.03)2 =0.4767
 m=5 ,
Power (P5)=(0.33)2 +(0.05)2 +(0.36)2 +(0.39)2 +(0.26)2 +(0.13)2+(0.05)2+(0.02)2 =0.728
 m=10

Power (P10 )=(0.04)2 +(0.25)2 +(0.06)2 +(0.39)2 +(-0.22)2 +(-0.23)2+(-


0.01)2+(0.22)2+(0.32)2 +(0.29)2 +(0.21)2+(0.12)2+(0.06)2+(0.03)2+(0.01)2 =0. 6192

Modula Sideband amplitude


tion
index Carri 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
er

0.00 1.00

0.1
0.25 0.98
2

0.2 0.0
0.5 0.94
4 3

0.4 0.1 0.0


1.0 0.77
4 1 2

0.5 0.2 0.0 0.0


1.5 0.51
6 3 6 1

0.5 0.3 0.1 0.0


2.0 0.22
8 5 3 3

0.5 0.4 0.2 0.0 0.0


2.41 0
2 3 0 6 2

−0.0 0.5 0.4 0.2 0.0 0.0 0.0


2.5
5 0 5 2 7 2 1

−0.2 0.3 0.4 0.3 0.1 0.0 0.0


3.0
6 4 9 1 3 4 1

−0.4 −0. 0.3 0.4 0.2 0.1 0.0 0.0


4.0
0 07 6 3 8 3 5 2

−0.1 −0. 0.0 0.3 0.3 0.2 0.1 0.0 0.


5.0
8 33 5 6 9 6 3 5 02

−0. −0. 0.2 0.4 0.3 0.1 0.0 0. 0.


5.53 0
34 13 5 0 2 9 9 03 01

−0. −0. 0.1 0.3 0.3 0.2 0.1 0. 0.


6.0 0.15
28 24 1 6 6 5 3 06 02

0.0 −0. −0. 0.1 0.3 0.3 0.2 0. 0. 0.


7.0 0.30
0 30 17 6 5 4 3 13 06 02
0.2 −0. −0. −0. 0.1 0.3 0.3 0. 0. 0. 0.
8.0 0.17
3 11 29 10 9 4 2 22 13 06 03

0.2 0.0 −0. −0. 0.0 0.2 0.3 0. 0. 0. 0. 0.


8.65 0
7 6 24 23 3 6 4 28 18 10 05 02

−0.0 0.2 0.1 −0. −0. −0. 0.2 0.3 0. 0. 0. 0. 0. 0.


9.0
9 5 4 18 27 06 0 3 31 21 12 06 03 01

−0.2 0.0 0.2 0.0 −0. −0. −0. 0.2 0. 0. 0. 0. 0. 0. 0.


10.0
5 4 5 6 22 23 01 2 32 29 21 12 06 03 01

0.
−0. −0. 0.2 0.1 −0. −0. −0. 0. 0. 0. 0. 0. 0. 0. 0.
12.0 0.05 01
22 08 0 8 07 24 17 05 23 30 27 20 12 07 03

Modulation index (m) =

So for m=90%=0.9 which provides =0.9

Carson's Bandwidth (W)=2(0.9+1)=3.8=4

 So number of side bands=4


B. From the above table the carrier frequency will be reduced zero for a minimum
modulation index 2.41 .

You might also like