cpfskmod_new.asv

来自「一个仿真测试4FSK信号的matlab环境GUI程序。可以查看基带IQ波形、眼图」· ASV 代码 · 共 42 行

ASV
42
字号
function y = cpfskmod_new(x,M,h,nSamp,Fd)
%
%
M = 4;
h = 0.27;
Num = 4800;
Fd = 4800;
nSamp = 8;
rndInt = randsrc(Num,1,[1:M],12345);
x = 2*rndInt-(M+1);

x = x(:);
xIn = (x + (M+1))/2 - 1;
% Initialize the phase increments and the oscillator phase for modulator with 
% discontinous phase.  phaseIncr is the incremental phase over one symbol,
% across all M tones.  phIncrSamp is the incremental phase over one sample,
% across all M tones.
samptime = 1/(Fd*nSamp);

phaseIncr = [0:nSamp-1]'*[-(M-1):2:(M-1)]*pi*(h*Fd)*samptime;
phIncrSym = phaseIncr(end,:);
phIncrSamp = phaseIncr(2,:);    % recall that phaseIncr(1:0) = 0

prevPhase = 0;

[nRow,nChan] = size(xIn);
Phase = zeros(nSamp*nRow,1);

if nChan~=1
    error('This program does not surpport multiple channel');
    return
end

for i = 1:nRow
    % Compute the phase of the current symbol by summing the initial phase
        % with the per-symbol phase trajectory associated with the given M-ary
        % data element.
        Phase(nSamp*(-1)+1:nSamp*iSym,iChan) = ...
            ph1*ones(nSamp,1) + phaseIncr(:,x(iSym,iChan)+1);
        
            
            

⌨️ 快捷键说明

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