# bug #53548: area : Octave giving error while MATLAB giving warning in complex input.

 Submitter: Dildar Sk Submitted: Mon 02 Apr 2018 05:49:48 PM UTC Category: Octave Function Severity: 3 - Normal Priority: 5 - Normal Item Group: Other Status: Wont Fix Assigned to: None Originator Name: Dildar Sk Open/Closed:  * Closed Release:  * dev Operating System:  * GNU/Linux
* Mandatory Fields

Add a New Comment

Comment Type & Canned Response:

## Discussion

Mon 16 Apr 2018 09:04:19 PM UTC, comment #2:

I believe it is better to leave this as an error.  Octave, in general, tries to validate its inputs more carefully than Matlab.

In this case, it's not clear what an area plot of a sequence of complex numbers would look like.  It doesn't make much sense, and it probably means the programmer has made an error and it should be reported that way.  If the programmer really wants to see an area plot of just the real part of the data then they can easily do so by adding a call to real() inside the call to area like so

area (real (a))

This is better than Matlab's default assumption that the real data is more valuable than the complex data and should be the part that is plotted.  For example, another perfectly good choice would have been to plot the magnitude of the complex number, rather than just the real part.

Rik <rik5>
Tue 10 Apr 2018 07:24:13 PM UTC, comment #1:

Dear,

I think that this can be solved modifying the input validation. I attach a file which should work.
Moreover, if in Matlab the scalar argument is given complex, it uses the real part without giving any warning (try area (1:5, 1i) ). In the modification I did a warning is given.

Michele Ginesi <m_ginesi>
Mon 02 Apr 2018 05:49:48 PM UTC, original submission:

In MATLAB,

>> a = [1:10] + i;
>> area (a)
Warning: Using only the real component of complex data.
> In getRealData (line 52)
In area (line 49)
>>

In Octave,

>> a = [1:10] + i;
>> area (a)
error: area: X and Y must be real vectors or matrices
error: called from
area at line 96 column 5
>>

Dildar Sk <hodor123456>

## Attached Files

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

Attach Files:

Comment:

Attached Files
file #43873:  area.diff added by m_ginesi (2KiB - text/x-patch)

## Dependencies

Depends on the following items: None found

Items that depend on this one: None found

## Mail Notification Carbon-Copy List

Carbon-Copy List
• -email is unavailable- added by rik5 (Posted a comment)
• -email is unavailable- added by m_ginesi (Updated the item)
• -email is unavailable- added by hodor123456 (Submitted the item)
• -email is unavailable- added by hodor123456
•

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 project members can vote.

## History

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2018-04-16 rik5 StatusNone Wont Fix
Open/ClosedOpen Closed
2018-04-10 m_ginesi Attached File- Added area.diff, #43873
2018-04-02 hodor123456 Carbon-Copy- Added -email is unavailable-