matlab解决ezplot的function has no real value

2025-10-02 05:26:32

1、定义一个符号变量;

syms x;

matlab解决ezplot的function has no real value

2、定义一个符号函数;

 f=log((1 - x^2)^(1/2)/(x - 1))

matlab解决ezplot的function has no real value

3、采用ezplot画图像;

ezplot(f);

matlab解决ezplot的function has no real value

4、会跳出下面错误;

Warning: Cannot plot log((1 - x^2)^(1/2)/(x - 1)):

This function has no real values. 

> In ezplot>ezplot1 at 479

  In ezplot at 145

  In sym.ezplot at 61 

Error in ezplot>ezplot1 (line 421)

    error(nargchk(4, 6, nargin, 'struct'));

Output argument "hp" (and maybe others) not assigned

during call to

"D:\MATLABR2012b\toolbox\matlab\specgraph\ezplot.m>ezplot1".

Error in ezplot (line 145)

                [hp, cax] = ezplot1(cax, f{1}, vars,

                labels, args{:});

Error in sym/ezplot (line 61)

   h = ezplot(fhandle(f));

1、分析:主要是因为我们的函数值在matlab的运算机制中不是是实数。

方法:改画图指令为

ezplot(real(f));

matlab解决ezplot的function has no real value

2、查看结果如图。

matlab解决ezplot的function has no real value

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢