フィルターのクリア

Why the imaginary part of the points p1,p2,p3 isn't zero in the plane?

1 回表示 (過去 30 日間)
Giuseppe Alfieri
Giuseppe Alfieri 2018 年 7 月 16 日
コメント済み: Giuseppe Alfieri 2018 年 7 月 16 日
p1=1;
p2=3;
p3=4;
plot([p1,p2,p3],'x')

採用された回答

Steven Lord
Steven Lord 2018 年 7 月 16 日
When called with one data input, the plot function behaves differently depending on whether that data input is real or complex. From the documentation:
"plot(Y) creates a 2-D line plot of the data in Y versus the index of each value.
If Y is a vector, then the x-axis scale ranges from 1 to length(Y).
...
If Y is complex, then the plot function plots the imaginary part of Y versus the real part of Y, such that plot(Y) is equivalent to plot(real(Y),imag(Y))."
  1 件のコメント
Giuseppe Alfieri
Giuseppe Alfieri 2018 年 7 月 16 日
So i have to write for example p1=1+0×i; as real part and imaginary part is it correct?

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

その他の回答 (1 件)

Jesus Sanchez
Jesus Sanchez 2018 年 7 月 16 日
You are not plotting a Real vs Imag plot, but just the normal one. The 'x' makes the plotted data to be represented as an x marker, but that is all. When you execute that code, MATLAB shows the corresponding value in y-axis and the index of that value in x-axis. That is why your first value appears in the position "1" in x-axis, your second in "2" etc etc

カテゴリ

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

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by