classdef (StrictDefaults)slexFourPointDFTSysObj < matlab.System 
% 4 point Discrete Fourier Transform

% Copyright 2013 The MathWorks Inc. 
%#codegen

    methods 
        function this = slexFourPointDFTSysObj(varargin)
            setProperties(this, nargin, varargin{:});
        end
    end

    methods(Access=protected)
        function icon = getIconImpl(~)
            icon = sprintf('4-point\nDFT');
        end
        
        function [y1,y2,y3,y4] = ...
                stepImpl(~,x)
            dft = complex(zeros(1,length(x)));
            ln = length(x);
            for ind = 0 : ln-1
                for n = 0 : ln-1
                    dft(ind+1) = dft(ind+1) + ...
                        double(x(n+1))*(exp(-2*pi*1i*ind*n/ln));
                end
            end
            y1 = dft(1 : ln/4);
            y2 = dft(ln/4+1 : ln/2);
            y3 = dft(ln/2+1 : 3*ln/4);
            y4 = dft(3*ln/4+1 : ln);
            
        end
    end
end
