信号级仿真---数字调制MFSK模式

一、设置调制参数

M = 4;        % Modulation order
freqsep = 8;  % Frequency separation (Hz)
nsamp = 8;    % Number of samples per symbol
Fs = 32;      % Sample rate (Hz)
Generate random M-ary symbols.
x = randi([0 M-1],1000,1);

二、全流程仿真

%Apply FSK modulation.
y = fskmod(x,M,freqsep,nsamp,Fs);
Create a spectrum analyzer System object™ and use its step method to display a plot of the signal spectrum.

h = dsp.SpectrumAnalyzer('SampleRate',Fs);
step(h,y) % 信号频谱显示

在这里插入图片描述

三、关键点解析

samptime = 1/Fs; % 采样时间
maxFreq = ((M-1)/2) * freq_sep; %最大频率
maxFreq <= Fs/2; % 需要满足的条件(采样定理)

相位调制分为非连续相位调制和连续相位调制

  1. 非连续相位调制
    初始化参数
% Obtain the total number of channels
[nRows, nChan] = size(x);
% Initialize the phase increments and the oscillator phase for modulator with  discontinuous phase.
phaseIncr = (0:nSamp-1)' * (-(M-1):2:(M-1)) * 2*pi * freq_sep/2 * samptime; %每个符号的随采样点数增加,相位的增加值
% phIncrSym is the incremental phase over one symbol, across all M tones. 每个符号的相位增加值
phIncrSym = phaseIncr(end,:);
% phIncrSamp is the incremental phase over one sample, across all M tones.每个采样点相位的增加值
phIncrSamp = phaseIncr(2,:);    % recall that phaseIncr(1,:) = 0
OscPhase = zeros(nChan, M);

% phase = nSamp*# of symbols x # of channels
Phase = zeros(nSamp*nRows, nChan);
   exp_phaseIncr = exp(1i*phaseIncr);
    y = reshape(exp_phaseIncr(:,x+1),nRows*nSamp,nChan);
  1. 相位连续
for iChan = 1:nChan
    prevPhase = 0; % 初始化相位值为0
    for iSym = 1:nRows
        % Get the initial phase for the current symbol
        if (phase_cont)
            ph1 = prevPhase; %当前相位值
        else
            ph1 = OscPhase(iChan, x(iSym,iChan)+1);
        end

        % 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*(iSym-1)+1:nSamp*iSym,iChan) = ...
            ph1*ones(nSamp,1) + phaseIncr(:,x(iSym,iChan)+1);

        % Update the oscillator for a modulator with discontinuous phase.
        % Calculate the phase modulo 2*pi so that the phase doesn't grow too
        % large.
        if (~phase_cont)
            OscPhase(iChan,:) = ...
                rem(OscPhase(iChan,:) + phIncrSym + phIncrSamp, 2*pi); % 取模2*pi
        end

        % If in continuous mode, the starting phase for the next symbol is the
        % ending phase of the current symbol plus the phase increment over one sample. 最后相位值在加一个采样点的相位值
        prevPhase = Phase(nSamp*iSym,iChan) + phIncrSamp(x(iSym,iChan)+1); 
    end
end
y = exp(1i*Phase);

后记:
主要思路是分为非连续相位和连续相位.
当前相位为原来相位加上增长相位;
原来相位为上一次相位值多加一次采样值的相位;
增加相位每次都一样.每个符号的采样点数对应的相位值.
很好地运用了不同矩阵的运算.

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值