Sei sulla pagina 1di 3

TDM

% time division mu

TDM
clc;
clear ll;
close all;
x=0:.5:4*pi;
sig1=8*sin(x);
l=length(sig1);
sig2=8*triang(l);
subplot(221)
plot(sig1);
title('Sinosoidal Signal');
ylabel('Amp---------->');
xlabel('time----------->');
subplot(222);
plot(sig2)
title('trangular Signal');
ylabel('Amp---------->');
xlabel('time----------->');
subplot(223)
stem(sig1);
title('Sinosoidal Signal');
ylabel('Amp---------->');
xlabel('time----------->');
subplot(224);
stem(sig2)
title('trangular Signal');
ylabel('Amp---------->');
xlabel('time----------->');
l1=length(sig1);
l2=length(sig2);
for i=1:l2
sig(1,i)=sig1(i);
sig(2,i)=sig2(i);
end
tdmsig=reshape(sig,1,2*l1);
figure
stem(tdmsig);
title('Tdm Signal')
ylabel('Amp---------->');
xlabel('time----------->');
demux=reshape(tdmsig,2,l2);
for i=1:l1
sig3(i)=demux(1,i);
sig4(i)=demux(2,i);
end
figure
subplot(2,1,1)
plot(sig3)
title('Recovered Sinosoidal Signal');
ylabel('Amp---------->');
xlabel('time----------->');
subplot(2,1,2);
plot(sig4);

title('Recovered Triangular Signal');


ylabel('Amp---------->');
xlabel('time----------->');

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;
% plot the signal
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--->');

Potrebbero piacerti anche