bugGNU Octave - Bugs: bug #41458, plot(x,[y1,y2,y3]) does not work

 
 

bug #41458: plot(x,[y1,y2,y3]) does not work

Submitter:  Hartmut <hardy>
Submitted:  Tue 04 Feb 2014 06:33:33 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.8.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 05 Feb 2014 07:24:41 PM UTC, comment #3: 

Sorry for the confusion. You are totally right. The command in my bug report should be

plot(x,[a;b;c]);

Then it plots perfectly well in Octave 3.8.0 as well as in Matlab.

Please just close this issue.

Hartmut <hardy>
Wed 05 Feb 2014 01:25:50 PM UTC, comment #2: 

Hi,

I can support Mikes comment. plot(x,[a;b;c]); works in both Octave 3.8 and MATLAB.

[code]

>> ver

-------------------------------------------------------------------------------------------------------
MATLAB Version: 8.0.0.783 (R2012b)
MATLAB License Number: ---
Operating System: Linux 3.7.10-1.24-desktop #1 SMP PREEMPT Wed Oct 2 11:15:18 UTC 2013 (375b8b4) x86_64
Java Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
-------------------------------------------------------------------------------------------------------

>> x=[0:0.01:2*pi];

a = sin(x);
b = cos(x);
c = a.*b;

plot(x,[a,b,c]);
Error using plot
Vectors must be the same lengths.
[/code]

Kai Torben Ohlhus <siko1056>
Group Member
Tue 04 Feb 2014 07:51:49 PM UTC, comment #1: 

Hi, thanks for your bug report. Can you please double-check your example in Matlab and make sure you have your vector orientations correct?

Note that in your example, all of the vectors are row vectors, and in the plot command you provided you are concatenating the row vectors a, b, and c into one large row vector that is 3 times as long as x. I would be surprised if Matlab allowed that.

If you used [a;b;c] instead, you'd have a 3-by-600-something matrix and that plot command would work in Octave. Alternatively, if x were a column vector, the rest of your example would work perfectly in Octave as well.

Mike Miller <mtmiller>
Group Member
Tue 04 Feb 2014 06:33:33 PM UTC, original submission:  

In Matlab there is the possibility to plot several vectors (of equal length) against one common x vector. This does currently (version 3.8.0) NOT work in Octave.

Here is an example:


x=[0:0.01:2*pi];
a = sin(x);
b = cos(x);
c = a.*b;

plot(x,[a,b,c]);


In Octave this throughs an error:
error: _plt2vv_: vector lengths must match

In Matlab it generates a plot that is identical to

plot(x,a,x,b,x,c);


Hartmut <hardy>

 

(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 siko1056 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by hardy (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
    2014-02-05 mtmiller StatusNeed Info Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
    2014-02-04 mtmiller StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code