function r=root3(left,right,dx,degree,func)
% function r=root3(left,right,dx,degree,func)  finds root of func=0
%A Matlab function that finds a root of func=0
%  between tleft and tright.  dx gives the spacing.
%The name of the variable sought must be x.
% The polnomial degree is specified by degree.
% Example: root3(4,7,.01,4,'sin(x)')
x=left:dx:right;
f=eval(func);
c=polyfit(x,f,degree);
rv=roots(c);
for i=1:degree
   if imag(rv(i))==0
      if((rv(i)>left)&(rv(i)<right))
          r=rv(i);
	  return
       end
   end
end
