Anda di halaman 1dari 51

Year 2012

Advanced Digital Communication

Experiment: 1 Aim: Introduction to MATLAB.


(1) Consider the two matrices: A = [6 -4; 4 20] B = [6 -13; 3.4 16] Find: (a) A+B (b) B2 (c) AB (d) BTAT (e) Replace the second column of A with that of B. MATLAB Program
clc; clear all; A=[6 -4;4 20]; B=[6 -13;3.4 16]; out11=A+B; out12=B*B; out13=A*B; out14=B'*A'; % % % % Add Matrices Matrix Square Multiply Matrices Same as Transpose of Matrices Multiplication

fprintf('\n-------------------------------------------------------------\n'); fprintf('A = \n');disp(A); fprintf('B = \n');disp(B); fprintf('A + B = \n');disp(out11); fprintf('B * B = \n');disp(out12); fprintf('A * B = \n');disp(out13); fprintf('Bt * At = \n');disp(out14); A(:,2)=B(:,2);% Replace 2nd column of A with B fprintf('New Modified Matrix A = \n');disp(A); fprintf('---------------------------------------------------------------\n');

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012 Output

Advanced Digital Communication

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

(2) Find the solution of the following set of linear algebraic equations.

MATLAB Program
clc; clear all; newA=[5 6 10;-3 0 14;0 -7 21]; % matrix A newB=[4;10;0]; % matrix B AnsX=(inv(newA))*newB; % A x = B ; x = invA B fprintf('\n-------------------------------------------------------------\n'); fprintf('\t5x + 6y + 10z = 4 ;\n\t-3x + 14z = 10 ;\n\t-7y + 21z = 0;\n'); fprintf('The Solution of this is (x,y,z) = (%f,%f,%f)\n\n',AnsX(1),AnsX(2),AnsX(3)); fprintf('---------------------------------------------------------------\n');

Output

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012 (3) Create following two arrays: (a) Array of ones with 20 elements (b) Array a[1] = 1; a[2] = 2 and a[3] to a[20] are zero . MATLAB Program

Advanced Digital Communication

Arr31=ones(1,20); % Answer(a) Arr32=[1 2 zeros(1,18)]; % Answer(b) fprintf('\n-------------------------------------------------------------\n'); fprintf('Array 1 : ');disp(Arr31); fprintf('Array 2 : ');disp(Arr32); fprintf('---------------------------------------------------------------\n');

Output

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

(4) Create two arrays indicating marks of students in two subjects. Get average vector of them. MATLAB Program
Sub1=[1 40 ; 2 63 ; 3 98 ; 4 62 ; 5 98 ; 6 34 ;7 45]; % Subject 1 mark list Sub2=[1 46 ; 2 57 ; 3 44 ; 4 47 ; 5 38 ; 6 43 ;7 37]; % Subject 2 mark list Avg=(Sub1+Sub2)/2; % Average marks of subjects fprintf('\n-------------------------------------------------------------\n'); fprintf('Subject 1 Mark List: \n\tRoll No. Marks\n');disp(Sub1); fprintf('Subject 2 Mark List: \n\tRoll No. Marks\n');disp(Sub2); fprintf('Average marks of each student\n\tRoll No. Marks\n');disp(Avg); fprintf('---------------------------------------------------------------\n');

Output

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

(5) Array A contains no. of students and array B contains the fund collected by that many number of students. Get total fund collected. (Hint: Do element-wise multiplication). MATLAB Program
Fund=[54 50 ; 48 100 ; 23 200 ; 20 250 ; 6 500 ; 2 1000]; % A Fund Matrix containing "No. of Students in 1st column" % "Fund collected by that many students" Total_Fund=0; for i=1:length(Fund) Total_Fund = Total_Fund + Fund(i,1)*Fund(i,2); end fprintf('\n-------------------------------------------------------------\n'); fprintf('Fund Array : \n\t No. Student Fund Collected\n');disp(Fund); fprintf('Total Fund Collected : \n');disp(Total_Fund); fprintf('---------------------------------------------------------------\n');

Output

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012 (6) Plot the following functions (a) (b) (c) h[n] = {1, 2, 3, 4, 5} (d) h[n] = {1, 2, 3, 4, 5}, MATLAB Program
subplot(2,2,1); x=0:0.01:2*pi; y=sin(x); plot(x,y); xlabel('x -->'); ylabel('y -->'); title('sin x'); subplot(2,2,2); x=0:0.1:10; y=(x.*x)-10.*(x)+15; plot(x,y); xlabel('x -->'); ylabel('y -->'); title('x^2 - 10x + 15'); subplot(2,2,3); x=[0 1 2 3 4]; h1=[1,2,3,4,5]; stem(x,h1); xlabel('n -->'); ylabel('Amplitude -->'); xlim([-4 5]); title('h[n]'); subplot(2,2,4); x=[-2 -1 0 1 2]; h1=[1 2 3 4 5]; stem(x,h1); xlim([-4 5]); xlabel('n -->'); ylabel('Amplitude -->'); title('h[n+2]');

Advanced Digital Communication

with n= -2 to 2.

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012 Output

Advanced Digital Communication

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012 (7) Create a script file for the following I. II.

Advanced Digital Communication

Create a column vector with 10 values of temperature in degree centigrade C Convert each of the temperature values in degree Fahrenheit using the formula:

III.

Make the final matrix with temperature values in C as the first column and in F as the second column.

MATLAB Program
TempC=(10:10:100)'; TempF=(9/5).*TempC+32; TempMat(:,1)=TempC; TempMat(:,2)=TempF; fprintf('\n-------------------------------------------------------------\n'); fprintf('Array of Temperature in Celsius : \n');disp(TempC); fprintf('Array of Temperature in Fahrenheit : \n');disp(TempF); fprintf('Array of Celsius to Fahrenheit : \n Deg.C Deg.F\n');disp(TempMat); fprintf('---------------------------------------------------------------\n');

Output

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

(8) Create a function file for the above problem (7), such that C is taken as input vector and F is an output vector. MATLAB Program
function ADC_lab_1_func(Temp_C) % This function will take Temperature value in C and % returns F as an output vector. clear RowC; clear ColC; %clc; [RowC,ColC]=size(Temp_C); Temp_F=(9/5).*Temp_C+32; for i=1:RowC for j=1:ColC if Temp_C(i,j) >= -273.15 fprintf('Temperature : %f Deg.C -> %f Deg.F\n',Temp_C(i,j),Temp_F(i,j)); else fprintf('You Entered %f Deg.C',Temp_C(i,j)); error('Temperature Must Be Greater than 0 Kelvin(-273.15 Deg.C)'); end end end

Output

Conclusions

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Experiment: 2 Aim: To generate uniform random variables. Theory: Linear Congruential Generator is a method for generating uniform distribution. All numbers from [1, modulus] are selected at random depending on multiplier and increment, since a large number is selected as modulus, it acts like pseudorandom generator. LCG is defined as the recurrence relation, X[n] = (ax[n]1 + c) mod m X[0] = 100 (seed) a = 7^5 (multiplier) c=0 (increment) m = 2^31 1 (modulus) u[n] = x[n]/m (~U[0, 1])
(1) Using LCG (Linear Congruential Generator), generate uniformly distributed random numbers in interval [a, b]. Plot Histogram and Cumulative Distribution Function of the same. Try to connect histogram with probability density function (PDF). Calculate mean and variance of generated random variable U[a, b], compare with analytical values. MATLAB Program
clc; clear all; a=7^5; c=0; m=2^31-1; x(1)=100; n=100000; % % % % % Multiplier Increment Modulus Seed No of Sample (Resolution)

%------------ Ask For Range------------A=input ('Enter Range of U[a,b]: \n a = '); B=input (' b = '); %--------------------------------------%----------- Applying LCG -------------for i=2:n x(i)=mod((a*x(i-1)+c),m); end u=(x/m)*(B-A)+A; % Scale to the given Range %-------Mean-----m=mean(u); fprintf('\nMean (From LCG) :'); disp(m);

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012
%--- Variance ---V=var(u); fprintf('\n Variance (From LCG) :'); disp(V); %----------------------------------------

Advanced Digital Communication

%----- Random Distribution Function ---uniR=rand(1,n); % find Random Distribution %-------Mean-----m=mean(uniR); meanX=m*(B-A)+A; fprintf('\n Mean (From rand() ) :'); disp(meanX); %--- Variance ---V=var(uniR); fprintf('\n Variance (From rand() ) :'); disp(V); %--------------------------------------temp=A:0.1:(B-0.1);% Calculate X axis values (10 slot in 1 increment) %---------- Histogram of LCG ----------subplot(2,2,1); N1=hist(u,(B-A)*10); % Calculate Histogram hist(u,(B-A)*10); % Show Histogram title('Histogram by LCG'); %--------------------------------------%------------- PDF of LCG -------------subplot(2,2,2); N1=(N1/n)*10; bar(temp,N1,1); N1=N1/10; title('pdf by LCG'); %---------------------------------------

%---- Histogram of Uniform Random Generator --subplot(2,2,3); N2=hist(((B-A)*uniR)+A,(B-A)*10);% Scale & calculate Histogram hist(((B-A)*uniR)+A,(B-A)*10); % Show Histogram title('Histogram by rand()'); %---------------------------------------------%------- PDF of Uniform Random Generator -----subplot(2,2,4); N2=(N2/n)*10; bar(temp,N2,1); N2=N2/10; title('pdf by rand()'); %----------------------------------------------

%-------------------- CDF---------------------figure; %----------------- CDF of LCG ----------------subplot(2,1,1);

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012
for i=2:size(N1,2) N1(i)=N1(i-1)+N1(i); end %bar(temp,N1,1); plot(temp,N1) title('CDF by LCG'); %---------------------------------------------%------- CDF of Uniform Random Generator -----subplot(2,1,2); for i=2:size(N2,2) N2(i)=N2(i-1)+N2(i); end %bar(temp,N2,1); plot(temp,N1) title('CDF by rand()'); %----------------------------------------------

Advanced Digital Communication

Output

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

(2) In the previous simulation vary the number of samples from 100 to 10000 and for various sample sizes nd out mean and variances. Comment on the results. MATLAB Program
clc; clear all; a=7^5; c=0; m=2^31-1; x(1)=100; % % % % Multiplier Increment Modulus Seed

%------------ Ask For Range------------A=input ('Enter Range of U[a,b]: \n a = '); B=input (' b = '); %--------------------------------------fprintf('\n CASE 1 (No. of Samples)n=100'); fprintf('\n------------------------------------'); %--------------------------------------------------------------% CASE 1 (n=100) %--------------------------------------------------------------n=100; % No of Sample (Resolution) %----------- Applying LCG -------------for i=2:n x(i)=mod((a*x(i-1)+c),m); end u=(x/m)*(B-A)+A; % Scale to the given Range %-------Mean-----mX=mean(u); fprintf('\n Mean (From LCG) : %f',mX); %--- Variance ---V=var(u); fprintf('\n Variance (From LCG) : %f',V); %---------------------------------------%----- Random Distribution Function ---uniR=rand(1,n); % find Random Distribution %-------Mean-----mX=mean(uniR); meanX=mX*(B-A)+A; fprintf('\n Mean (From Rand. Fn.) : %f',meanX); %--- Variance ---V=var(uniR); fprintf('\n Variance (From Rand. Fn.) : %f',V); %--------------------------------------fprintf('\n\n CASE 2 (No. of Samples)n=10000'); fprintf('\n------------------------------------'); clear x; clear u; x(1)=100; % Seed

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

%--------------------------------------------------------------% CASE 2 (n=10000) %--------------------------------------------------------------n=10000; % No of Sample (Resolution) %----------- Applying LCG -------------for i=2:n x(i)=mod((a*x(i-1)+c),m); end u=(x/m)*(B-A)+A; % Scale to the given Range %-------Mean-----mX=mean(u); fprintf('\n Mean (From LCG) : %f',mX); %--- Variance ---V=var(u); fprintf('\n Variance (From LCG) : %f',V); %---------------------------------------%----- Random Distribution Function ---uniR=rand(1,n); % find Random Distribution %-------Mean-----mX=mean(uniR); meanX=mX*(B-A)+A; fprintf('\n Mean (From Rand. Fn.) : %f', meanX); %--- Variance ---V=var(uniR); fprintf('\n Variance (From Rand. Fn.) : %f',V); %--------------------------------------fprintf('\n\n CASE 3 (No. of Samples)n=100000'); fprintf('\n------------------------------------'); clear x; clear u; x(1)=100; % Seed %--------------------------------------------------------------% CASE 3 (n=100000) %--------------------------------------------------------------n=100000; % No of Sample (Resolution) %----------- Applying LCG -------------for i=2:n x(i)=mod((a*x(i-1)+c),m); end u=(x/m)*(B-A)+A; % Scale to the given Range %-------Mean-----mX=mean(u); fprintf('\n Mean (From LCG) : %f',mX); %--- Variance ---V=var(u); fprintf('\n Variance (From LCG) : %f',V); %---------------------------------------%----- Random Distribution Function ---uniR=rand(1,n); % find Random Distribution %-------Mean-----mX=mean(uniR); meanX=mX*(B-A)+A; fprintf('\n Mean (From Rand. Fn.) : %f',meanX);

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

%--- Variance ---V=var(uniR); fprintf('\n Variance (From Rand. Fn.) : %f\n',V); %---------------------------------------

Output

Conclusion

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Experiment: 3 Aim: To show that mean is the best linear estimate for a given random variable without specified pdf. Theory: We are interested in estimating the value of an inaccessible random variable X by a
constant b so that the mean square error is minimized: ,( ) , , -

The best b is found by taking derivative with respect to b, setting this result to zero, and solving for b. The result is and the minimum mean square error is equal to ,( MATLAB Program
clc; clear all; y=input('Enter random data:');%..Crazy Data, It can be anything m=mean(y);%...................Find Mean of it a=min(y);%..... start of data range b=max(y);%..... end of data range yg = a:0.1:b;%...............Select range for Estimate %...................... Error Square Matrix defined........................ % This Matrix will contain square error for particular estimate value %(Selected from 'yg') for all elements of y. % Each row is for different elements of 'y' & % Each column is for estimate value 'yg' %.......................................................................... ersqr = ones(length(y),length(yg));

( ,

, -

, -

, ) ( ).

for j = 1 : length(y) % Do for all elements of 'y' for i = 1 : length(yg)% Do for all estimate values ersqr(j,i)=power(y(j)-yg(i),2); end end % mrow gives 'mean square error' for 'particular estimate' value (yg(i))

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012
% with all elements (True values) mrow=mean(ersqr);

Advanced Digital Communication

% Find minimum mean square error [value,index] = min(mrow); fprintf('\nThe minimum mean square error is %f for value %f',value,yg(index)); % Calculate mean square error for mean y=y-m; y=y.*y; fprintf('\nThe mean square error for is %f for mean = %f \n',mean(y),m); %plot the Square Error for estimated value plot(yg,mrow); title('Square Error for Value'); xlabel('Values'); ylabel('Square Error');

Output

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012 Conclusion

Advanced Digital Communication

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Experiment: 4 Aim: To perform 2nd order linear prediction of speech signal. Theory: Linear prediction methods are used in various signals processing e.g. speech, images, and video. A linear estimator Y of X3 in terms of several random variables is given by Y=aX1+bX2 Where, X1, X2, and X3 are zero-mean random variable. For minimum mean square error we are minimizing following expression, ) ,( This yield the unknown coefficients values, i.e. a and b. In the implementation we first performed the speech encoding with these values. Next the values proposed by Jayant & Noll are used for the encoding for a comparative analysis.
(1) For specifically calculating values of a and b a = [VAR(X2)COV(X1,X3) - COV(X1,X2)COV(X2,X3) ] / [VAR(X1)VAR(X2) - COV(X1,X2)2] b = [VAR(X1)COV(X2,X3) - COV(X1,X2)COV(X1,X3) ] / [VAR(X1)VAR(X2) - COV(X1,X2)2] MATLAB Program
clc; clear all; [song,fs]=wavread('speechS');% speechS is recorded speech n=length(song); X1=song; X2(1:n-1,1)=song(2:n,1); X2(n,1)=X2(n-1,1); X3(1:n-2,1)=song(3:n,1); X3(n-1,1)=X3(n-2,1); X3(n,1)=X3(n-1,1); VarX1=var(X1); VarX2=var(X2); CovX1X2=cov(X1,X2); CovX1X3=cov(X1,X3); CovX2X3=cov(X2,X3); a=(VarX2*CovX1X3(2)-CovX1X2(2)*CovX2X3(2))/(VarX1*VarX2-(CovX1X2(2)^2)); b=(VarX1*CovX2X3(2)-CovX1X2(2)*CovX1X3(2))/(VarX1*VarX2-(CovX1X2(2)^2));

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012
song2(1:2,1)=song(1:2,1); for i=3:n song2(i,1)=b*song(i-1,1)+a*song(i-2,1); end

Advanced Digital Communication

err=song-song2; subplot(3,1,1); plot(song); title('A Speech Signal'); subplot(3,1,2); plot(song2); title('Linearly Predicted Speech signal'); subplot(3,1,3); plot(err); title('Errors in Linearly Predicted Speech signal'); ylim([-1 1]);

Output

Linear Predicted Speech Signal using MMSE

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012 (2)We have a & b

Advanced Digital Communication

a = (p2-p12) / (1-p12) & b = p1(1-p2) / (1-p12) From Digital Coding of Waveforms: principles & application to speech & video by Nuggehally S. Jayant &Peter Noll(1984,p.263) , we take values of p1=.825 & p2=0.562 for speech signal. MATLAB Program
clc; clear all; [song,fs]=wavread('speechS'); % speechS is recorded speech r1=0.825; r2=0.562; a=(r2-(r1^2))/(1-(r1^2)); b=(r1*(1-r2))/(1-(r1^2)); len=length(song); song2(1:2,1)=song(1:2,1); for i=3:len song2(i,1)=b*song(i-1,1)+a*song(i-2,1); end err=song-song2; subplot(3,1,1); plot(song); title('A Speech Signal'); subplot(3,1,2); plot(song2); title('Linear Prediction of Speech Signal'); subplot(3,1,3); plot(err) title('Errors in predicted Speech Signal');ylim([-1 1]);

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Output

Linearly Predicted Speech Signal using the proposed values of Jayant & Noll

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012 Output

Advanced Digital Communication

Conclusion

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Experiment: 5 Aim: Analytic representation of band-pass signals. Theory: Analytic representation of signals x(t) can be obtained as, ( ) ( ) ( ) 5.1

where, ( ) is representing Hilbert Transform of x(t). The Hilbert Transform is a linear operator over the same domain defined as, ( ) ( ) , ( )( ) ( ) 5.2

where, x(f) is the Fourier transform of x(t). It can be observed from equation 5.2 that Hilbert transform provides phase shift to every frequency component of the signal leaving the amplitude response unchanged. Here equation 5.1 provides complex time domain representation of the real band pass signal. Taking Fourier transform of equation 5.1 both the sides we obtain improved signal [ ( )] ( ) , ( )( ) ( ) ( ) , ( )( ) ( ( ) ( ) ( ))

Advantage of analytic representation is with larger fc, it is used directly to calculate signal energy and filter the signal.
MATLAB Program
% Matlab program <BP2LP.m> % This program is used to represent band pass signal to its equivalent % low pass signal in frequency domain. % Or % A program for ANALYTIC REPRESENTATION of BANDPASS SIGNAL. clc; close all; clear all;

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

%-------------- Generate A signal --------------------t=-1:.001:1; f=100; %---- Sinc() is basic LP signal, Modulated with Fc=200 sinc function is all %frequency signal in specified bandwidth. %(for bandwidth -> infinity Sinc function becomes impulse function) %-------------------------------------------------------------------------s=real(sinc(2*pi*25*t).*cos(2*pi*f*t));%....input band pass signal %------------ Fig 1. Plot the Band pass Signal in Time Domain -------------figure(1); plot(t,s); title('A Band Pass Signal in time domain'); xlabel('Time -->'); ylabel('Signal Amplitude -->'); %-------------------------------------------------------------------------%------------ Fig.2 Plot The Bandpass Signal in Freq. Domain -------------Hs=spectrum.periodogram('Rectangular'); %..create a object Periodogram opts = msspectrumopts(Hs,s); %........create Options Object figure(2); opts.CenterDC = true;%................Align it to Centre msspectrum(Hs,s,opts)%................plot mean square spectrum Xlims = get(gca,'xlim');%.............get & set current plot X-limits set(gca,'xlim',Xlims,'ylim',[-120 0]) %-------------------------------------------------------------------------%------------ Fig 3. Add Hilbert Transform Signal of it to original signalsplus=real(s+(1i*hilbert((s))));%.....Produce +ve signal Hs1=spectrum.periodogram('Rectangular');%create Object of Periodogram opts1 = msspectrumopts(Hs1,splus);%...create another options object figure(3); opts1.CenterDC = true;%...............Align it to Centre msspectrum(Hs1,splus,opts1)%..........Plot mean Square Estimation Xlims1 = get(gca,'xlim');%............get & set current plot X-limits set(gca,'xlim',[0 1],'ylim',[-120 0]) %-------------------------------------------------------------------------%------------ Fig 4. Shift the signal to zero Frequency ------------------sl=real(splus.*exp((-1i)*2*(100)*pi.*t));%...Shift the frequency to zero Hs2=spectrum.periodogram('Rectangular');%create Object of Periodogram opts2 = msspectrumopts(Hs2,sl);%......create another options object figure(4); opts2.CenterDC = true;%...............Align it to Centre msspectrum(Hs2,sl,opts2)%.............Plot mean Square Estimation Xlims = get(gca,'xlim'); set(gca,'xlim',[-.2 .2],'ylim',[-120 0]) %--------------------------------------------------------------------------

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012 Output

Advanced Digital Communication

A modulated signal in time domain

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Frequency Domain Representation of the signal

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Frequency Domain Representation of the Hilbert Transform added signal

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Analytic representation of band-pass signal Conclusion

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Experiment: 6 Aim: To implement the Gram-Schmidt Procedure. Theory: we define the projection operator by

( )
where,

denotes the inner product of the vectors v and u .This operator projects the vector v orthogonally onto the line spanned by vector u. The Gram-Schmidt process then works as follows,
( ( ) ) ( )

Here the sequence u1,,uk is the required system of orthogonal vectors, and the normalized vector e1,,ek form an orthonormal set. The calculation of the sequence u1,,uk is known as Gram-Schmidt orthogonalization and the calculation of the sequence e1,,ek is known as Gram-Schmidt orthonormalization.
MATLAB Program
% This program find orthonormal basis from given Vector set in Euclidean %Space. %-------------------------------------------------------------------------clc; clear all; %---------------------- get the set of vectors ---------------------------N=input('Enter No of Vectors in vector set :'); temp=input('Enter Vector 1 :');

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

n=size(temp,2);%......Vector is in n-dimensional space Vec(N,n)=0; Vec(1,:)=temp; for i=2:N fprintf('Enter Vector %d :',i); Vec(i,:)=input(''); end %-------------------------------------------------------------------------%---------------------- Gram - Schmidt Procedure -------------------------v=Vec;%.............................Copy the vector set u(1,:)=v(1,:)/(norm(v(1,:)));%......Normalize first vector for i=2:N %.........................Outer loop for finding all basis vector sub=0;%.........................Projections ,to be subtracted for j=1:(i-1)%..................inner product with all previous vectors %....update...direction..magnitude of proj(element mul n total=dot product) sub = sub + u(j,:).*sum(v(i,:).*u(j,:)); end u(i,:)=v(i,:)-sub;%.............The normal to all previous basis u(i,:)=u(i,:)/norm(u(i,:)); end %-------------------------------------------------------------------------fprintf('\n The Orthonormal Basis vector set \n'); disp(u);

Output

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Conclusion

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Experiment: 7 Aim: To study orthogonal frequency division multiplexing (OFDM). Theory: It is a frequency-division multiplexing (FDM) scheme used as a digital multicarrier modulation method. A large number of closely spaced orthogonal sub-carrier signals are used to carry data. The data is divided into several parallel data streams or channels, one for each sub-carrier. Each sub-carrier is modulated with a conventional modulation scheme at a low symbol rate, maintaining total data rates similar to conventional single-carrier modulation schemes in the same bandwidth. In OFDM, the sub-carrier frequencies are chosen so that the sub-carriers are orthogonal to each other, meaning that cross-talk between the sub-channels is eliminated and inter-carrier guard bands are not required. This greatly simplifies the design of both the transmitter and the receiver a separate filter for each sub-channel is not required. In an OFDM scheme with N sub-carriers, available transmission bandwidth is equally divided amongst the N sub-carriers. If W Hz is the single-sided transmission bandwidth available, the bandwidth allocated to each sub-carrier and the sub carrier spacing are W/N Hz in our example. Each sub carrier, upon data modulation may often be categorized as a narrowband modulated signal but the overall OFDM signal is a wideband signal for moderate or large value of N.

(courtesy: IITK online study notes)

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

The symbol rate and the sub carrier spacing are chosen such that all the carriers are orthogonal over one OFDM symbol duration. Fig 8.1 shows three sub carriers, which are orthogonal over one symbol duration. Any combination of three frequencies which are orthogonal over T second can be taken but all the combinations are not bandwidth efficient.

Figure 8.1(courtesy: IITK online study notes) The ai-s in the diagram indicates the modulating signal in the I-path and the bi-s are the modulating signals in the Q-path. The encoder in a practical system performs several operations but is of no special significance at the moment. Let us refer a cosine carrier as an inphase carrier and a sine carrier as a quadrature-phase carrier. All the in-phase carrier modulated signals are added algebraically and similarly are the quadrature-phase modulated signals. The overall I-phase and Q-phase signals together form the complex baseband OFDM signal. Mathematically, if * ( )+ represent a sequence of N complex of N complex modulating symbols, the complex baseband modulated OFDN symbol is represented as

( )

( )
Where, 0 t T and k=0, 1,, (N-1) ( )is the k-th symbol modulating the k-th sub carrier and f0 is the inter-sub carrier

spacing.

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Further, it also implies that the OFDM modulated signal of above equation can be generated by simple Inverse Discrete Fourier Transform (IDFT) which can be implemented efficiently as an N-point Inverse Fast Fourier Transform (IFFT). If the modulated signal in time domain is uniformly sampled with an interval T/N, the nth sample of the OFDM signal is:

( )

( )

Where, 0 n (N-1) Transmitter

Similarly, at the receiving end, an N-point FFT operation does the equivalent job of demodulation of OFDM signal. This makes digital design and implementation of OFDM modulator and demodulator very convenient. However, there are several practical issues which demand proper attention. Receiver

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012 APPLICATIONS

Advanced Digital Communication

OFDM has developed into a popular scheme for wideband digital communication, whether wireless or over copper wires, used in applications such as digital television and audio broadcasting, DSL broadband internet access, wireless networks, and 4G mobile communications. REFERANCES (1) IIT Kharagpur online notes (2) Digital Communication by John G. Proakis

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Experiment: 8 Aim: To study multiple input multiple output (MIMO).


Basis of MIMO lies in using multiple antennas at receiver is standard method for achieving spatial diversity to combat fading without expanding the bandwidth of the transmitted signal. Spatial diversity can be achieved by using multiple antennas at transmitter and single receiving antenna. Multiple transmitting antennas can be used to create multiple spatial channels and provides the capability to increase the data rate of wireless communication channel. There are four major channel models used, namely Single Input Single Output , SIMO- Single Input Multiple Output, MISO- Multiple Input Single Output MIMO- Multiple Input Multiple Output. MIMO systems with NT transmit antennas and NR receiving antennas, low pass channel impulse response between jth transmit antenna and ith receive antenna is given by hij(;t). ( ) ( ) ( )

H=[

1. 2. 3. 4. 5.

It takes advantage of multipath. MIMO uses multiple antennas to send multiple parallel signals (from transmitter) In urban environment, these signals will bounce off tree, buildings etc. and continue on their way to their destination but in different directions. Multipath occurs when the different signals arrive at the receiver at various times. With MIMO, the receiving end uses an algorithm or special signal processing to sort out the multiple signals to produce one signal that has the only originally transmitted data.

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Advantages of MIMO
Maximize diversity to combat channel fading and decrease the bit error rate(BER). Maximize the throughput by spatial multiplexing 3. MIMO increases the range because each multipath or say echo signals are treated as advantage to increase range.
1. 2.

REFERANCES (1) IIT Kharagpur online notes (2) Digital Communication by John G. Proakis

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Experiment: 9 Aim: To study Spread Spectrum. Theory: A signal that occupies a bandwidth of B, is spread out to occupy a bandwidth of Bss. All signals are spread to occupy the same bandwidth Bss. Signals are spread with different codes so that they can be separated at the receivers. Signals can be spread in the frequency domain or in the time domain.

Spread spectrum. (Courtesy: MIT online study notes) In a spread spectrum system, the input signal is combine with the PN (pseudo random noise) sequence and generate a new sequence. The DSSS generator is shown below.

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

A DSSS generator

.
(Courtesy: MIT online study notes)

To achieve most of the claims made for the spread spectrum it is necessary that the bandwidth over which the message is spread be very much greater than the bandwidth of the message itself. There are two bandwidths involved here: that of the modulated signal, and the spreading sequence. The first will be very much less than the second. The output spread spectrum signal will be spread either side of the original RF carrier ( 0) by an amount equal to the bandwidth of the PN sequence. In this method the sequence generated as shown in the figure. The data will be spread by PN stream and output is generated by logical operation between this two. Then this signal is transmitted.

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

(courtesy: Wikipedia)

At the receiver side the same PN sequence is used for demodulation. Same operation is done between received signal and PN sequence. So original signal is reproduced. The DSSS demodulator is shown in Figure 3.

A DSSS demodulator

(courtesy: MIT online study notes)

The input multiplier performs the de-spreading of the received signal, and the second multiplier translates the modulated signal down to baseband. The filter output would probably require further processing - not shown - to clean up the waveform to binary format.

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

The PN sequence at the receiver acts as a key to the transmission. It must not only have the same clock and bit pattern; it must be aligned properly with the sequence at the transmitter.

REFERANCES (1) IIT Kharagpur online notes (2) Digital Communication by John G. Proakis

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Experiment: 10 Aim: To study cellular CDMA. Theory: An important use of the concept of spread spectrum in wireless communication
systems is to allow multiple users occupy the same transmission band for simultaneous transmission of signals without considerable interference. The three basic multiple access techniques are frequency division multiple access (FDMA), time division multiple access (TDMA) and code division multiple access (CDMA) / spread spectrum multiple access (SSMA).

CDMA spread spectrum basics


CDMA is based around the use of direct sequence spread spectrum techniques. Essentially CDMA is a form of spread spectrum transmission which uses spreading codes to spread the signal out over a wider bandwidth then would normally be required. By using CDMA spread spectrum technology, many users are able to use the same channel and gain access to the system without causing undue interference to each other. Although as the number of users increases care has to be taken to ensure that interference levels do not rise to the extent that performance falls, it is still possible to provide access to a large number of different users and allow them access. The key element of code division multiple access CDMA is its use of a form of transmission known as direct sequence spread spectrum, DSSS. Direct sequence spread spectrum is a form of transmission that looks very similar to white noise over the bandwidth of the transmission. However once received and processed with the correct descrambling codes, it is possible to extract the required data. When transmitting a CDMA spread spectrum signal, the required data signal is multiplied with what is known as a spreading or chip code data stream. The resulting data stream has a higher data rate than the data itself. Often the data is multiplied using the XOR (exclusive OR) function.

(Courtesy: IIT online study notes)

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012 CDMA spreading

Advanced Digital Communication

Each bit in the spreading sequence is called a chip, and this is much shorter than each information bit. The spreading sequence or chip sequence has the same data rate as the final output from the spreading multiplier. The rate is called the chip rate, and this is often measured in terms of a number of M chips / sec. The baseband data stream is then modulated onto a carrier and in this way the overall the overall signal is spread over a much wider bandwidth than if the data had been simply modulated onto the carrier. This is because; signals with high data rates occupy wider signal bandwidths than those with low data rates.

CDMA spread spectrum generation (courtesy: IIT online study notes) To decode the signal and receive the original data, the CDMA signal is first demodulated from the carrier to reconstitute the high speed data stream. This is multiplied with the spreading code to regenerate the original data. When this is done, then only the data with that was generated with the same spreading code is regenerated, all the other data that is generated from different spreading code streams is ignored.

CDMA spread spectrum decoding

The use of CDMA spread spectrum is a powerful principle and using this CDMA technique, it is possible to transmit several sets of data independently on the same carrier and then reconstitute them at the receiver without mutual interference. In this way a base station can communicate with several mobiles on a single channel. Similarly several mobiles can communicate with a single base station, provided that in each case an independent spreading code is used.

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

CDMA spread spectrum encode / decode process


In order to visualize how the CDMA spread spectrum process operates, the easiest method is to show an example of how the system actually operates in terms of data bits, and how the data is recovered from the CDMA spread spectrum signal. The first part of the process is to generate the CDMA spread spectrum signal. Take as an example that the data to be transmitted is 1001, and the chip or spreading code is 0010. For each data bit, the complete spreading code is used to multiple the data, and in this way, for each data bits, the spread or expanded signal consists of four bits. 1 0010 1101 0 0010 0010 0 0010 0010 1 0010 1101 Data to be transmitted Chip or spreading code Resultant spread data output

With the signal obtained and transmitted, it needs to be decoded within the remote receiver: 1101 0010 1111 1 0010 0010 0000 0 0010 0010 0000 0 1x0=1 1101 0010 1111 1 Incoming CDMA signal Chip or spreading code Result of de-spreading Integrated output

NB: 1 x 1 = 0

In this way it can be seen that the original data is recovered exactly by using the same spreading or chip code. Had another code been used to regenerate the CDMA spread spectrum signal, then it would have resulted in a random sequence after de-spreading. This would have appeared as noise in the system.

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

CDMA spreading gain


The bandwidth of the CDMA spread spectrum signal will be much wider than the original data stream. To quantify the increase in bandwidth, a term known as the spreading gain is used. If the bandwidth of the CDMS spread spectrum signal is W and the input data bit length or period 1/R then the CDMA spreading gain can be defined: Spreading gain = W / R The principle behind CDMA spread spectrum communications is relatively straightforward. The same code must be sued within generation and decoding of the CDMA spread spectrum signal to enable the data to pass unchanged through the system. The use of a different code in transmission and reception results in a signal similar in character to noise being generated and this can be discarded.

Advantages of CDMA:
One of the main advantages of CDMA is that dropouts occur only when the phone is at least twice as far from the base station. Thus it is used in the rural areas where GSM cannot cover. 2. Another advantage is its capacity; it has a very high spectral capacity that it can accommodate more users per MHz of bandwidth.
1.

Disadvantages of CDMA:
Channel pollution, where signals from too many cell sites are present in the subscribers phone but none of them is dominant. When this situation arises the quality of the audio degrades. 2. When compared to GSM is the lack of international roaming capabilities. 3. The ability to upgrade or change to another handset is not easy with this technology because the network service information for the phone is put in the actual phone unlike GSM which uses SIM card for this. 4. Limited variety of the handset, because at present the major mobile companies use GSM technology.
1.

REFERANCES: (1) IIT Kharagpur online notes (2) Digital Communication by John G. Proakis

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Experiment: 11 Aim: To Implement Gradient Descent Optimization for different functions. Theory: Gradient Descent is a first-order optimization algorithm. To find the local minima of a function using gradient descent, one takes steps proportional to the negative of the gradient of the function at the current point. If instead one takes steps proportional to the positive of the gradient, one approaches a local maxima of that function, the procedure is then known as gradient ascent. Gradient descent is defined as ( Where F(x) is differentiable function, is step size, (x) is gradient of the function
MATLAB Program:
%This program find minima of the given function using Gradient Descent Algorithm clc; clear all; StoP=50; %y1=inline('x.^2','x'); y1=inline('(x.^3)-10*(x.^2)-4','x'); x=-10:0.001:10; y=y1(x); plot(x,y); xlabel('x'); ylabel('f(x)'); point=input('Enter initial guess :'); step=input('Enter the step :'); slop=(y1(point)-y1(point-step))/step; while slop~=0 slop=(y1(point)-y1(point-step))/step; point=point-step*slop; if norm(point)>StoP fprintf('Reached STOP limit to avoid Infinite loop\n'); break end end fprintf('The Found minima was %f at arg %f\n',y1(point),point);

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012 Output: (function 1)

Advanced Digital Communication

(Function 2)

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012

Year 2012

Advanced Digital Communication

Conclusion:

L.D.C.E., M.E.-C.S.E.(E.C.) Sem-2 ,2012