Converting complex int16 matrix to 32 bit floating points(or double)
古いコメントを表示
Hi everyone, I have matrix which contains 100x1000 int16 values (complex values eg: 128 + 151i). How can I convert the complex values to 32 bit complex floating point or double? When I use conversion like this double(arr) then my signal is not looking like a correct signal. Any help would be appreciated.
Best Regards
Seref
4 件のコメント
Adam
2017 年 10 月 25 日
double( arr )
should work fine in theory.
seref
2017 年 10 月 25 日
seref
2017 年 10 月 25 日
Adam
2017 年 10 月 25 日
Whatever you scale it to it won't look any different when you plot it if it is just a constant scale factor.
Which values are giving the 'wrong' answer when converted?
回答 (1 件)
Walter Roberson
2017 年 10 月 25 日
complex( double(real(arr)) ./ 65535 * 2 - 1, ...
double(imag(arr)) ./ 65535 * 2 - 1)
10 件のコメント
seref
2017 年 10 月 25 日
Walter Roberson
2017 年 10 月 25 日
Can you attach the data, and attach a picture of what you expect the signal to look like?
seref
2017 年 10 月 26 日
Walter Roberson
2017 年 10 月 26 日
plot(real(rxsignal(1:600)))
and
plot(imag(rxsignal(1:600)))
That portion of the signal shows features sort of like what you are looking for.
My guess is that you are looking at something that is constellation encoded, but I am not sure which QAM it is using. Have you tried using https://www.mathworks.com/help/comm/ref/qamdemod.html or https://www.mathworks.com/help/comm/ref/vitdec.html ?
seref
2017 年 10 月 26 日
Walter Roberson
2017 年 10 月 26 日
Yes, you very likely need to demodulate.
There is a table of modulation schemes by WiFi standard at http://rfmw.em.keysight.com/wireless/helpfiles/n7617a/coding_and_modulation.htm . It looks like mostly OFDM is used, except for 802.11b and some forms of 802.11g: those use DSSS
seref
2017 年 10 月 26 日
編集済み: Walter Roberson
2017 年 10 月 26 日
Walter Roberson
2017 年 10 月 26 日
The part
double(int16((rx_signal{1}(1,:))*(2^15)))/(2^15))
effectively truncates at 15 bits plus sign.
The max() minus that... well, that cannot possibly produce the results seen in the .mat. If the original data was in the range -1 to +1, then after the double() part it would still be in that range, just with bits after the 15th binary place discarded. Suppose the max of the original data was 1, then when you subtract off the truncated signal, that would give you a range of 1-([-1 to 1]), which would be a range of 2 to 0. Multiply that by 2^15 and truncate as 15 data bits is going to give you a range of 0 to 32767 with the 32767 used for any value that was originally negative. The only values that can be negative in the outcome would be values very very close to the maximum in the data, and then only because using int16() to truncate the data rounds the results. For example .98766 becomes the slightly larger 0.9876708984375 after the truncation process, leading to a max() minus value of -0.3571200000005774199962615966796875 -- though it might be possible to show that even those values would map to 0 in the later int16 step.
seref
2017 年 10 月 28 日
Walter Roberson
2017 年 10 月 28 日
Ah, the max() line is commented out, and I mis-counted brackets before... it is just noise for the purposes of the discussion.
Okay, so we are back to the idea that the data must represent an encoding of the actual signal, and that you will need to demodulate.
カテゴリ
ヘルプ センター および File Exchange で Modulation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!