How to convert the complex number as a 2D vector to train a neural network
21 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2021-11-26
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.
回答(1 个)
KSSV
2021-11-26
To get real and imaginary part of the complex number, use real and imag. For other part use reshape.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Build Deep Neural Networks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!