How to convert the complex number as a 2D vector to train a neural network

21 ビュー (過去 30 日間)
tyler seudath
tyler seudath 2021 年 11 月 26 日
コメント済み: Walter Roberson 2021 年 11 月 26 日
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 件のコメント
tyler seudath
tyler seudath 2021 年 11 月 26 日
Could you explain this a little more, I dont understand. This is the code I have thus far,
RealTrain_data = real(cell2mat(Train_inputX1));
ImTrain_data = imag(cell2mat(Train_inputX1));
TrainInput = [RealTrain_data ImTrain_data];
So for the 4D array will it be [row column channels TrainInput]??
So for the 4D array will it be [ row column channels TrainInput]?
Sorry I am new to this.
Thanks a mil in advance
Walter Roberson
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
KSSV 2021 年 11 月 26 日
To get real and imaginary part of the complex number, use real and imag. For other part use reshape.

カテゴリ

Help Center および File ExchangeBuild Deep Neural Networks についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by