how to set the domain of a function
13 views (last 30 days)
Show older comments
Patience Shamaki
on 18 Jul 2021
Commented: Patience Shamaki
on 19 Jul 2021
Hello please how do I set the domain for my function :
f(x1,x2)= -9*x(1) - 10*x(2) + 10*(-log(100-x(1)-x(2))-log(x(1))-log(x(2))-log(50-x(1)+x(2)));
X{(x1,x2)|x1>0,x2>0,x1+x2<100,x1-x2<50}
thanks
0 Comments
Accepted Answer
Walter Roberson
on 19 Jul 2021
syms x [1 2]
f(x) = piecewise(x(1)>0 & x(2)>0 & x(1)+x(2) <100 & x(1)-x(2)<50, -9*x(1) - 10*x(2) + 10*(-log(100-x(1)-x(2))-log(x(1))-log(x(2))-log(50-x(1)+x(2))), NaN)
fsurf(f, [-5 105 -5 105] ); xlim([-5 105]); ylim([-5 105])
4 Comments
Walter Roberson
on 19 Jul 2021
syms x [1 2]
Notice the space.
However I see now that you are using an older release. You would need
x = sym('x', [1 2]);
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
