Phase Locked Loop IV-Analog Communication-Matlab Codes, Exercises of Analog Communication

This is code in MATLAB. Its soution to lab assignment by Sir Bhanuprasad Venkatesan at Shree Ram Swarup College of Engineering and Management for Analog Communication course. It includes: Phase, Locked, Loop, Amplitude, Frequency, Shift, LPF, VCO, Filter, Cutoff, Input

Typology: Exercises

2011/2012

Uploaded on 07/30/2012

gajkaraan
gajkaraan 🇮🇳

4.6

(16)

45 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
% Phase Locked Loop:
% Input Arguments:
t=0:0.002:2;
A = 10; % Amplitude of Message Signal
wm = 2*pi*30; % Frequency of message signal
fs = 500; % Corresponding Sampling frequency
oi = pi/2; % phase shift in input
filter_order = 70; % filter order of LPF
wcut = (2*10)/(fs); % Cutoff frequency of LPF
wc = 2*pi*30; % Free Running frequency of VCO
e0 = 10 ; % Initialization for loop with a random
value
c = 1; % Constant multiple of e0
B = 10; % Amplitude of the signal generated by
VCO
k = 1;
% Working:
% u --->(x)---->[ H(s) ]---+--> y
% | |
% ------[ VCO ]<-----
% H(s) = Low Pass loop filter
% VCO = Voltage Controlled Oscillator
% (x) = A multiplier working as a phase detector
% Input Signal:
u=A*sin(wm*t);
w=-250:(2*250)/1000:250;
U=fftshift(abs(fft(u)));
figure, plot(t(1:20),u(1:20)), title('Message
Signal'),xlabel('time'),ylabel('Amplitude')
figure, plot(w(501:1001),U(501:1001)), title('Spectrum of Message
Signal'),xlabel('frequency (Hz)'),ylabel('Amplitude')
a = length(u);
for k=1:5
% VCO:
wt = wc*t(c*(e0));
v = B*cos(wt);
o(k) = oi-(c*e0);
% Multiplier:
m0 = u.*v;
% Low Pass Filter:
Filter = fir1(filter_order,wcut,'low');
Filter_fourier = fftshift(abs(fft(Filter,a)));
% Applying on Multiplied Result:
docsity.com
pf2

Partial preview of the text

Download Phase Locked Loop IV-Analog Communication-Matlab Codes and more Exercises Analog Communication in PDF only on Docsity!

% Phase Locked Loop:

% Input Arguments: t=0:0.002:2; A = 10; % Amplitude of Message Signal wm = 2pi30; % Frequency of message signal fs = 500; % Corresponding Sampling frequency oi = pi/2; % phase shift in input filter_order = 70; % filter order of LPF wcut = (210)/(fs); % Cutoff frequency of LPF wc = 2pi*30; % Free Running frequency of VCO e0 = 10 ; % Initialization for loop with a random value c = 1; % Constant multiple of e B = 10; % Amplitude of the signal generated by VCO k = 1;

% Working:

% u --->(x)---->[ H(s) ]---+--> y % | | % ------[ VCO ]<-----

% H(s) = Low Pass loop filter % VCO = Voltage Controlled Oscillator % (x) = A multiplier working as a phase detector

% Input Signal: u=Asin(wmt);

w=-250:(2*250)/1000:250; U=fftshift(abs(fft(u)));

figure, plot(t(1:20),u(1:20)), title('Message Signal'),xlabel('time'),ylabel('Amplitude') figure, plot(w(501:1001),U(501:1001)), title('Spectrum of Message Signal'),xlabel('frequency (Hz)'),ylabel('Amplitude')

a = length(u);

for k=1: % VCO: wt = wct(c(e0)); v = Bcos(wt); o(k) = oi-(ce0); % Multiplier: m0 = u.*v;

% Low Pass Filter: Filter = fir1(filter_order,wcut,'low'); Filter_fourier = fftshift(abs(fft(Filter,a)));

% Applying on Multiplied Result:

docsity.com

M0 = fftshift(abs(fft(m0))); E0 = M0.Filter_fourier; e0 = ifft(ifftshift(E0)); y(k)= max(e0); e0=y(k); % y(k) = ((AB)/2)*sin(o(k)); e0=y(k); end

% figure, plot(t(1:100),v(1:100)), title('Signal Generated by VCO'),xlabel('time'),ylabel('Amplitude') % figure, plot(t(1:100),m0(1:100)), title('Multiplier Result'),xlabel('time'),ylabel('Amplitude') % figure, plot(w(501:1001),Filter_fourier(501:1001)), title('Frequency Responce of LPF'),xlabel('frequency (Hz)'),ylabel('Amplitude') % figure, plot(w(501:1001),E0(501:1001)), title('Frequency Responce eo(t)'),xlabel('frequency (Hz)'),ylabel('Amplitude') figure, plot(o,y), title('output e0(t)'),xlabel('thetae'),ylabel('Amplitude')

docsity.com