My code is:
format long;b=50;a=3;e=50;spdf = @(x) a.*(b.^a)./(x+b).^(a+1)./(1-(b./(e+b)).^a);fun21 = @(x,u,m) min(x,max(0,fzero(@(y) 0.5.*(100-10-x+y).^(-0.5)-m-2.*u.*y,0))).*spdf(x); fun31 = @(u,m) integral(@(x) fun21(x,u,m),0,e,'arrayvalued', true); % first moment of optimal insurance contract
[us,ms]=solve([fun31(u,m)-12==0, fun3(u,m)-178.57145==0], [u m]);
The error is:
Function value at starting guess must be finite and real.
I think my fzero function can give a finite value. Maybe the error is coming from u and m? Any one could help me fix the code? Thanks a lot!
Best Answer