Is there a way in matlab to restrict variables in a function
For example i have a function
function S0 = S0Func(obj, c, delta, xT, sigma)
beta = obj.betaFunc(sigma);
xb = obj.xbFunc(c, delta, sigma);
S0 = (1-obj.tau).*(obj.x0./(obj.r-obj.mu)-c./obj.r-(xb./(obj.r-obj.mu)-c./obj.r).*((obj.x0./xb).^beta)-((delta-1).*c./obj.r).*((obj.x0./xT).^beta-((obj.x0./xb).^beta)));
end
where I would like to have the restrictions (obj is an object of a class)
0<xb<xT<1
0<c
1<delta
What I would like to do is to draw a 3d graph of the following with the restrictions mentioned above
S0Func(2.7, 1, 1, 0.3)-S0Func(c,delta,xT,0.2)<0;
EDIT I have tried using the isosurface
optimalStraightCoupon = fminbnd(@(c) -(S0Function(c,1,1)+D0Function(c,1,1)), 0, 4);
[xT, delta, c] = meshgrid(0.8:.01:1, 1:.1:3, 0:.1:4);
values = S0Function(optimalStraightCoupon,1, 1)- S0Function(c,delta, xT);
patch(isosurface(xT, c, delta, values, 1), 'FaceColor', 'red');
view(3);
I get some output, but it is not correct as the restriction on xT is violated.
Any help is appreciated. Thank you.