MATLAB: Fsolve error : Failure in initial user-supplied objective function evaluation

fsolve nonlinear equationMATLAB

first m-file:
function F = creepfit(x)
upsilon=[0.894 0.192 0.14488
108.585 1.706 0.0068
204.602 2.31 0.0057
293.052 2.81 0.00579
402.769 3.511 0.00743
503.333 4.406 0.01152
602.433 6.323 0.0357];
t=upsilon(:,1);e=upsilon(:,2);de=upsilon(:,3);
sigma=130;
F = [x(1).*x(2).*e(1).*sinh(sigma.*(exp(x(3).*e(1)./(sigma.x(4)))-x(4)+1).*(x(5).*t(1)).^0.3333/(x(6).*(1-x(7).*e(1))))-de(1);
x(1).*x(2).*e(2).*sinh(sigma.*(exp(x(3).*e(2)./(sigma.x(4)))-x(4)+1).*(x(5).*t(2)).^0.3333/(x(6).*(1-x(7).*e(2))))-de(2);
x(1).*x(2).*e(3).*sinh(sigma.*(exp(x(3).*e(3)./(sigma.x(4)))-x(4)+1).*(x(5).*t(3)).^0.3333/(x(6).*(1-x(7).*e(3))))-de(3);
x(1).*x(2).*e(4).*sinh(sigma.*(exp(x(3).*e(4)./(sigma.x(4)))-x(4)+1).*(x(5).*t(4)).^0.3333/(x(6).*(1-x(7).*e(4))))-de(4);
x(1).*x(2).*e(5).*sinh(sigma.*(exp(x(3).*e(5)./(sigma.x(4)))-x(4)+1).*(x(5).*t(5)).^0.3333/(x(6).*(1-x(7).*e(5))))-de(5);
x(1).*x(2).*e(6).*sinh(sigma.*(exp(x(3).*e(6)./(sigma.x(4)))-x(4)+1).*(x(5).*t(6)).^0.3333/(x(6).*(1-x(7).*e(6))))-de(6);
x(1).*x(2).*e(7).*sinh(sigma.*(exp(x(3).*e(7)./(sigma.x(4)))-x(4)+1).*(x(5).*t(7)).^0.3333/(x(6).*(1-x(7).*e(7))))-de(7);]
second m-file:
x0=ones(7,1);
h=@creepfit;
x=fsolve(h,x0);
error messarges:
Struct contents reference from a non-struct array object.
Error in creepfit (line 11)
F =
[x(1).*x(2).*e(1).*sinh(sigma.*(exp(x(3).*e(1)./(sigma.x(4)))-x(4)+1).*(x(5).*t(1)).^0.3333/(x(6).*(1-x(7).*e(1))))-de(1);
Error in fsolve (line 218)
fuser = feval(funfcn{3},x,varargin{:});
Error in runfitting (line 3)
x=fsolve(h,x0);
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.

Best Answer

You forgot the ‘*’ in this multiplication:
F = [x(1).*x(2).*e(1).*sinh(sigma.*(exp(x(3).*e(1)./(sigma.x(4)))-x(4)+1).*(x(5).*t(1)).^0.3333/(x(6).*(1-x(7).*e(1))))-de(1);
^ <INSERT *HERE
Since you copied that line and pasted it (with some changes) in the rest of your ‘F’ assignment, the same error occurs in every line.
This works:
F = [x(1).*x(2).*e(1).*sinh(sigma.*(exp(x(3).*e(1)./(sigma.*x(4)))-x(4)+1).*(x(5).*t(1)).^0.3333/(x(6).*(1-x(7).*e(1))))-de(1);
x(1).*x(2).*e(2).*sinh(sigma.*(exp(x(3).*e(2)./(sigma.*x(4)))-x(4)+1).*(x(5).*t(2)).^0.3333/(x(6).*(1-x(7).*e(2))))-de(2);
x(1).*x(2).*e(3).*sinh(sigma.*(exp(x(3).*e(3)./(sigma.*x(4)))-x(4)+1).*(x(5).*t(3)).^0.3333/(x(6).*(1-x(7).*e(3))))-de(3);
x(1).*x(2).*e(4).*sinh(sigma.*(exp(x(3).*e(4)./(sigma.*x(4)))-x(4)+1).*(x(5).*t(4)).^0.3333/(x(6).*(1-x(7).*e(4))))-de(4);
x(1).*x(2).*e(5).*sinh(sigma.*(exp(x(3).*e(5)./(sigma.*x(4)))-x(4)+1).*(x(5).*t(5)).^0.3333/(x(6).*(1-x(7).*e(5))))-de(5);
x(1).*x(2).*e(6).*sinh(sigma.*(exp(x(3).*e(6)./(sigma.*x(4)))-x(4)+1).*(x(5).*t(6)).^0.3333/(x(6).*(1-x(7).*e(6))))-de(6);
x(1).*x(2).*e(7).*sinh(sigma.*(exp(x(3).*e(7)./(sigma.*x(4)))-x(4)+1).*(x(5).*t(7)).^0.3333/(x(6).*(1-x(7).*e(7))))-de(7);]
You also could have used a for loop.