Undefined function 'matlabFunction' for input arguments of type 'double'.
Show older comments
I can't seem to figure out why I am getting the error for the code
function [r,n]= Problem25b(f,x1,tol,N)
if nargin<4 || isempty(N), N=20; end
if nargin<3 || isempty(tol), tol=1e-6; end
fp=matlabFunction(diff(f));
f2p=MatLabFunction(diff(f,2));
x=zeros(1,N+1);
x(1)=x1;
for n=1:N
x(n+1)=x(n)-(f(x(n))*fp(x(n)))/(fp(x(n)))^(2)-f(x(n))*f2p(x(n));
if abs(x(n+1)-x(n))<tol
r=x(n+1);
return
end
end
when I run it I get the error:
[r,n]=Problem25b('x^(3)+2x^(2)+x+2',-3,1e-6,20)
Undefined function 'matlabFunction' for input arguments of type 'double'.
Error in Problem25b (line 5)
fp=matlabFunction(diff(f));
Accepted Answer
More Answers (0)
Categories
Find more on Operations on Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!