# Solving non linear inequalities in 2 variables

18 visualizzazioni (ultimi 30 giorni)
Manas il 5 Feb 2024
Commentato: Ujjawal il 1 Apr 2024 alle 6:16
I have the following inequalities that I need to solve and find the range of the variables (a and T) to solve my control problem -
24 - 8*a - 2*a^2 + (2*a^2)/T + (2*a^2)/T^2 + (20*a)/T < 0
- 8*a - (8*a)/T + 32/T - 2*a^3 - (16*a^2)/T - (2*a^3)/T - (4*a^2)/T^2 - (2*a^3)/T^2 - 32 < 0
4*a- (8)/T < 0
How should I do this in matlab ?
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Ujjawal il 1 Apr 2024 alle 6:16
Are you from IIT delhi?

Accedi per commentare.

### Risposta accettata

John D'Errico il 5 Feb 2024
Modificato: John D'Errico il 5 Feb 2024
The "range of variables? Those inequalities will generally describe some nonlinear "thing", even if they describe a bounded domain. In fact, it is entirely possible the bounds are not even finite, since we see 1/T all over the place. It is also very possible that no solution exists at all.
As well, you use a strict inequality. But no tool working in floating point arithmetic can specify a strict inequality like that.
So there is likely no simple range you can derive from those inequalities. At best, we can use the final inequality to learn that a must be less than 2/T, But that is useless, since T can be infinitely large. And if T is near zero, then a can be infinitely large. And if T is negative, then a can go out to minus infinity. Can we do anything?
Well, we can turn the inequalities into strict equalities, and plot them. But we won't really know which side of those curves is good.
syms a T
fimplicit(4*a - 8/T == 0,'r')
hold on
fimplicit(24 - 8*a - 2*a^2 + (2*a^2)/T + (2*a^2)/T^2 + (20*a)/T == 0,'g')
fimplicit(-8*a - (8*a)/T + 32/T - 2*a^3 - (16*a^2)/T - (2*a^3)/T - (4*a^2)/T^2 - (2*a^3)/T^2 - 32 == 0,'b')
hold off
You should see that no matter what, the result will be a mess. Another idea is to turn the problem into a discrete one, so not truly exact, but it will give you an idea. I'll go out pretty far in both a and T. And I'll use a very fine grid. Finally, note my careful use of the dotted operators below, to insure the correct computations will be done.
[a,T] = meshgrid(linspace(-50,50,5000));
good = (24 - 8*a - 2*a.^2 + (2*a.^2)./T + (2*a.^2)./T.^2 + (20*a)./T < 0) &...
(-8*a - (8*a)./T + 32./T - 2*a.^3 - (16*a.^2)./T - (2*a.^3)./T - (4*a.^2)./T.^2 - (2*a.^3)./T.^2 - 32 < 0) & ...
(4*a- (8)./T < 0);
plot(a(good),T(good),'.')
Do you see that no plot was produced? Why not? How many points were identified in that domain, that satisfy all three of those inequalities?
find(good)
ans = 0×1 empty double column vector
That suggests the locus that satisfies all three of those inequalities may be the null sel. Now, maybe I did not go out far enough in either a or T. But it seems like all of the action was happening not too far away from zero. So if any solution does exist, it should have been seen. I will postulate the solution is actually rather easy. The viable range of those variables is probably the null set.
##### 3 CommentiMostra 1 commento meno recenteNascondi 1 commento meno recente
John D'Errico il 5 Feb 2024
Yes. My guess is you have some error in the equations, as they seem inconsistent. The trick I used with meshgrid should produce a result though, if a solution does exist. You may need to push it out further of course, as I don't know what is even reasonable there. For example, must they both always be positive? Since I have no idea what the variables represent, I cannot know.
Manas il 6 Feb 2024
No worries, I have resolved the problem. Thanks for your help.

Accedi per commentare.

### Più risposte (1)

Kzkzv il 9 Mar 2024
% parametres k = 1; % Conductivité thermique dx = 1; % Pas de discrétisation 9 = 1; 1; % Flux constant % Nombre de nœuds n = 12; % Matrice A A = zeros(n, n); A(1, 1) = -2*k/dx; A(1, 2) = k/dx; for i = 2:n-1 end A(i, i-1) = k/dx; A(i, 1) = -2*k/dx; i) A(i, i+1) = k/dx; A(n, n-1) = k/dx; A(n, n) = -k/dx; % Vecteur B B = zeros(n, 1); B(1) = q; = B(n) 100; % Condition aux limites % Résolution du système linéaire T = A \ B; % Affichage des résultats disp('Températures aux nœuds :') disp(T)
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Walter Roberson il 9 Mar 2024
This does not appear to solve the original problem stated ??

Accedi per commentare.

### Categorie

Scopri di più su Classical Control Design in Help Center e File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by