berest.m

来自「数字电话各模块的独立M文件实现」· M 代码 · 共 31 行

M
31
字号
%qpsk_berest.m
% File: psk_berest.m
function [peideal,pesystem]=psk_berest(xx,yy,ebn0db,eb,tb,nbw)
% ebn0db is an array of Eb/No values in db (specified at the receiver
%input); tb is the bit duration and nbw is the noise BW 
% xx is the reference (ideal) input; yy is the filtered output;
nx=length(xx);
% For comparision purposes , set the noise BW of the ideal receiver
% (integrate and dump) to be equal to rs/2.
nbwideal=1/(2*tb); % noise bandwidth
for m=1:length(ebn0db) 
    peideal(m)=0.0; pesystem(m)=0.0; %initialize
    % find n0 and the variance of the noise.
    ebn0(m)=10^(ebn0db(m)/10); % dB to linear
    n0=eb/ebn0(m); % noise power
    sigma=sqrt(n0*nbw*2); %variance
    sigma1=sqrt(n0*nbwideal*2);%
    % Multiply the input constellation/signal by a scale factor so that input
    % constellation and the constellations/signal at the input to receive
    % filter have the same ave power a=sqrt(2*eb/(2*tb)).
    b=sqrt(2*eb/tb)/sqrt(sum(abs(xx).^2)/nx);
    d1=b*abs(xx);
    d3=abs(yy);
    peideal(m)=sum(q(d1/sigma1));
    pesystem(m)=sum(q(d3/sigma));
end
peideal=peideal/nx;
pesystem=pesystem/nx;
% End of function file.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?