0% found this document useful (0 votes)
50 views4 pages

SCILAB

The document covers amplitude modulation, frequency modulation, and their respective demodulation processes, including the generation of modulating and carrier signals. It also illustrates Pulse Code Modulation (PCM), unipolar NRZ, and polar NRZ line coding techniques, along with time division multiplexing and demultiplexing of signals. Various signal plots are generated to visualize the message signals, modulated signals, and their frequency spectrums.

Uploaded by

shashankcm0313
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)
50 views4 pages

SCILAB

The document covers amplitude modulation, frequency modulation, and their respective demodulation processes, including the generation of modulating and carrier signals. It also illustrates Pulse Code Modulation (PCM), unipolar NRZ, and polar NRZ line coding techniques, along with time division multiplexing and demultiplexing of signals. Various signal plots are generated to visualize the message signals, modulated signals, and their frequency spectrums.

Uploaded by

shashankcm0313
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/ 4

Amplitude modulation and frequency modulation and

demodulation demodulation
clc; clc;
clear; clear;
clf ; clf ;
modulating signal generation modulating signal generation
Am = 2; Am = 2;
fm = 0.3; fm = 0.3;
t=0:0.01:20; t=0:0.01:20;
ym = Am*cos(2*%pi*fm*t); ym = Am*cos(2*%pi*fm*t);
subplot(4, 1, 1); subplot(4, 1, 1);
plot(t, ym); plot(t, ym);
title('Message Signal'); title('Message Signal');
xlabel('time(t)'); xlabel('time(t)');
ylabel('Amplitude'); ylabel('Amplitude');
Carrier Signal generation frequency spectrum of modulating signal
Ac = 4; yms=fft shift(fft(ym));
fc = fm*10; N=length(yms);
yc = Ac*cos(2*%pi*fc*t); n=-(N-1)/2: (N-1)/2 ;
subplot(4, 1, 2); ymf=sqrt(yms.*conj(yms));
plot(t, yc); subplot(4, 1, 2);
title('Carrier Signal'); plot(n, ymf);
xlabel('time(t)'); title(' frequency spectrum of Message
ylabel('Amplitude'); Signal');
amplitude Modulated Signal : xlabel(' frequency ');
yam = [AC + AM * cos(2*%pi*fm*t) ylabel(' Amplitude ');
*cos(2*%pi*fc*t) ] ; Carrier Signal generation
subplot(4, 1, 3); Ac = 4;
plot(t,yam); fc = fm*10;
title('Modulated Signal'); yc = Ac*cos(2*%pi*fc*t);
xlabel('time(t)'); subplot(4, 1, 3);
ylabel('Amplitude'); plot(t, yc);
Demodulated Signal : title('Carrier Signal');
Yam demod= yam.*yc ; xlabel('time(t)');
K=abs(fft(yam demod)) ; ylabel(' Amplitude ');
P=length(t); frequency spectrum of Carrier Signal
Filt=[ones(1,4*fm),1,zeros(1,P-4*fm)] ; ycs=fft shift(fft(yc));
Out=K.*filt ; N=length(ycs);
subplot(4, 1, 4); n=-(N-1)/2: (N-1)/2 ;
plot(t,ifft(out)) ; ycf=sqrt(ycs.*conj(ycs));
title('Demodulated Signal'); subplot(4, 1, 4);
xlabel('time(t)'); plot(n, ycf);
ylabel('Amplitude'); title('frequency spectrum of Carrier Signal’);
xlabel(' frequency '); Gaussian distribution
ylabel(' Amplitude '); mu = 0;
frequency Modulated Signal : sigma = 1;
m=5; x = linspace(mu-4*sigma ,mu+4*sigma,
yfm = [sin(2*%pi*fc*t) + 1000);
(m.*-cos(2*%pi*fm*t)) ] ; pdf = (1 / (sigma * sqrt(2 *% pi)))
subplot(4, 1, 5); * exp(-0.5(x - mu) / (sigma).^2));
plot(t,yfm); Scf(0) ;
FM signal spectrum plot(x, pdf);
yfms=fft shift(fft(yfm)); title('Gaussian Distribution PDF');
N=length(yfms); xlabel('x');
n=-(N-1)/2: (N-1)/2 ; ylabel('PDF');
yfmf=sqrt(yfms.*conj(yfms));
subplot(4, 1, 6);
plot(n, ymf);
title(' frequency spectrum of FM Signal');
xlabel(‘frequency ');
ylabel('amplitude');
PCM Illustration: Sampling,
Quantization and Encoding
Fs = 1000;
t = 0:1/fs:1 ;
f=5 ;
x= sin(2*%pi*f*t);
quantization
L=16;
X_min=min(x);
X_max=max(x);
delta=(x_max-x_min)/(L-1);
quantized=round((x-x_min)/delta);
quantize_val=quantized*delta+x_min;
scf(0);
subplot(2,1,1);
plot(t,x,’b’);
subplot(2,1,2);
plot(t,quantized,’r--’);
legend([‘originalsignal’,’quantized signal’])
title('PCM Original signal vs quantized
Signal');
xlabel('Time (s)');
ylabel('amplitude');
Unipolar NRZ signal = [signal: -ones(Fs*T/2,1):
Data=[1 0 1 1 0 1]; ones(Fs*T/2,1)];
Fs = 1000; end
T=1; end
t=0:1/Fs :T*length(data); signal=signal(:);
signal=[ ]; plot(t(1:length(signal)).signal);
for i=1 :(length(data)) xlabel('Time (s)');
signal=[signal:data(i)*ones(Fs*T,1)]; ylabel('Amplitude');
end title(‘manchester encoding’);
signal=signal(:); unipolar RZ
plot(t(1:length(signal)).signal); Data=[1 0 1 1 0 1];
xlabel('Time (s)'); Fs = 1000;
ylabel('Amplitude'); T=1;
title('unipolar NRZ line coding'); t=0:1/Fs :T*(length(data));
polar NRZ signal=[ ];
Data=[1 0 1 1 0 1]; for i=1:(length(data))
Fs = 1000; if data(i)==1 then
T=1; bit_signal = [ones(Fs*T/2,1):
t=0:1/Fs :T*(length(data)+1); zeros (Fs*T/2,1)];
signal=[ ]; else
for i=1:(length(data)) bit_ signal = zeros (Fs*T,1);
if data(i)==1 then end
signal = [signal: ones(Fs*T,1)]; signal=[signal:bit_signal];
else end
signal = [signal: -ones(Fs*T,1)]; signal=signal(:);
end plot(t(1:length(signal)).signal);
end xlabel('Time (s)');
signal=signal(:); ylabel('Amplitude');
plot(t(1:length(signal)).signal); title(‘unipolar RZ ’);
xlabel('Time (s)');
ylabel('Amplitude');
title('polar NRZ line coding');
manchester encoding
Data=[1 0 1 1 0 1];
Fs = 1000;
T=1;
t=0:1/Fs :T*(length(data));
signal=[ ];
for i=1:(length(data))
if data(i)==1 then
signal = [signal: ones(Fs*T/2,1):
-ones (Fs*T/2,1)];
else
TIME DIVISION MULTIPLEXING AND DEMULTIPLEXING OF SIGNAL
DEMULTIPLEXING n =1
clc ; for k =1:1: length ( t )
close ; m3 ( k) = tdm ( n )
clear n = n +1;
fs =100 m4 ( k) = tdm ( n )
t =0:1/ fs :1; n = n +1;
message_1 = 2* sin (2* %pi *3* t) ; m5 ( k) = tdm ( n )
figure (1) n = n +1;
subplot (3 ,1 ,1) end
plot2d3 (t , message_1 ) figure (3)
xlabel ( ’TIME ’ ) ; subplot (3 ,1 ,1)
ylabel ( ’AMPLITUDE ’ ) plot2d3 ( m3 )
title ( ’MESSAGE SIGNAL 1’ ) ; xlabel ( ’TIME ’ ) ;
message_2 = 1* squarewave (2* %pi *3* t ) ylabel ( ’AMPLITUDE ’ )
subplot (3 ,1 ,2) title ( ’DEMUX MESSAGE SIGNAL 1’) ;
plot2d3 (t , message_2 ) subplot (3 ,1 ,2)
xlabel ( ’TIME ’ ) ; plot2d3 ( m4 )
ylabel ( ’AMPLITUDE ’ ) xlabel ( ’TIME ’ ) ;
title ( ’MESSAGE SIGNAL 2’ ) ; ylabel ( ’AMPLITUDE ’ )
message_3 = 3* cos (2* %pi *3* t) title ( ’DEMUX MESSAGE SIGNAL 2’ ) ;
subplot (3 ,1 ,3) subplot (3 ,1 ,3)
plot2d3 (t , message_3 ) plot2d3 ( m5 )
xlabel ( ’TIME ’ ) ; xlabel ( ’TIME ’ ) ;
ylabel ( ’AMPLITUDE ’ ) ylabel ( ’AMPLITUDE ’ )
title ( ’MESSAGE SIGNAL 3’ ) ; title ( ’DEMUX MESSAGE SIGNAL 3’ ) ;
MULTIPLEXED SIGNAL
tdm =0;
j =1
for i =1:3:3* length ( t )
tdm ( i ) = message_1 ( j );
i = i +1;
tdm ( i ) = message_2 ( j );
i = i +1;
tdm ( i ) = message_3 ( j );
j = j +1
end
figure (2)
subplot (2 ,1 ,1)
plot2d3 ( tdm )
xlabel ( ’TIME ’ ) ;
ylabel ( ’AMPLITUDE ’ )
title ( ’ MULTIPLEXED SIGNAL ’ ) ;

You might also like