How to plot imaginary (or real) part of one complex variable vs another real variable of an implicit function in MATLAB? For example,

5 ビュー (過去 30 日間)
Kartik
Kartik 2023 年 12 月 11 日
編集済み: Gyan Vaibhav 2023 年 12 月 19 日
  2 件のコメント
Torsten
Torsten 2023 年 12 月 11 日
編集済み: Torsten 2023 年 12 月 11 日
Hint:
Given t as a real number, do you know the solution(s) for z giving z^2+t^2+1=0 ?
Walter Roberson
Walter Roberson 2023 年 12 月 19 日
Re(z) has no particular relationship to t so graph anything you want.
The statement that "f(z,t)=0 doesn't have any real solutions" is irrelevant to the question.

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

回答 (1 件)

Gyan Vaibhav
Gyan Vaibhav 2023 年 12 月 18 日
編集済み: Gyan Vaibhav 2023 年 12 月 19 日
Hi Kartik,
I understand that you are trying to plot the real and imaginary parts, for the cases in which “t” is a real value in the above implicit function.
The plots for the imaginary and real parts for the complex values of z for the implicit function can be plotted as follows:
  1. Define the implicit function. In this case, the function is
  2. Since it is required to plot and , the z term can be isolated as follows to express the function as .
  3. Choose a range of t values for which it is required to generate the plot. For instance, t can be defined as t = -2:0.1:2 to create a vector of values from -2 to 2 with increments of 0.1.
  4. Calculate the real and imaginary parts of z for each t value. For this MATLAB's built-in “real” and “imag” functions can be used to extract the real and imaginary parts, respectively.
  5. Plot the real and imaginary against t values.
However, the following points need to be kept in mind.
  1. Note that the “sqrt” function in MATLAB returns the principal square root, which is always non-negative. Since the imaginary part can be positive or negative, it might be required to plot both positive and negative values to represent both possible values of the imaginary part of “z”.
  2. Since “z” is purely imaginary in this case, so the real part of “z” will always be zero.
Consider the following pages to learn more about extracting the real and imaginary parts of a complex number.
Hope this helps.
Thanks
Gyan
  3 件のコメント
Gyan Vaibhav
Gyan Vaibhav 2023 年 12 月 19 日
Hi Dyuman,
Thank you for guiding me in that direction. I will keep this in mind from now on. Or if you suggest I can omit the code.
Dyuman Joshi
Dyuman Joshi 2023 年 12 月 19 日
編集済み: Dyuman Joshi 2023 年 12 月 19 日
@Gyan Vaibhav Yes, you should omit the code.

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

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by