Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

DIGITAL MODULATION USING MATLAB

t=0:0.000001:0.01;
disp('digital nessage signal');
vm=input('amplitude');
fm=input('frequency');
wm=2*pi*fm;
disp('carrier signal');
vc=input('amplitude');
fc=input('frequency');
wc=2*pi*fc;
vm=vm*square(wm*t);
subplot(5,1,1);
plot(t,vm);
title('digital message signal');
xlabel('time');
ylabel('amplitude');
vc=vc*(sin(wc*t));
subplot(5,1,2);
plot(t,vc);
title('carrier signal');
xlabel('time');
ylabel('amplitude');
q=vm.*vc+vc;
subplot(5,1,3);
plot(t,q);
title('ask signal');
xlabel('time');
ylabel('amplitude');
r=vm.*vc;
subplot(5,1,4);
plot(t,r);
title('psk signal');
xlabel('time');
ylabel('amplitude');
x=sin(2*pi*(fc+1500)+t);
subplot(5,1,5);
plot(t,x);
title('fsk signal');
xlabel('time');
ylabel('amplitude');

amplitude
amplitude

50
0
-50

20
0
-20

amplitude

10
0
-10

amplitude

amplitude

digital message signal


5
0
-5

0.01
0
-0.01

0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009


time
carrier signal

0.01

0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009


time
ask signal

0.01

0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009


time
psk signal

0.01

0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009


time
fsk signal

0.01

0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009


time

0.01

ERROR CONTROL CODE USING MATLAB


clc;
w=[1 0 0 0 1 1];
fprintf('the original code is');
disp(w);
P=[1 1 0; 0 1 1; 0 0 1];
I=[1 0 0; 0 1 0; 0 0 1];
pt=P';
H=[pt,I];
ht=H';
disp('the value of ht matrix is:');ht
for (i=1:3)
s1=0;
for (j=1:6)
s1=xor(s1,ht(j,i)*w(j));
end
s(i)=s1;
end
fprintf('the syndrome is:');
disp(s);
for (k=1:6)
if(s==ht(k,1))
end
end
temp=k;
fprintf('the error is in the postion %d\n',temp);
w(temp)=xor(w(temp),1);
disp('corrected code is:');
disp(w);

the original code is

the value of ht matrix is:


ht =
1
0
0
1
0
0

1
1
0
0
1
0

0
1
1
0
0
1

the syndrome is:

the error is in the postion 6


corrected code is:
1 0 0 0 1 0

You might also like