How to complex number processing for graph plot?

4 ビュー (過去 30 日間)
Jeonghyun
Jeonghyun 2023 年 5 月 4 日
回答済み: Animesh 2023 年 5 月 9 日
I refer to the paper and practice calculating the transfer matrix through displacement and force at the boundary of the meta-structure, and plotting the effective property graph through it.
So, for this purpose, the displacement value and stress value were obtained using comsol and stored in Excel, where stress is in the form of complex numbers, so it is difficult to process it. First of all, I'm only extracting the real part from the complex number and using it, but I think there's a problem with this part, so I'm trying to get help.
I have attached the code I am using, the graph currently being plotted (left), and the target graph (right) and If you need an Excel file, please mention it in the answer
You can ignore the Y-axis scale.
  1 件のコメント
Walter Roberson
Walter Roberson 2023 年 5 月 4 日
Excel has no way to store complex numbers -- other than that you can purchase an extension macro that works by storing an "object" at each location to hold the two parts. MATLAB does not give any way of writing values in the format that would be needed by that extension.
To store complex numbers in Excel from MATLAB, you would break them into real and imaginary components in separate cells.

サインインしてコメントする。

採用された回答

Animesh
Animesh 2023 年 5 月 9 日
Hi Jeonghyun,
The reason for the graphs not achieving the desired result could be using only the real part of complex values as described by you in the question.
You can consider following the below mentioned steps:
  1. Exporting the real and imaginary parts of complex numbers separately from ‘Comsol’ software into text files or excel.
  2. Import the real and imaginary parts from text files or excel into MATLAB in different variables.
  3. Combine real and imaginary parts to make complex numbers using the inbuilt ‘complex’ function.
  4. You can now use the resulting complex numbers for processing and plotting according to your use-case.
For more information on handling complex numbers in MATLAB, refer the following links:
  1. Importing data into MATLAB: https://in.mathworks.com/help/matlab/ref/importdata.html#btk7vi1-3
  2. Combining the real and imaginary values to create complex numbers: https://in.mathworks.com/help/matlab/matlab_prog/complex-numbers.html
  3. Plot Imaginary and Complex Data: https://in.mathworks.com/help/matlab/creating_plots/plot-imaginary-and-complex-data.html
I hope this helps.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by