fsolve error : Failure in initial user-supplied objective function evaluation

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.

 採用された回答

Star Strider
Star Strider 2016 年 5 月 25 日
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.

2 件のコメント

Xiao Sidao
Xiao Sidao 2016 年 5 月 25 日
thank you.there is no error anymore,but it is hard to solve the problem with matlab.
Star Strider
Star Strider 2016 年 5 月 25 日
My pleasure.
I would try different initial ‘x0’ values. I do not know what you are doing, but it seems to be out of my areas of expertise, so I cannot make specific recommendations. Different initial parameter estimates can result in different solutions, so trying several is usually worth the effort.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Mathematics and Optimization についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by