Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

TDM

clc;
close all;
clear all;
%analog input signal
x=linspace(1,4*pi,100);
s1=sin(x);
l=length(s1);
s2=triang(l);
subplot(3,3,1);
plot(s1);
grid on;
ylabel('amplitude--->');
xlabel('time--->');
subplot(3,3,2);
plot(s2);
grid on;
ylabel('amplitude--->');
xlabel('time--->');
%discrete input signal
subplot(3,3,4);
stem(s1,'r');
grid on;
ylabel('amplitude--->');
xlabel('time--->');
subplot(3,3,5);
stem(s2,'g');
grid on;
ylabel('amplitude--->');
xlabel('time--->');
%computing mux
for i=1:l
sig(1,i)=s1(i);
sig(2,i)=s2(i);
end
tdmsig=reshape(sig,1,2*l);
subplot(3,3,[3,6,9]);
stem(tdmsig,'b');
grid on;
ylabel('amplitude--->');
xlabel('time--->');
%computing demux
demux=reshape(tdmsig,2,l);
for i=1:l
sig1(i)=demux(1,i);
sig2(i)=demux(2,i);
end
subplot(3,3,7);
plot(sig1,'g');
grid on;
ylabel('amplitude--->');
xlabel('time--->');
subplot(3,3,8);
plot(sig2,'r');
grid on;
ylabel('amplitude--->');

xlabel('time--->');

You might also like