Non-linear system of inequalities
Show older comments
I have a non-linear system of four inequalities (constraints) that I wish to solve for the two variables S and G, as follows:

I can solve this using WolframAlpha as shown here, but am curious how to solve this problem using MATLAB? Either a symbolic solution (like Wolfram provides) or a set of possible integer solutions (or something alike).
Accepted Answer
More Answers (1)
First plot some lines that bound the inequalities
% G>21
% 15<=S<=18
% 61<=2S+G<=63
% 30<=atan(S/G)<=45 -> sqrt(3)/3 <= S/G <= 1 -> G<=sqrt(3)S and G>=S
% Define functions
G1 = @(S) 61 - 2*S; % G >= G1
G2 = @(S) 63 - 2*S; % G <= G2
G3 = @(S) sqrt(3)*S; % G <= G3
S = [15 18];
plot(S,G1(S),S,G2(S),S,G3(S)),grid
s1 = 61/(2+sqrt(3)); s2 = 63/(2+sqrt(3));
g1 = G1(s1); g2 = G2(s2);
patch([s1, 18, 18, s2], [g1, 25, 27, g2],'y')
xlabel('S'), ylabel('G')
% then find the intersection points.
% The solutions are in the yellow patch area.
1 Comment
Martin Androvich
on 21 Aug 2021
Categories
Find more on Get Started with Optimization Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

