Most efficient way to find all unique solutions of q

3 views (last 30 days)
I am designing a convex program on MATLAB whose if-else functionality is being modelled with a binary vector q that is 1xN vector. The solution of each element of the vector q is based on another variable t_ref, that is just a vector that represents a uniform step size from a certain t (current time) to a t_f (final time).
t_ref=t:(t_f-t)/(N-1):tf
t_ref is also therefore a 1xN vector.
q is then calculated by the following:
q=(t_ref<=t1) | (t_ref>=t2);
Meaning that for every value of t that is greater than or equal to a certain constant value t2 and , or less than or equal to t1 (both t1 and t2 are between 0 and tf) , q=1, and 0 every where else.
t can take on a value from anywhere between 0 and tf. The only solution I have been able to come up with is running a line search with the input being t and a small enough step size between different t values (between t0 and tf always) and then obtain the matrix of unique solutions of vector q.
I feel like there may be a more efficient trick to solving this? Or am I at the mercy of a P vs. NP problem?

Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!