Saturday 20 February 2016

Matlab rogram for TDM

Time Division Multiplexing (TDM)

A multiplexing technique which processes information of different transmitters successively in defined time segments for transmission over one channel.
It can be of two types:
1.Asynchronous Time Division Multiplexing
2.Synchronous Time Division Multiplexing

A simple MATLAB program for TDM 

clc;
 
clearll;
 
closeall;
 
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---------->');
 

Delta Modulation using Simulink

Delta Modulation:

  1. Next form of pulse modulation.
  2. Transmits information only to indicate whether the analog signal that is being encoded goes up or goes down.
  3. The Encoder Outputs are highs or lows that “instruct” whether to go up or down, respectively.
  4. DM takes advantage of the fact that voice signals do not change abruptly.
  5. The analog signal is quantized by a one-bit ADC (a comparator implemented as a comparator). 
  6. The comparator output is converted back to an analog signal with a 1-bit DAC, and subtracted from the input after passing through an integrator.
  7. The shape of the analog signal is transmitted as follows: a "1" indicates that a positive excursion has occurred since the last sample, and a "0" indicates that a negative excursion has occurred since the last sample.


Generation of Delta modulated signal using Simulink in MATLAB





MATLAB PROGRAM FOR Delta Modulation Sine Wave

 Delta Modulation Sine Wave


 The operation of a delta modulator is to periodically sample the input message, to make a comparison of the current sample with that preceding it, and to output a single bit which indicates the sign of the difference between the two samples.


Matlab program for Delta Modulation
subplot(212)
hold on
m1=sin(2*pi*t)
plot(m1,'black')
title('sin wave')
xlabel('time')
ylabel('amplitude')
d=2*pi/100
for n=1:1:100
    if n==1
        e1(n)=m1(n)
        eq1(n)=d*sign(e1(n))
        mq1(n)=eq1(n)
    else
        e1(n)=m1(n)-mq1(n-1)
        eq1(n)=d*sign(e1(n))
        mq1(n)=mq1(n-1)+eq1(n)
    end
end
stairs(mq1,'black')
hleg=legend('original signal','stair case approximated signal')
hold off