Here is my Matlab code
syms x(a) a
x(a) = a ;
D = [[1], [2.6], [3.0], [3.3], [3.5], [3.9], [4.0], [4.2], [5.7]];
syms g(z) z x(a) D(a)
g(z) = symsum(x(a).*D(a).*exp(-z.*x(a)), a, 1, 9) + 75.*x(10).*exp(-z.*x(10)) ;
h = diff(g) ;
z(1)=0.6 ;
for m=1:1000
z(m+1) = z(m) - g(z(m))/h(z(m));
if( abs( g(z(m+1)) - g(z(m)) ) < 0.00001 )
disp(double(z(m+1)));
break;
end
end
When trying to run it I keep getting the error: Conversion to logical from sym is not possible.
Error in errcode (line 12) if( abs( g(z(m+1)) - g(z(m)) ) < 0.00001 )
However, I thought in my following line the use of double() would fix this issue and return a float value. Does anyone have any advice?