function (ans)=Newton (fun, a, count, e)
% this function is used for solving the equation root;
% by Newton iteration method, f is the target equation, a is the starting point, the count for the maximum number of iterations, e for accuracy;
Syms x;
Df=diff (fun (x));
X0=a;
For (I=1: count)
X1=x0 - fun (x0)/subs (df, x0);
If (abs (x1 - x0) & gt; E)
X0=x1;
End
End
Ans=x0;
error using sym/subsindex (line 825)
Invalid indexing the or function definition. Indexing must follow indexing. The MATLAB function the arguments must be
-- the variables, and the function body must be sym expression.
Newton error (line 5)
Df=diff (fun (x));
Has been the jump wrong, hope everybody to help me see what the problem is