%% Convert Signal to Time-Frequency Image using Wavelet Transform
%% This function takes the input signal and converts it to an image

function im = cwtModType(inputSig, imgSize)  %#codegen
% This function is only intended to support wavelet deep learning examples.
% It may change or be removed in a future release.
coder.gpu.kernel;

% Input is a 1024x2 matrix, convert it into complex form (a + 1*ib)
cinputSig = convertToComplex(inputSig);

% Wavelet time-frequency representations
[wt, ~, ~] = cwt(cinputSig, 'morse', 1, 'VoicesPerOctave', 48);

% Generate Wavelet Time-Frequency Coefficients from Signal
cfs = abs([wt(:,:,1); wt(:,:,2)]); % Concatenate the clockwise and counterclockwise representation

% Image generation
im = generateImagefromCWTCoeff(cfs, imgSize);
end