Vous êtes sur la page 1sur 9

Khalifa University

Digital
communication
Assignment #1
Khalifa University
Digital
communication
Assignment #1

Khalifa University
Digital
communication
Assignment #1

Assignment #1

Task 1: law characteristics:

law is a logarithm form used for compression. Its given by the following equation:

y= (


)(

)) 0

1



function calculaw(mu)

% mu: compression parameter

x=0:0.01:1; %x=m/mp

mu_law1= (1/(log(1+mu))*(log(1+(mu*x)));


plot (x,mu_law1,'r'),grid
hold on

xlabel('x = m/m_p')
ylabel('y= \mu law')
title('The plot of \mu law')
legend('\mu=0.001','\mu=10','\mu=100','\mu=1000')


hold off
end


Then, we called the function and entered the values of that corresponds to figure 6.16, as
following:

>> % entering the array of mu:
>> calculaw([0.001 10 100 1000])


The following graph shows the result, which is the plot of law:

Assignment #1


Figure 1: mu law characteristics

Task 2: A law characteristics:

A law is another logarithm form used for compression. Its given by the following
equation:

y= (

1/A

y=(


)(

) 1/A

1




function Y=calcAlaw(A)

% A: compression parameter

step1=(1/A)/100;
X1= 0 : step1 : (1/A);
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
x = m/m
p
y
=



l
a
w
The plot of law


=0.001
=10
=100
=1000
Assignment #1



Y1= (A/(1+log(A)))*X1;

step2=(1-(1/A))/100;
X2 = (1/A) : step2 : 1;
Y2= (1/(1+log(A)))*(1+log(A*X2));


Y= [Y1,Y2];
X=[X1,X2];

plot(X,Y,'r'),grid
xlabel('x= m/m_p')
ylabel('y= A law')
title('The plot of A-law')
hold on

end


Since I need to display four graphs, I called the function four times, as shown below:


>> calcAlaw(1)
>> calcAlaw(10)
>> calcAlaw(87.6)
>> calcAlaw(1000)



The following graph shows the result, which is the plot of A law:


Assignment #1


Figure 2: A law characteristics

Comment:
Increasing the compression parameters A and implies more compression for the
signals.

Task 3: Signal to quantization noise ratio:

We have the following branched equation that shows the SNR in two cases;
compressed and uncompressed case:

y= 10 Log(

) uncompressed case
y= 10 Log(

) compressed case



0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.2
0.4
0.6
0.8
1
x= m/m
p
y
=

A


l
a
w
The plot of A-law
Assignment #1

When we tried to plot this we got error and not the required graphs! We then have decided
to plot each one alone.
First, we plotted the SNR for the compressed case:

function calcusnr(L,mu)
x=0:0.01:60;
SNR1=10*log10((3*L^2)./(log(1+mu(1))).^2);
SNR2=10*log10((3*L^2)./(log(1+mu(2))).^2);
hold on

plot (x,SNR1,'r'),grid

xlabel('x = relative signal power')
ylabel('y= SNR in dB')
title('Ratio of signal to quantization noise in PCM with compression')
hold on

plot (x,SNR2,'g'),grid
hold off

end


Then, we called the function and entered the values of L and as following:


>> % calling the function:
>> calcusnr(256,[255 1000])


The following graph shows the result:




Assignment #1

t)

Figure 3: SNR with compression 1
So this is the simplified equation, which is true for specific condition;
2
>> mp
2
/m
2
(t). We
worked out to find the original equation, we analyzed, and the following shows the code
after substituting the correct and wanted numbers:

x=0:0.01:100;

snr=((3.38125).*(x.^2));
snr2=(1+(0.4596.*x)+(0.0528.*(x.^2)));
snr3=snr.*(1./snr2);

SNR=10*(log(snr3));


plot(x,SNR,'r'),grid

xlabel('x = relative signal power in dB')
ylabel('y= SNR)
title('Signal to noise ratio in dB with compression')


0 10 20 30 40 50 60
36
36.5
37
37.5
38
38.5
x = relative signal power
y
=

S
N
R

i
n

d
B
Ratio of signal to quantization noise in PCM with compression
Assignment #1

The following graph shows the result:


Figure 4: SNR in dB

Now, the graph for the no compression case shows a linear line. We can represent this line
in a linear equation as following:
x=0:0.01:60;

SNR=x-8;

plot(x,SNR,'r'),grid

xlabel('x = relative signal power in dB')
ylabel('y= SNR')
title('Signal to noise ratio in dB without compression')


The following shows the graph:

0 10 20 30 40 50 60 70 80 90 100
-80
-60
-40
-20
0
20
40
60
x = relative signal power in dB
y
=

S
N
R
Signal to noise ratio in dB with compression
Assignment #1


Figure 5: SNR without compression

0 10 20 30 40 50 60
-10
0
10
20
30
40
50
60
x = relative signal power in dB
y
=

S
N
R
Signal to noise ratio in dB without compression

Vous aimerez peut-être aussi