调制的方法变了,OFDM之后,经过一个滤波器,就是F-OFDM,解调按照正常的OFDM解调。
classdef FOFDMModulator < matlab.System
% F-OFDM Modulator
%
% This template includes the minimum set of functions required
% to define a System object with discrete state.
% Public, tunable properties
properties
FFTLength = 1024;
NumGuardBandCarriers = [212;212];
CyclicPrefixLength = 72;
NumSymbols = 1;
FilterLength = 513;
ToneOffset = 2.5000;
end
% Pre-computed constants
properties(Access = private)
OFDMModulator
filterOrder
numDataCarriers
fnum
filt
end
methods
function obj = FOFDMModulator(varargin)
% Support name-value pair arguments when constructing object
setProperties(obj,nargin,varargin{:})
end
end
methods(Access = protected)
function setupImpl(obj)
% Perform one-time calculations, such as computing constants
obj.OFDMModulator = comm.OFDMModulator("FFTLength",obj.FFTLength,...
"NumGuardBandCarriers",obj.NumGuardBandCarriers,...
"CyclicPrefixLength",obj.CyclicPrefixLength,...
"NumSymbols",obj.NumSymbols);
obj.filterOrder = obj.FilterLength - 1;
obj.numDataCarriers = obj.FFTLength - sum(obj.NumGuardBandCarriers);
L = obj.filterOrder;
halfFilt = L/2;
n = -halfFilt:halfFilt;
% Sinc function prototype filter
pb = sinc((obj.numDataCarriers+2*obj.ToneOffset).*n./obj.FFTLength);
% Sinc truncation window
w = (0.5*(1+cos(2*pi.*n/(L-1)))).^0.6;
% Normalized lowpass filter coefficients
obj.fnum = (pb.*w)/sum(pb.*w);
obj.filt = dsp.FIRFilter('Structure', 'Direct form symmetric', ...
'Numerator', obj.fnum);
end
function y = stepImpl(obj,u)
txSigOFDM = obj.OFDMModulator(u);
txSigFOFDM = obj.filt([txSigOFDM; zeros(obj.filterOrder/2,1)]);
y = txSigFOFDM(obj.filterOrder/2+(1:(obj.FFTLength + obj.CyclicPrefixLength)));
end
function resetImpl(obj)
% Initialize / reset discrete-state properties
release(obj.OFDMModulator);
release(obj.filt);
end
function num = getNumInputsImpl(~)
% Define total number of inputs for system with optional inputs
num = 1;
% if obj.UseOptionalInput
% num = 2;
% end
end
function num = getNumOutputsImpl(~)
% Define total number of outputs for system with optional
% outputs
num = 1;
% if obj.UseOptionalOutput
% num = 2;
% end
end
function out = getOutputSizeImpl(obj)
% Return size for each output port
out = [obj.FFTLength + obj.CyclicPrefixLength,1];
end
end
end