0% found this document useful (0 votes)
11 views6 pages

PCE Lab Simulations

The document contains MATLAB code for generating and plotting various signals, including AM and RF signals, as well as demonstrating the sampling theorem and delta modulation. It illustrates how to visualize continuous and discrete signals, and the effects of different sampling rates. Additionally, it provides a code implementation for delta modulation, highlighting the process of sampling and quantization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

PCE Lab Simulations

The document contains MATLAB code for generating and plotting various signals, including AM and RF signals, as well as demonstrating the sampling theorem and delta modulation. It illustrates how to visualize continuous and discrete signals, and the effects of different sampling rates. Additionally, it provides a code implementation for delta modulation, highlighting the process of sampling and quantization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

AM

close all; F
-clear all; 3LL
t-0:0.01:20;
cieaT=8;: J,

gsint2pifm}
Ifrts110* fm;
isisplot(tá);
ubplot(321)
xlabel(%(t)'
Shtitle );
(i4 E Signal!};ne
A.iplot(t,xnI);
subplot(322)
ixlabel("'time in
bylabBlisg ropds').
title('RF Signal);
AyL4.
(subplot(323)
plot(t.y);
xlabel('tine in seconds');
ylabell'AM Amplitude'); )e
ititleDSBSC signai');
z#(knt(0.5*Y))
subplot(324)
Ar Cw
plot(t,z); *
xlabel("time in seconds');
ylabel('AMAmplitude):
ititle:('AMm1 signal');
z=(xn1¥(0.99*y);
sübpldt(325) ! _inal;
plot(t,|);ARA
xlabel('tihe inseconds');
ylabel('AM Amplitudè);
title ('AM ml signal'):
(2=(xn1+(1.5*y):
subplot(326)Nsignai}
plot(t;z);1.5"vi)
xlabel('time inseconds');
ylabel('AM Amplitude'):"
signal'):s
title ('AM ms1
Qutput'
......&

-AF Signal

. 15 24
t:mensecoros
RF Signal

())x

5 10
fime in seconds 15p
.dajle.
Frequency Modulation

5
10
time in seconds 15
20,

28
The sampling theorem
The sampling
bandlimited totheorem
B Hz can
states that a continuous
be signal x(t)
X)
x(n*T), where n is an recovered from its samples x\n)=
1/(2B) without loss of integer, if T is greater than or equal to
any information. And we call 2B the
Nyquist rate.
#code for sampling theorem
cle;
t--10:.01:10;
T=4;
fm=1/T:"
x=cos(2*pi*fm*t);
subplot(2,2,1):
plot(t,x);
xlabel(time);ylabel(x()
title('continous time signal')
grid;
nl=4:1:4
fs1=1.6*fm;
fs2-2*fm:9A
fs3=8* fm;i.
xl=cos(2*pi*fm/fs 1*nl);
subplot(2,2,2);
stem(n1,xl);
xlabel('time);ylabel(x(n)) fs<2fm')
signal with
title('discrete time
hold on
subplot(2,2,2);
plot(nl,xl)
grid;
n2-5:1:5;
X2=cos(2*pi*fm/fs2 *n2);
subplot(2,2,3);
stem(n2,x2);
xlabel(' time');ylabel('x(n)')
title(discrete time signal with
hold on
fs-2fm')
subplot(2,2,3);
plot(n2,x2)
grid;
n3=-20:1:20;
X3-cos(2*pi*fm/fs3 *n3);
subplot(2,2,4);
stem(n3,x3);
xlabel(time );ylabel('x(n))
title('discrete time signal with fs>2fm')
holdon
subplot(2,2,4);
plot(n3,x3), s
grid;
Delta mnodulation using octave
Delta modulation is process. in
assigned, unlike PCM, which one bit per sample iis
Los In delta
and modulation, a continuous signal is sampled at t-n
compared against with the previous sample at t-[n-1]. The
difference (+/-) is fed to a one-bit quantizer outputting either an

#Code for DM
clc;
t-0:2*pi/100:2*pi; %time duration
x=5*sin(2*pi*tU5);
and frequency 5Hz
%define message signal with peak voltage bv
plot(x)
hold on
y=[0]; %output DM signal i.e stream of lor 0
*xr#0; %outputof integrator i.e staircase approximation; initial
value-0
del=0.4; %step size
rfor i1:length(x)-1
if xr(i)<=x(i) %if current sample less than the previous val
or outputof the integrator,output of DM=1
d=1;
xr(i+1)=xr(i)+del; %staircase approximated value
élse
d-0;
xr(i+1)=Xr(i)-del; oifcurrentsample less than the
vaBues or output ofthe integrator,output of DM-0
previous
end
Se

iacel
y-[y d];
end
staircase approximated signal
stairs(xr); %show the
holdoff
MSE=sum(X-xr).^2)/length(x) %MSE
%outputofDM

Hgure Window Help


FileEdit View Insert Tools Desktop

Figure 1 Help
Edit View Insert Tools Desktop Window
File

20 10

80 100 120
npoc't

You might also like