real-valued signal constellation has hidden imaginary part

Hi guys!
I found something which isn't so nice in Matlab. When you create a demodulator object with
h = modem.pammod('M',2,'InputType', 'Bit','SymbolOrder','Gray');
the signal constellation should be real-valued. If you look at h.constellation you see no imaginary part, but isreal(h.constellation) gives back a zero, which means the constellation points do have a imaginary part. For me it was a little bit annoying, because I cannot use mxIsComplex to determine whether a signal constellation is complex or real-valued. Do you have any clever suggestions for a workaround.
best regards, Bernhard

 採用された回答

Bernhard Schmidt
Bernhard Schmidt 2011 年 2 月 10 日

0 投票

Wow, thanks, Walter! Why does this work?

2 件のコメント

Walter Roberson
Walter Roberson 2011 年 2 月 10 日
When Matlab does a plain assignment, it just creates a new variable header pointing to the old information. But when you do any arithmetic operation on a complex array, Matlab checks for the case of all-zero complex part and drops the complex part in that case. Adding 0 preserves any complex part that is really there, but triggers the check on the complex part.
Interestingly, double(h.constellation) does *not* trigger the check for all-zero complex part.
Bernhard Schmidt
Bernhard Schmidt 2011 年 2 月 10 日
Thanks again

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 2 月 9 日

1 投票

isreal(h.constellation + 0)
I don't know a fast way to do that at the mex level though.

カテゴリ

ヘルプ センター および File Exchange で PHY Components についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by