Hi Everyone, my code is:
format long;
b=50;a=3;e=50;
spdf = @(x) 3.*(50.^3)./(x+50).^(3+1)./(1-(50./(50+50)).^3);
fun2 = @(x,u,m) min(x,max(0,fzero(@(y) 0.5.*(100-12-x+y).^(-0.5)-m-2.*u.*y,0))).^2.*spdf(x);
fun3 = @(u,m) integral(@(x) fun2(x,u,m),0,50,'arrayvalued', true);
fun21 = @(x,u,m) min(x,max(0,fzero(@(y) 0.5.*(100-12-x+y).^(-0.5)-m-2.*u.*y,0))).*spdf(x);
fun31 = @(u,m) integral(@(x) fun21(x,u,m),0,50,'arrayvalued', true);
[us,ms] = solve([fun31(u,m)-12==0, fun3(u,m)-178.57145==0], [u m])
The error is:
Error using fzero (line 328)
Function value at starting guess must be finite and real.
I try to solve two equations with two parameters. But it invloves fzero in my equation. One staff gave me some suggestion. But I didn't figure it out. Anyone can help me fix my code? Any help is very appreciated!
Best Answer