Sie sind auf Seite 1von 8

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])

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

OUTPUT: -

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

OUTPUT: -

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

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

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

LAB FILE UNIFIED ELECTRONICS LAB-V (ECE- 407)

SUBMITTED BY: DEVASISH SAIKIA B. TECH (HONS.)-ECE RA67E3A31 7060070003

SUBMITTED TO: MR. PRADEEP REDDY

Das könnte Ihnen auch gefallen