matlab的,高手看下哪里错了
function anws=niuton(x0,eps)
x0=input('x0=');
eps=input('eps=');
x(1)=x0;
k=1;
h=fun1(x(1))
while(h<eps)
f1=fun1(x(k));
f2=fun2(x(k));
x(k)=x(k)-f1/f2;
k=k+1;
h=fun1(x(k));
end
x(k)
fun(x(k))
%%
function f= fun(x)
f=x^2-6*x+2
%%
function f1= fun1(x)
syms x;
y=sym('x^2-6*x+2');
f1=diff(y);
%f1=y1;
%%
function f2= fun2(x)
syms x;
y=sym('x^2-6*x+2');
y1=diff(y);
f2=diff(y1);
%f2=y2;