Solve an inequality involving a function of time

2 views (last 30 days)
Good afternoon everyone, I am looking for solving an inequality involving a function of time as follow:
a * u(t) + b < alpha
with a, b and alpha are constant variables; and u(t) a function of time t
I want to find the set of u(t) that respect the above inequality.
In order to solve this problem, I run the following script:
syms t a b alpha;
u(t) = sym('u(t)');
eqn = a*u(t) + b < alpha;
eqn = rewrite(eqn,'log');
[solx, param, cond] = solve(eqn, u(t), 'ReturnConditions',1);
clc
disp('solx')
pretty(solx)
disp('param')
pretty(param)
disp('cond')
Unfortunately, it does not solve the inequality by conducting to an empty structure (solx, param and cond). I tried to replace u(t) by t in order to follow a similar code provided by the Mathworks help solve function and it works well even it is not my problem ... Many thanks for your help,
Regards,
Mathias

Answers (1)

Walter Roberson
Walter Roberson on 19 Jun 2018
Edited: Walter Roberson on 19 Jun 2018
Is there a particular reason you are doing the rewrite to log?
With current versions you cannot use sym('u(t)') and should instead use
syms u(t) a b alpha
Are you expecting an answer different from u(t) < (alpha - b)/a ?
MATLAB is sometimes weak about reasoning about functions, and weak about reasoning about inequalities. The work-around is to convert into an equality and use isolate()
syms u(t) a b alpha
syms du positive
eqn = a*u(t) + b + du == alpha
solu = expand(isolate(eqn, u(t)))
This gives
u(t) == alpha/a - b/a - du/a
Then, knowing that du is an arbitrary positive quantity, then in the case where a is positive, you can interpret this as
u(t) < alpha/a - b/a
but if a is negative you need to change to >
  4 Comments
mathias dupont
mathias dupont on 20 Jun 2018
Ok thanks for your explanations. To complete them, I recommend for future users the link as follow. Course
I have another question because I guess I do not use the right function to solve my problem ... If I add now new constraints as follow
a*u'(t) < B
with a, B constant variables and u'(t) the derivative function of u(t) according to the time t.
Which function I need to use according to you to solve this problem please ?
Thanks for your help,
Mathias
Walter Roberson
Walter Roberson on 20 Jun 2018
syms u(t) a b B alpha
du = diff(u);
syms delta1 delta2 positive %inbalance in inequalities
syms C %arbitrary constant of integration to balance integral of du
eqn = a*u(t) + b == alpha - delta1;
eqn2 = a*du == B - delta2;
sol1 = expand(isolate(eqn, u(t)));
sol2 = expand(isolate(eqn2, u(t)));
sol3 = int(lhs(sol2),t) == int(rhs(sol2),t) + C;
At this point, sol1 and sol3 are both expressions for u(t). Now what?
>> expand(isolate(rhs(sol1)==rhs(sol3),delta1))
ans =
delta1 == alpha - b - C*a - B*t + delta2*t
delta1 is required to be positive. alpha - b - C*a are constants and are whatever they are. We can isolate down to delta1 = D + (delta2-B)*t for constant D = alpha - b - C*a . If positive and negative times are permitted, then with delta2 restricted to positive, then if delta2 > B then (delta2-B) would be positive, but there will be a sufficiently negative time at which D + (delta2-B)*t will go negative. That puts a constraint on delta1 for this case. If delta2 < B then (delta2-B) would be negative, and there would be a sufficiently positive time at which D + (delta2-B)*t would go negative; that puts a constraint on delta1 for this case. Let t = 0 to get a baseline delta1.
... I don't know where to go from here. This isn't really talking about the possible forms for u(t), this is talking about the inequalities.
Perhaps it would be more useful to consider delta1(t) and delta2(t) -- to look at how the inequalities would change over time. So for example instead of
u(t) == alpha/a - b/a - delta1/a
to work with
u(t) == alpha/a - b/a - delta1(t)/a
??
But I do not know what you are looking for?
Where you hoping for something like MATLAB solving and saying "Oh, to get that to work, u(t) has to be this form involving exp(heaviside(a - t/B))" ??

Sign in to comment.

Categories

Find more on Mathematics 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!