bugGNU Octave - Bugs: bug #43614, Plotting of a Nested Function Fails

 
 

bug #43614: Plotting of a Nested Function Fails

Submitter:  Martin Vahi <martin_vahi>
Submitted:  Fri 14 Nov 2014 07:11:52 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.6.2 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 14 Nov 2014 07:49:39 PM UTC, comment #4: 

This is not a bug in octave but in your script as Matthias already explained. You are trying to do a matrix multiplication (a single star symbol) on 2 equal vectors. Try "x*x" and you'll get the same error message. We think you want an element-by-element multiplication:


plot (x, sin (x) + sin (x * 4 .* sin(x)));


See https://www.gnu.org/software/octave/doc/interpreter/Simple-Examples.html#Elementary-Calculations and https://www.gnu.org/software/octave/doc/interpreter/Arithmetic-Ops.html#Arithmetic-Ops

Closing as invalid.

Andreas Weber <andy1978>
Group Member
Fri 14 Nov 2014 07:47:58 PM UTC, comment #3: 

Is this what you want?

plot(x,sin(x)+sin(x.*4.*sin(x)));

Doug Stewart <dastew>
Fri 14 Nov 2014 07:41:03 PM UTC, comment #2: 

sorry, it has to be

plot(x,sin(x)+sin(x*4.*sin(x)));

or even

plot(x,sin(x).+sin(x.*4.*sin(x)));


Matthias Jüschke <maju>
Fri 14 Nov 2014 07:38:17 PM UTC, comment #1: 

x is a vector. If you multiply a vector with another vector, the dimensions must fit. Because they don't fit, the error message is displayed.
You want to multiply each element of one vector with the corresponding element of the other vector. So you have to insert a dot in front of the operator '*' and write

plot(x,sin(x)+sin(x.*4*sin(x)));


Matthias Jüschke <maju>
Fri 14 Nov 2014 07:11:52 PM UTC, original submission:  


The plotting of

    y=sin(x)+sin(x + 4 * sin(x))

works and the plotting of

    y=sin(x)+sin(x Y 4 Y sin(x))
   
where the Y is the star symbol, "*", fails.

To avoid flawtrack markup related distortions, the console output resides in a separate file called "2014_11_14_octave_plotting_flaw.txt".


Martin Vahi <martin_vahi>

 

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

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by dastew (Posted a comment)
  • -email is unavailable- added by maju (Posted a comment)
  • -email is unavailable- added by martin_vahi (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-11-14 andy1978 Open/ClosedOpen Closed
    2014-11-14 andy1978 StatusNone Invalid / Not an Octave Bug
    2014-11-14 martin_vahi Attached File- Added 2014_11_14_octave_plotting_flaw.txt, #32437

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code