You might as well use rand() for the initial guesses, unless you have physical knowledge that would suggest other values.
You are going to need to change your code. You have
f(x(n))=((-(100-DOT(i)))/(100))+(1/(x(n)-60))*(x(n)*exp(-Time(i)/x1)-60*exp(-Time(i)/60))
for i=1:43
while abs((f(x1)))>0.001
x(n+1)=x(n)-((x(n)-x(n-1)))*(f(x(n))/(f(x(n))-f(x(n-1))))
x0=x1;
x1=x2;
n=n+1;
end
end
which tries to define a formula for f(x(n)) based upon general n and i values. The only way to define a formula is with the Symbolic Toolbox, and symbolic formulas need to be define in terms of variables rather than array elements.
Adjusted code:
x1 = nan;
x2 = nan;
for i=1:43
f = @(X, X1) ((-(100-DOT(i)))/(100))+(1/(X-60))*(X*exp(-Time(i)/X1)-60*exp(-Time(i)/60));
while abs((f(x(n), x1)))>0.001
x(n+1) = x(n)-((x(n) - x(n-1))) * (f(x(n), x1) / (f(x(n),x1) - f(x(n-1),x1)));
x0=x1;
x1=x2;
n=n+1;
end
end
This adjusted code is unlikely to work, as I see errors in your formula, but it will at least pass syntax checking.
Best Answer