close all;
clear all;
clc;
N=100;
P0=[repmat(0,1,N/2),repmat(1,1,N/2)];
P1=[repmat(1,1,N/2),repmat(0,1,N/2)];
figure(1),
subplot(121),plot(P0);axis([1N04]);title('数据0对应的曼彻斯特编码');grid on;
subplot(122),plot(P1);axis([1N04]);title('数据1对应的曼彻斯特编码');grid on;
data=10;
aa=dec2bin(data,4); for m=1:4
c=bin2dec(aa(m));
if c==0
ac((m-1)*N+1:m*N)=P0;
else
ac((m-1)*N+1:m*N)=P1;
end
end
figure(2),
plot(ac);grid on;axis([04*N04]);title(data);
return;
fc=13.56;
for k=1:8
for t=N/2*(k-1)+1:N/2*k;
ifac(N/2*(k-1)+1)==1
ft(t)=2*cos(2*pi*fc*t);
else
ft(t)=cos(2*pi*fc*t);
end
end
end
clear all;
clc;
N=100;
P0=[repmat(0,1,N/2),repmat(1,1,N/2)];
P1=[repmat(1,1,N/2),repmat(0,1,N/2)];
figure(1),
subplot(121),plot(P0);axis([1N04]);title('数据0对应的曼彻斯特编码');grid on;
subplot(122),plot(P1);axis([1N04]);title('数据1对应的曼彻斯特编码');grid on;
data=10;
aa=dec2bin(data,4); for m=1:4
c=bin2dec(aa(m));
if c==0
ac((m-1)*N+1:m*N)=P0;
else
ac((m-1)*N+1:m*N)=P1;
end
end
figure(2),
plot(ac);grid on;axis([04*N04]);title(data);
return;
fc=13.56;
for k=1:8
for t=N/2*(k-1)+1:N/2*k;
ifac(N/2*(k-1)+1)==1
ft(t)=2*cos(2*pi*fc*t);
else
ft(t)=cos(2*pi*fc*t);
end
end
end

