bugGNU Octave - Bugs: bug #66589, [octave forge] (communications)...

 
 

bug #66589: [octave forge] (communications) pammod should provide complex output

Submitter:  Jens Mueckenheim <jmueckenheim>
Submitted:  Fri 20 Dec 2024 09:26:41 AM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  None Assigned to:  None
Originator Name:  Jens Mueckenheim Open/Closed:  * Open
Release:  * stable Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 03 Jan 2025 10:04:56 AM UTC, comment #8: 

Many thanks for the changes!
I'm ok with adapting the description and also with keeping lines 69 - 71 active.

In the meantime I detected one more smaller issue:
At the moment, pammod will change the orientation between input and output vector, esp. when input is a column vector. Adding the following after line 71 would also solve this:


y = reshape(y,size(x));


Jens Mueckenheim <jmueckenheim>
Thu 02 Jan 2025 08:01:00 PM UTC, comment #7: 

I added the difference from Matlab in the function documentation https://sourceforge.net/p/octave/communications/ci/d9ec3c7f1f71fc5f27a7b675d34910bb5c82c741/


> When the current implementation will be kept, lines 69 to 71 would never be invoked and, hence, could be disabled.


I agree that they are unlikely to be invoked, but am not sure if it cannot happen.

Nir Krakauer <nir_krakauer>
Tue 31 Dec 2024 08:43:21 AM UTC, comment #6: 

You are right, either using the complex function ore taking a very small phi would produce the desired complex output.
So, I'll keep it up to you to decide if pammod would be changed.

When the current implementation will be kept, lines 69 to 71 would never be invoked and, hence, could be disabled.

Jens Mueckenheim <jmueckenheim>
Mon 30 Dec 2024 02:11:16 PM UTC, comment #5: 

I see. So just adding the line

tx = complex(tx);

in your script before calling awgn would fix the discrepancy?

Nir Krakauer <nir_krakauer>
Sun 29 Dec 2024 08:48:01 AM UTC, comment #4: 

I fully agree, that from conceptual point of view the current implementation delivers correct results when looking purely at real value modulation. However, the problem occurs when putting it together with the awgn function. In this case pure real values will generate the noise only on the real axis. This results in the lines on the x-axis visible in scatterplot. When having complex values (even with imaginary part equal to zero as provided by Matlab), awgn will generate the noise in both domains. This is visible as the circles around the constellation points in the scatterplot. With the same dB, the real only values produce more errors than the complex values. This behaviour is in principle also ok, but would now result in a difference between Octave and Matlab. To illustrate this, I attach another file, which produces a BER-plot (please note that qamdemod is not working correctly in current Octave implementation). With this, Matlab is producing the values, which are quite aligned with the theoretical model, while Octave differs by 3 dB. Interestingly, when changing phi by a very small amount (e.g. setting to eps), the results will fully align to the Matlab case.

(file #56720)

Jens Mueckenheim <jmueckenheim>
Thu 26 Dec 2024 02:14:58 PM UTC, comment #3: 

After initializing the random number generators in Octave and Matlab identically in your example (cf. https://stackoverflow.com/questions/71845642/rngdefault-for-rand-function-in-matlab-vs-octave), pammod gave the same result for both, except that Matlab returned a complex type (but with zero complex parts). The difference between the two then came in awgn, which also has a random component that is generated differently for Octave vs. Matlab. I tried to instead generate rx deterministically in your script, e.g.
 
rx = tx; rx(1:50) = circshift(tx(1:50), [0, 1]);

and in that case -- given the same tx and rx vectors -- Octave returned the same value as Matlab for biterr.

Nir Krakauer <nir_krakauer>
Thu 26 Dec 2024 09:05:12 AM UTC, comment #2: 

When simulating a simple communication the current behaviour produces together with the awgn function too many errors (cf. the enclosed test file). In fact, the SNR would need to be shifted by 3 dB. Only with complex values the correct number of errors are produced that fit to the theoretical behaviour of PAM.
BTW, my Matlab (at home I'm using the 2017 version, but I believe that this has not changed), produces with the same file complex modulation symbols.

(file #56717)

Jens Mueckenheim <jmueckenheim>
Wed 25 Dec 2024 12:54:40 AM UTC, comment #1: 

I don't think that's correct, Matlab's function also returns real values. Can you give an example where there is a problem with current pammod behavior?

Nir Krakauer <nir_krakauer>
Fri 20 Dec 2024 09:26:41 AM UTC, original submission:  

As in the associated Matlab function, pammod should provide complex output even in case of pure real values. An implementation example is given in the attached file (starting at line 69).

Jens Mueckenheim <jmueckenheim>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #56720:  modulation_test1.m added by jmueckenheim (2KiB - text/plain)
file #56717:  modulation_testx.m added by jmueckenheim (743B - text/plain)
file #56709:  pammod.m added by jmueckenheim (2KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nir_krakauer (Posted a comment)
  • -email is unavailable- added by jmueckenheim (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-12-29 jmueckenheim Attached File- Added modulation_test1.m, #56720
    2024-12-26 jmueckenheim Attached File- Added modulation_testx.m, #56717
    2024-12-20 jmueckenheim Attached File- Added pammod.m, #56709

    Back to the top

    Powered by Savane 3.14-708e.
    Corresponding source code