フィルターのクリア

how to find argument or angle of a complex number in matlab?

213 ビュー (過去 30 日間)
bsd
bsd 2011 年 6 月 30 日
コメント済み: Seungho Kim 2018 年 12 月 3 日
Dear sir/madam,
How do we find the argument of a complex number in matlab?
If I use the function angle(x) it shows the following warning "??? Subscript indices must either be real positive integers or logicals."
I am using the matlab version MATLAB 7.10.0(R2010a).
Please reply as soon as possible, since this is very much needed for my project. Looking forward for your reply.
Thanking you, BSD

採用された回答

Sean de Wolski
Sean de Wolski 2011 年 6 月 30 日
That error you're seeing has to do with the syntax or variable you're referencing when you call angle. Did you overwrite angle() with a variable?
whos angle
clear angle
angle(2+4i) %works
  2 件のコメント
Daniel Shub
Daniel Shub 2011 年 6 月 30 日
Man, I thought I was going to beat you.
Seungho  Kim
Seungho Kim 2018 年 12 月 3 日
never

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

その他の回答 (2 件)

Daniel Shub
Daniel Shub 2011 年 6 月 30 日
The function angle is the correct function. The error is unrelated. You are likely not simple calling
angle(x)
but rather
angle(x(y))
where y is either a scalar or an array, but with at least one element that is not a real positive integer as the error tells you.
If you truly are only calling angle(x)
then you must have defined a function someplace on the search path called angle.

Fangjun Jiang
Fangjun Jiang 2011 年 6 月 30 日
>> angle([1+i,1-i,i,-i])
ans =
0.7854 -0.7854 1.5708 -1.5708
Do you have a variable called "angle" of your own?

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by