help-octave
[Top][All Lists]

## Re: contourc - Octave vs Matlab

 From: Kai Habel Subject: Re: contourc - Octave vs Matlab Date: Sun, 05 Apr 2009 20:39:42 +0200 User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

```Ben Abbott schrieb:
```
```On Apr 4, 2009, at 1:03 PM, Big Muscle wrote:

```
```Hello.

```
Is Octave’s contourc algorithm supposed to produced exactly same contours as Matlab algorithm? I would like to use Octave’s source code to my application, but it doesn’t provide same result as Matlab. The difference is that Matlab draws some countours at same level as two different contours, but Octave draws it as one.
```
```
I also tried to use PLPlot algorithm, but it has completely inversed problem – it sometimes draws two closed contours where Matlab draws only one closed contour.
```
```
I think my problem has something to do with saddle points where both algorithms use different techniques to choose which edges to connect.
```Is there something to do with this? Thank you!

Tomas
```
```
```
I'm confused as to the specifics. Can you provide a simple example illustrating the difference between Octave and Matlab?
```
Ben

_______________________________________________
Help-octave mailing list
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
```
```Try the following in octave and matlab:

A=zeros(4);
A(2,2)=1;
A(3,3)=1;
subplot(1,2,1);
contour(A,[0.5,0.5]);
B=zeros(4);
B(2,3)=1;
B(3,2)=1;
subplot(1,2,2);
contour(B,[0.5,0.5]);

```
octave creates for A a single contour, while matlab creates two. For B both create two contours. All results are valid, but it seems matlab is more consistent. If my time allows I will have a look at __contourc__.cc and see if there is an easy fix ... but no promises.
```
Kai

```