注册 登录
编程论坛 Matlab

请高手帮忙,谢啦

发布于 2010-05-06 17:17, 970 次点击
Function 'sqrt' is not defined for values of class 'int16'.

Error in ==> sqrt at 15
  [varargout{1:nargout}] = builtin('sqrt', varargin{:});
MATLAB中在用sqrt函数时显示如下问题,难道是sqrt不能对16位整型数进行操作,请各位高手解答,不胜感激
1 回复
#2
xylenedox2010-05-07 10:05
出错提示写得很清楚,sqrt不能对int型操作,可以简单转换成double或single型再调用。
y = double(x);
sqrt(y);
1