Vous êtes sur la page 1sur 8

MATLAB Project

Dr. ALI BAYDOUN


By: Soleiman
Sabra(72214)
Haydar Jaber(75399)
TDM
Time-division multiplexing (TDM) is a
method of putting multiple data
streams in a single signal by
separating the signal into many
segments, each having a very short
duration. Each individual data stream
is reassembled at the receiving end
based on the timing.
clc;
close all;
clear all;
% Signal generation
fs =1000;
f1=50;
f2=100;
N=100;
n=0:N-1;
signal1=sin(2*pi*f1*n/fs);
signal2=cos(2*pi*f2*n/fs);

% Display of Both Signals


subplot(2,2,1);
plot(signal1);
title('signal 1');
ylabel('Amplitude');
xlabel('Time');
subplot(2,2,2);
plot(signal2);
title('signal 2');
ylabel('Amplitude');
xlabel('Time');

% Display of Both Sampled Signals


subplot(2,2,3);
stem(signal1);
title('Sampled Signal 1');
ylabel('Amplitude');
xlabel('Time');
subplot(2,2,4);
stem(signal2);
title('Sampled signal 2');
ylabel('Amplitude');
xlabel('Time');

l1=length(signal1);
l2=length(signal2);
for i=1:l1
signal(1,i)=signal1(i);
% Making Both row vector to a matrix
signal(2,i)=signal2(i);
end

% TDM of both quantize signal


tdmsignal=reshape(signal,1,2*l1);
% Display of TDM Signal
figure
stem(tdmsignal);
title('TDM Signal');
ylabel('Amplitude');
xlabel('Time');

% Demultiplexing of TDM Signal


demux=reshape(tdmsignal,2,l1);
for i=1:l1
signal3(i)=demux(1,i);
% Converting The matrix into row vectors
signal4(i)=demux(2,i);
end

% display of demultiplexed signal


figure
subplot(2,1,1)
plot(signal3);
title('Signal1');
ylabel('Amplitude');
xlabel('Time');
subplot(2,1,2)
plot(signal4);
title('Signal2');
ylabel('Amplitude');
xlabel('Time');
Fig 1

Fig 2
Fig 3
first we generate two signals signal1 and
signal2 , and we display these signals in a
figure where we add the sampled signals also
( figure with 2 rows , 2 columns).
Second we name l1 and l2 as the length of
signal 1 and signal2 , to make a for loop
where I changes from 1 to l1 ( or l2 because
of same length) and we make a matrix of 2
rows and i columns , in order to reshape
them by a reshape function which mix the
rows of one matrix in a matrix of the same
row ...ex:

(12345
67890)
==>
(1627384950)
them we draw the tdm signal .
after that we reshape the given matrix to
demultiplex the signal by reshape function ,
where we put the reshape as 2 rows and l1
columns in order to ave the 2 matrices we
had at first, and be for loop we take signal 1
and signal 2 from the reshaped matrix , at
last we draw the 2 demultiplexed signals.

Vous aimerez peut-être aussi