How to convert the complex number as a 2D vector to train a neural network
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dear all,
I have a 4050 segment x 400 samples which are complex numbers. In order to train the neural network I need to split the data into a 2D real and imaginary and then create a 4D array that is accepted by the network to train. Any idea how to go about this?
Thanks a mil in advance.
Best,
Tyler
3 Kommentare
Walter Roberson
am 26 Nov. 2021
You have a two dimensional array; call it Data for the moment. The rows correspond to different segments and the columns correspond to different samples, so Data(SegmentNumber, SampleNumber) is one piece of information. That information has a real and an imaginary part, so you have real(Data(SegmentNumber, SampleNumber)) and imag(Data(SegmentNumber, SampleNumber)) . So you have number of segments times number of samples times two (real + imaginary) pieces of information overall.
But to store number of segments by number of samples by two pieces of information, you can store that in an array that is (NumberOfSegments by NumberOfSamples by 2) large:
DataParts = zeros(size(Data,1), size(Data,2), 2);
DataParts(:,:,1) = real(Data);
DataParts(:,:,2) = imag(Data);
then DataParts(J,K,1) is real(Data(J,K)) and DataParts(J,K,2) is imag(Data(J,K)) . So you have managed to store all of the data into a three dimensional array.
Do you need 4 dimensions? You only need four dimensions if you have four independent variables: DataParts(SegmentNumber, SampleNumber, RealOrImaginaryPane, WHAT_IS_THIS_DIMENSION)
Sometimes though what you might need would be
DataParts = zeros(size(Data,1), size(Data,2), 1, 2);
DataParts(:,:,:, 1) = real(Data);
DataParts(:,:,:, 2) = imag(Data);
which would be NumberOfSegments by NumberOfSamples by 1 by 2. The 1 here would correspond to number of colour planes, but you only have one color plane.
Antworten (1)
KSSV
am 26 Nov. 2021
To get real and imaginary part of the complex number, use real and imag. For other part use reshape.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Build Deep Neural Networks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!