差分编码 matlab,差分编码FSK调制解调matlab源程序.doc

Fc=10; %载频

Fs=100; %系统采样频率

Fd=1; %码速率

N=Fs/Fd;

df=10;

numSymb=25;%进行仿真的信息代码个数

M=2;

SNRpBit=60;%信噪比

SNR=SNRpBit/log2(M);

numPlot=25; %产生25个二进制随机码

x=randsrc(numSymb,1,[0:M-1]);%产生25个二进制随机码

figure(1)

stem([0:numPlot-1],x(1:numPlot),bx);

title(二进制随机序列)

xlabel(Time);

ylabel(Amplitude);

b=zeros(1,26); %全零数组

b(2)=xor(b(1),x(1)) %或非

for n=2:25

b(n+1)=xor(x(n),b(n));

end

for n=1:25

x(n)=b(n+1);

end

figure(2)

stem([0:numPlot-1],x(1:numPlot),bx);

title(差分编码)

xlabel(Time);

ylabel(Amplitude);

y=dmod(x,Fc,Fd,Fs,psk,M,df);

numModPlot=numPlot*Fs;

t=[0:numModPlot-1]./Fs;

figure(3)

plot(t,y(1:length(t)),b-);

axis([min(t) 2 -1.5 1.5]); %x轴y轴范围

title(调制信号)

xlabel(Time);

ylabel(Amplitude);

seed=[12345 54321];

randn(state,seed(2)); %产生正态分布的随机数或矩阵的函数

y=awgn(y,SNR-10*log10(0.5)-10*log10(N),measured,[],dB);

figure(4)

plot(t,y(1:length(t)),b-);

axis([min(t) 2 -1.5 1.5]);

title(加入高斯白噪声后的已调信号)

xlabel(Time);

ylabel(Amplitude);

z1=ddemod(y,Fc,Fd,Fs,psk,M,df);

figure(5)

stem([0:numPlot-1],z1(1:numPlot),ro);

axis([0 numPlot -0.5 1.5]);

title(相干解调后的信号的绝对码)

xlabel(Time);

ylabel(Amplitude);

a=zeros(1,26);

a(1)=xor(b(1),0);

for n=2:25

a(n)=xor(b(n),b(n-1))

end

for n=1:25

z1(n)=a(n+1);

end

figure(6)

stem([0:numPlot-1],z1(1:numPlot),ro);

title(解码信号)

xlabel(Time);

ylabel(Amplitude)

%误码率统计

[errorSym ratioSym]=symerr(x,z1); %求误码率函数

figure(6)

simbasebandex([0:1:5]);

title(相干解调后误码率统计)

展开阅读全文

相关资源:GLONASS卫星位置计算与程序实现_葛奎_glonass_卫星位置__matlab

来源:葛瞳

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年2月22日
下一篇 2021年2月22日

相关推荐