Normalizing a complex number

46 ビュー (過去 30 日間)
A VP
A VP 2019 年 3 月 20 日
回答済み: Walter Roberson 2019 年 3 月 20 日
I have a complex matrix with real numbers in column 1 and imaginary numbers in column 2. I used this approach, but still did not get a scalar when I try to calculate the square root of sum of squares.
Any help is much appreciated.
complex number input :
-0.0030 -0.0035
0.0709 -0.0359
-0.0949 0.0469
0.0369 -0.0133
-0.0139 -0.0029
Sum_of_Sq = sqrt(sum(abs((input).^2)));
Output = sqrt(Sum_of_Sq);

回答 (2 件)

James Tursa
James Tursa 2019 年 3 月 20 日
編集済み: James Tursa 2019 年 3 月 20 日
It is not clear what you are trying to do. You use the word "normalize" but it looks like maybe you are just trying to find the magnitudes of the complex numbers. Which is it? If it is magnitude, and you have a Mx2 real matrix with the real parts in column 1 and the imaginary parts in column 2, then use the 2nd argument of the sum( ) function to specify the sum across rows. E.g.,
c = your matrix of real & imag numbers
result = sqrt(sum(c.^2,2));
Or,
result = hypot(c(:,1),c(:,2));
  1 件のコメント
A VP
A VP 2019 年 3 月 20 日
I am trying to calculate the square root of sum of squares of this complex matrix. The expected output is a scalar.

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


Walter Roberson
Walter Roberson 2019 年 3 月 20 日
sqrt(sum(complex(YourArray(:,1),YourArray(:,2)).^2))

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by