Matlab \ Octave与轮廓f的结果不同 [英] Matlab\Octave haven't the same result with contourf

查看:124
本文介绍了Matlab \ Octave与轮廓f的结果不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在八度音阶中使用contourf有一个问题.
如果我在octave和matlab中测试以下代码,结果将完全不同. Matlab的结果很好.

I have a problem to use contourf in octave.
If I test the following code in octave and matlab, the result is not at all the same. The result with Matlab is good.

A1=[38    44    51    58    65    72    79    86    93   100
    38    44    51    58    65    72    79    86    93   100
    38    44    51    58    65    72    79    86    93   100
    38    44    51    58    65    72    79    86    93   100
    38    44    51    58    65    72    79    86    93   100
    38    44    51    58    65    72    79    86    93   100
    38    44    51    58    65    72    79    86    93   100
    38    44    51    58    65    72    79    86    93   100
    38    44    51    58    65    72    79    86    93   100
    38    44    51    58    65    72    79    86    93   100]

B1=[ 1     1     1     1     1     1     1     1     1     1
    12    12    12    12    12    12    12    12    12    12
    23    23    23    23    23    23    23    23    23    23
    34    34    34    34    34    34    34    34    34    34
    45    45    45    45    45    45    45    45    45    45
    56    56    56    56    56    56    56    56    56    56
    67    67    67    67    67    67    67    67    67    67
    78    78    78    78    78    78    78    78    78    78
    89    89    89    89    89    89    89    89    89    89
   100   100   100   100   100   100   100   100   100   100]

C1=[NaN    NaN    NaN    NaN    NaN    NaN    NaN    NaN    NaN    NaN
    NaN    687    585    865   1045   1283   2465   2661   3042    NaN
    NaN    356    390    426    473    519    574    627   1253    NaN
    NaN    330    334    330    377    423    455    502    583    NaN
    NaN    305    314    330    348    369    395    430    458    NaN
    NaN    NaN    299    306    323    345    366    389    420    NaN
    NaN    NaN    294    302    310    323    340    364    396    NaN
    NaN    NaN    NaN    295    301    314    326    345    371    NaN
    NaN    NaN    NaN    NaN    297    306    318    334    351    NaN
    NaN    NaN    NaN    NaN    NaN    NaN    NaN    NaN    345    NaN]

[c,h]=contourf(A1,B1,C1,[200,300,400,500,600])

有人可以解释为什么八度音阶提供的结果与预期不同吗?

Can somebody explain why octave provides a different result than expected?

推荐答案

这是

This a known bug. With octave 3.8.2 the resulting image is

如注释2中所述,一种解决方法是将NaN更改为-inf,以闭合轮廓.

As explained in comment #2, a workaround is to change the NaN to -inf, in order to close the contours.

确实是

C1(isnan(C1)) = -inf;
[c,h]=contourf(A1,B1,C1,[200,300,400,500,600])

情节看起来更好.

这篇关于Matlab \ Octave与轮廓f的结果不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆