Undefined function 'eval' for input arguments of type 'double'.
6 次查看(过去 30 天)
显示 更早的评论
When using the code below:
function [Df]=difc(f,u,h)
syms x
x=u+h; lp=eval(f);
x=u-h; ll=eval(f);
Df=(lp-ll)/(2*h);
end
, the same error keeps appearing ''Undefined function 'eval' for input arguments of type 'double'.''
I would like to know what´s the problem and what can I do to solve it, in order to have a working code.
Thankyou very much
2 个评论
Walter Roberson
2012-11-8
What are you passing in to the function?
Note: your assignments to "x" are undoing the effect of "syms x".
采纳的回答
C.J. Harris
2012-11-8
You are getting that error because you are trying to evaluate a double. A double is just a double - there is nothing there to evaluate.
What are you expecting the 'eval' function to do?
2 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!