bugGNU Octave - Bugs: bug #33849, Incorrect plot result when mixing...

 
 

bug #33849: Incorrect plot result when mixing complex values and real integers

Submitter:  Steve Duncan <shd01>
Submitted:  Sun 24 Jul 2011 06:52:48 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Steve Duncan Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 17 Oct 2013 06:30:27 PM UTC, comment #7: 

Is there anything to fix here?  I just tested


x = 1:10;
plot (x+i, x+2i);


and it is equivalent to 'plot (x,x)' which is what Matlab does.  Perhaps we can close this before the 3.8 release.

Rik <rik5>
Group administrator
Fri 02 Sep 2011 03:08:35 AM UTC, comment #6: 

hmm .... my post got cut off :-(

Matlab will treat ...

plot (x + 1i, x +2i)

... the same as ...

plot (x, x)

Perhaps Octave can use format specifications as implicit delimiters for objects. If so, this feature should be well documented to avoid confusion.

Ben Abbott <bpabbott>
Group Member
Fri 02 Sep 2011 02:50:30 AM UTC, comment #5: 

I expect some confusion with how the code below should behave.


x = 0:10;
plot (x + 1i, x + 2i)
-verbatim+

Matlab will treat it as ...

+verbatim+
x = 0:10;
plot (x, x)
-verbatim+

... and give warnings.

Perhaps a patch can be provided that requires a format specification in order to separate the plot objects? In which case, if the feature is well documented I don't think it will be a source of confusion.

Ben Abbott <bpabbott>
Group Member
Mon 25 Jul 2011 07:47:05 PM UTC, comment #4: 

Yeah, I didn't realise it didn't work on Matlab either. I use it all the time too. Turns out that if you give plot arguments for more than one plot, then you have to specify x-y pairs, can't use implicit x anymore.

At any rate, the question is, do we want to introduce another Matlab incompatibility here, for the case using hold that does work on both and produces the same output on both?

Jordi Gutiérrez Hermoso <jordigh>
Group Member
Mon 25 Jul 2011 07:14:46 PM UTC, comment #3: 

Good lord!  I've been using this feature for ages - I had no idea.

It's so useful, it ought to be supported...

Steve Duncan <shd01>
Mon 25 Jul 2011 01:23:31 PM UTC, comment #2: 

By the way, calling plot this way seems to work by accident on Octave (plot's docstring doesn't mention this way of calling it) and it fails on Matlab. However, the equivalent calls


hold on
plot(exp(j*2*pi*[0:4]/4),'r-*')
plot(1:2,'b-*')
hold off


do work on Matlab and produce the same results as in Octave. While I agree the results are surprising, perhaps there's a good reason why they are so.

Jordi Gutiérrez Hermoso <jordigh>
Group Member
Sun 24 Jul 2011 07:01:56 PM UTC, comment #1: 

The problem persists in the dev version. This command makes it a bit easier to see:

plot(exp(j*2*pi*[0:4]/4),'r-*',1:2,'b-*')


Jordi Gutiérrez Hermoso <jordigh>
Group Member
Sun 24 Jul 2011 06:52:48 PM UTC, original submission:  

The following code causes the blue star to appear at position (1+j):

plot(exp(j*2*pi*[0:3]/4),'r*',1,'b*')

whereas the following is plotted correctly:

plot(exp(j*2*pi*[0:3]/4),'r*',j,'b*')


Steve Duncan <shd01>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by shd01 (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-23 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2011-07-24 jordigh StatusNone Confirmed
        Release3.2.4 dev

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code