【信号识别】基于深度学习CNN实现信号调制分类附matlab代码

1 简介

大容量、高速率的信息传输需求极大地推动了认知无线电领域的技术发展,其中,复杂电磁环境中信道均衡及通信调制类型识别技术,是该领域重要组成之一。传统的均衡处理主要是利用梯度下降法逼近信道特征,在时域或频域对信号进行逆卷积运算,以抑制信道干扰和畸变,改善系统响应;而传统的调制识别方法主要通过提取信号的专家特征,选择合适的分类器进行识别。近年来,许多先进的卷积神经网络架构及优化算法相继提出,深度学习在多个领域都取得了突破性的成果。基于卷积神经网络对原始输入的抽象特征学习能力,本文对其在信号去噪、信道均衡及调制识别等方面的应用进行了深入研究。

2 部分代码

classdef helperModClassFrameStore < handle%helperModClassFrameStore Manage data for modulation classification%   FS = helperModClassFrameStore creates a frame store object, FS, that%   stores the complex baseband signals in a format usable in machine%   learning algorithms.%   %   FS = helperModClassFrameStore(MAXFR,SPF,LABELS) creates a frame store%   object, FH, with the maximum number of frames, MAXFR, samples per%   frame, SPF, and expected labels, LABELS.%   %   Methods:%   %   add(FS,FRAMES,LABEL) adds frame(s), FRAMES, with label, LABEL, to the%   frame store.%%   [FRAMES,LABELS] = get(FS) returns stored frames and corresponding%   labels from frame store, FS.%   %   See also ModulationClassificationWithDeepLearningExample.
  properties    OutputFormat = FrameStoreOutputFormat.IQAsRows  end    properties (SetAccess=private)    %NumFrames Number of frames in the frame store    NumFrames = 0    %MaximumNumFrames Capacity of frame store    MaximumNumFrames    %SamplesPerFrame Samples per frame    SamplesPerFrame    %Labels Set of expected labels    Labels  end    properties (Access=private)    Frames    Label  end    methods    function obj = helperModClassFrameStore(varargin)      %helperModClassFrameStore Store complex I/Q frames      %    FS = helperModClassFrameStore(MAXFR,SPF,LABELS) returns a frame      %    store object, FS, to store complex I/Q baseband frames of type      %    LABEL with frame size of SPF. Frame are stored as a      %    [SPFxNUMFRAMES] array.            inputs = inputParser;      addRequired(inputs, 'MaximumNumFrames')      addRequired(inputs, 'SamplesPerFrame')      addRequired(inputs, 'Labels')      parse(inputs, varargin{:})            obj.SamplesPerFrame = inputs.Results.SamplesPerFrame;      obj.MaximumNumFrames = inputs.Results.MaximumNumFrames;      obj.Labels = inputs.Results.Labels;      obj.Frames = ...        zeros(obj.SamplesPerFrame,obj.MaximumNumFrames);      obj.Label = repmat(obj.Labels(1),obj.MaximumNumFrames,1);    end        function add(obj,frames,label,varargin)      %add     Add baseband frames to frame store      %   add(FS,FRAMES,LABEL) adds frame(s), FRAMES, with label, LABEL, to      %   frame store FS.            numNewFrames = size(frames,2);      if (~isscalar(label) && numNewFrames ~= length(label)) ...          && (size(frames,1) ~= obj.SamplesPerFrame)        error(message('comm_demos:helperModClassFrameStore:MismatchedInputSize'));      end            % Add frames      startIdx = obj.NumFrames+1;      endIdx = obj.NumFrames+numNewFrames;      obj.Frames(:,startIdx:endIdx) = frames;            % Add labels types      if all(ismember(label,obj.Labels))        obj.Label(startIdx:endIdx,1) = label;      else        error(message('comm_demos:helperModClassFrameStore:UnknownLabel',...          label(~ismember(label,obj.Labels))))      end
      obj.NumFrames = obj.NumFrames + numNewFrames;    end        function [frames,labels] = get(obj)      %get     Return frames and labels      %   [FRAMES,LABELS]=get(FS) returns the frames and corresponding      %   labels in the frame store, FS.       %         %   If OutputFormat is IQAsRows, then FRAMES is an array of size      %   [2xSPFx1xNUMFRAMES], where the first row is the in-phase      %   component and the second row is the quadrature component.      %         %   If OutputFormat is IQAsPages, then FRAMES is an array of size      %   [1xSPFx2xNUMFRAMES], where the first page (3rd dimension) is the      %   in-phase component and the second page is the quadrature      %   component.            switch obj.OutputFormat        case FrameStoreOutputFormat.IQAsRows          I = real(obj.Frames(:,1:obj.NumFrames));          Q = imag(obj.Frames(:,1:obj.NumFrames));          I = permute(I,[3 1 4 2]);          Q = permute(Q,[3 1 4 2]);          frames = cat(1,I,Q);        case FrameStoreOutputFormat.IQAsPages          I = real(obj.Frames(:,1:obj.NumFrames));          Q = imag(obj.Frames(:,1:obj.NumFrames));          I = permute(I,[3 1 4 2]);          Q = permute(Q,[3 1 4 2]);          frames = cat(3,I,Q);      end            labels = obj.Label(1:obj.NumFrames,1);    end        function [fsTraining,fsValidation,fsTest] = ...        splitData(obj,splitPercentages)      %splitData Split data into training, validation and test      %   [FSTRAIN,FSVALID,FSTEST]=splitData(FS,PER) splits the stored      %   frames into training, validation, and test groups based on the      %   percentages, PER. PER is a three-element vector,      %   [PERTRAIN,PERVALID,PERTEST], which specifies training,      %   validation, and test percentages. FSTRAIN, FSVALID, and FSTEST      %   are the frame stores for training, validation, and test frames.            fsTraining = helperModClassFrameStore(...        ceil(obj.MaximumNumFrames*splitPercentages(1)/100), ...        obj.SamplesPerFrame, obj.Labels);      fsValidation = helperModClassFrameStore(...        ceil(obj.MaximumNumFrames*splitPercentages(2)/100), ...        obj.SamplesPerFrame, obj.Labels);      fsTest = helperModClassFrameStore(...        ceil(obj.MaximumNumFrames*splitPercentages(3)/100), ...        obj.SamplesPerFrame, obj.Labels);            for modType = 1:length(obj.Labels)        rawIdx = find(obj.Label == obj.Labels(modType));        numFrames = length(rawIdx);                % First shuffle the frames        shuffleIdx = randperm(numFrames);        frames = obj.Frames(:,rawIdx);        frames = frames(:,shuffleIdx);                numTrainingFrames = round(numFrames*splitPercentages(1)/100);        numValidationFrames = round(numFrames*splitPercentages(2)/100);        numTestFrames = round(numFrames*splitPercentages(3)/100);        extraFrames = sum([numTrainingFrames,numValidationFrames,numTestFrames]) - numFrames;        if (extraFrames > 0)          numTestFrames = numTestFrames - extraFrames;        end                add(fsTraining, ...          frames(:,1:numTrainingFrames), ...          obj.Labels(modType));        add(fsValidation, ...          frames(:,numTrainingFrames+(1:numValidationFrames)), ...          obj.Labels(modType));        add(fsTest, ...          frames(:,numTrainingFrames+numValidationFrames+(1:numTestFrames)), ...          obj.Labels(modType));      end            % Shuffle new frame stores      shuffle(fsTraining);      shuffle(fsValidation);      shuffle(fsTest);    end
    function shuffle(obj)      %shuffle  Shuffle stored frames      %   shuffle(FS) shuffles the order of stored frames.            shuffleIdx = randperm(obj.NumFrames);      obj.Frames = obj.Frames(:,shuffleIdx);      obj.Label = obj.Label(shuffleIdx,1);    end  endend

3 仿真结果

【信号识别】基于深度学习CNN实现信号调制分类附matlab代码_第1张图片

【信号识别】基于深度学习CNN实现信号调制分类附matlab代码_第2张图片

4 参考文献

[1]周煜. 基于深度学习的无线信号调制方式识别技术研究[D]. 北京邮电大学, 2019.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

你可能感兴趣的:(信号处理,大数据)