RACTICAL NO 3

AIM: Implementation of Data decoding techniques for various formats using matlab/Simulink. SOFTWARE USED: MATLAB MATLAB CODE: function [Ur Pr Br Mr Sr]=nrzRx(U,P,B,M,S) % 'a' is input data sequence % U = Unipolar, P=Polar, B=Bipolar, M=Mark and S=Space %Wave formatting %Unipolar U=[1 0 0 1 1] Ur=U; P=[1 -1 -1 1 1]; n= length(P); %POLAR Pr=P; l=find(Pr<0); Pr(l)=0 %Bipolar B=[ 1 0 0 -1 1] n= length(B); Br=B; l=find(Br<0); Br(l)=1; %Mark M=[1 0 0 0 1 0] n= length(M); for k=1:n-1; Mr(k)=xor(M(k), M(k+1)); end %Space S=[ 1 1 0 1 1] n= length(S); S(1)=1; for k=1:n-1 Sr(k)=not(xor(S(k), S(k+1))); end %Plotting Waves n= length(Ur); subplot(5, 1, 1); stairs(Ur) axis([1 n+2 -2 2]) title('Unipolar NRZ Decoded' ) gridon n= length(P); subplot(5, 1, 2); stairs(P) axis([1 n+2 -2 2]) title('Polar NRZ Decoded' ) gridon n= length(Br); subplot(5, 1, 3); stairs(B) axis([1 n+2 -2 2])

stairs(S) axis([1 n+2 -2 2]) title('NRZ-Space Decoded' ) gridon OUTPUT: - . 4). 5).title('Bipolar NRZ Decoded' ) gridon n= length(Mr). subplot(5. 1. 1. subplot(5. stairs(M) axis([1 n+2 -2 2]) title('NRZ-Mark Decoded' ) gridon n= length(Sr).

xlabel('time in secs' ). ylabel('amplitude in volts' ).RACTICAL NO 4 AIM: Implementation of amplitude shift keying modulator and demodulator using matlab/Simulink. a=length (s). title('ASK') gridon. . s= [1 0 1 0]. end end plot(x). clearall.i). for t=(i-1)*100+1:i*100 x(t)=sin(2*pi*f*t/1000). closeall. for i=1:a f=f1*s (1. f1=20. SOFTWARE USED: MATLAB MATLAB CODE: clc.

OUTPUT: - .

ylabel('Amplitude --->').2.2) plot(sig4). xlabel('Time--->').1) plot(sig3). for i=1:l1 % Making Both row vector to a matrix sig(1. xlabel('Time--->'). end % display of demultiplexed signal figure subplot(2.2*l1). title('Recovered Sinusoidal Signal' ).i). subplot(2. ylabel('Amplitude --->').1. xlabel('Time--->').i)=sig2(i).1. end % TDM of both quantize signal tdmsig=reshape(sig. sig4(i)=demux(2.i). ylabel('Amplitude --->'). stem(sig2).i)=sig1(i).4).1. for i=1:l1 % Converting The matrix into row vectors sig3(i)=demux(1. % Display of TDM Signal figure stem(tdmsig).RACTICAL NO 5 AIM: Implementation of Time Division Multiplexing system using matlab/Simulink SOFTWARE USED: MATLAB MATLAB CODE: title('Sampled Sinusoidal Signal' ). subplot(2. ylabel('Amplitude --->'). xlabel('Time--->').2. title('TDM Signal' ). sig(2. xlabel('Time--->'). % Demultiplexing of TDM Signal demux=reshape(tdmsig.l1). l1=length(sig1). title('Sampled Triangular Signal' ). . l2=length(sig2). title('Recovered Triangular Signal' ). ylabel('Amplitude --->').

H_lpf(Lfft /2-BW:Lfft/2+BW -1)=1.Lfft)).ts).td. 'Linewidth' . Fmax=1/(2*td).td. clf.*H_lpf. SQH2=fftshift(fft(sqh_out2. sfig2=plot(t. %Bandwidth is no larger than 10Hz.RACTICAL NO 6 AIM: Implementation of pulse code modulation and demodulation using matlab/Simulink.sampled. 'b'). % obtaind the signal which is % .t.2). 'k'. % Now use LPF to filter the two PCM signal BW=10. Lfft=2^ceil(log2( Lsig)+1). %n1hz +3 hzsinusoidals Lsig=length(xsig). Faxis=linspace( -Fmax.andzero_order hold signal sqh_out % plot the original signal and the PCM signal in time domain subplot(212).)' ).4. title('Signal { \it g}({{\it t}) and its 16 level PCM signal' ) xlabel('time(sec.sampled. set(sfig1.002. H_lpf=zeros(1. figure(1). % send the signal through a 16 -level uniform quantiser [s_out. Nfact=ts/td.sqh_out1(1:Lsig).].ts). 'Linewidth' . % new sampling rate =50 hz ts=0. Xsig=fftshift(fft(xsig. 'k'. % original sampling rate rate 500 hz t=[0:td:1.16. 'b'). sfig1=plot(t.sqh_out1.02. clear.Fmax. SQH1=fftshift(fft(sqh_out1.Fmax. Faxis=linspace( -Fmax. %time interval of 1 sec xsig=sin(2*pi*t) -sin(6*pi*t). subplot(211). % send the signal through a 16 -level unifromquantiser [s_out. % obtained the PCM signal which is % .xsig.Lfft)).Lfft). title('Signal { \it g}({\it t}) and its 4 level PCM signal' ) xlabel('time(sec.)' ).sq_out.Delta.sq_out.and zero -order hold signal sqh_out % plot the original signal and PCM signal in time domain figrue(1). .quantiser. %ideal LPF S1_recv=SQH1.sqh_out2(1:Lsig). Fmax=1/(2*td).Lfft).2).quantiser. td=0. Lfft=2^ceil(log2(Lsig)+1). s_recv1=real(ifft(fftshift(S1_recv))).Delta.sqh_out2. set(sfig2.SQNR]=sampandquant(xsig.SQRN]=sampandquant(xsig.Lfft).xsig.t.Lfft)). SOFTWARE USED: MATLAB MATLAB CODE: clc.

s_recv1.)' ). subplot(212).2). sfig3=plot(t. 'Linewidth' .s_recv2(1:Lsig). s_recv2=real(ifft(fftshift(S2_recv))). title('signal{\it g}({it t}) and filtered 4 -level PCM signal' ) xlabel('time(sec.'). legend('original' .*H_lpf.t. 'b-. legend('original' .'recovered' ) set(sfig1.t. s_recv2=s_recv2(1:Lsig).xsig. subplot(211). % plot the filtered signal against the original sig nal figure(2).'recovered' ) set(sfig3.)' ).xsig. sfig4=plot(t.2).s_recv1=s_recv1(1:Lsig). 'b'). S2_recv=SQH2. 'Linewidth' . 'b-'. title('signal{\it g}({it t}) and filtered 16 -level PCM signal' ) xlabel('time(sec. 'b-'. .

PRADEEP REDDY .LAB FILE UNIFIED ELECTRONICS LAB-V (ECE.)-ECE RA67E3A31 7060070003 SUBMITTED TO: MR. TECH (HONS.407) SUBMITTED BY: DEVASISH SAIKIA B.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.