MINIMIZE symbolic function P

4 views (last 30 days)
Vanshika Singh
Vanshika Singh on 18 Feb 2019
Edited: Vanshika Singh on 18 Feb 2019
X(t) = sym('x',[6 2])
syms t
syms X(t) t t0 tf N
a = diff(X(t),t)
b=a'
f=b*a
int( f,t, t0,tf)
P = symsum(f,t,0,N)
I need to minimize this symbolic (matrix) function P
Constraints:-
1.) P ∈ {0,1}
2.)P'*P=eye(M)
3.) t ∈ [t0, tf ]
4.) N=6

Answers (1)

Walter Roberson
Walter Roberson on 18 Feb 2019
Edited: Walter Roberson on 18 Feb 2019
syms t t0 tf
N = 6;
M = 2;
x = sym('x',[6 M]);
X(t) = str2sym(string(x) + "(t)");
a = diff(X(t), t);
b = a';
f = b*a;
f_int = int(f, t, t0, tf); %I do not know what this is for
temp = arrayfun(@(idx) subs(f(idx),t,1:N), 1:M.^2, 'uniform', 0);
P = reshape(sum(cat(1,temp{:}),2), M, M);
f is 2 x 2 because you are multiplying (6x2)' * (6x2) so (2x6) * (6x2) so 2x2 result.
You then symsum() the 2 x 2 over 6 different times (and it is pretty strange to choose integer times 1 through 6 when you have a constraint about t ∈ [t0, tf ] ). You would be getting a 2 x 2 result.
You then talk about P'*P, which is going to be (2x2).' * (2x2) which is (2x2)*(2x2) which is going to give a 2x2 result. That cannot possibly be eye(6)
So P will be either 2 x 2 (following your mathematics) or something x 6 (following your eye(6)). Either way, it is multi-valued, and then one has to ask what it means to minimize a multi-valued function.
  4 Comments
Vanshika Singh
Vanshika Singh on 18 Feb 2019
Edited: Vanshika Singh on 18 Feb 2019
Sir, basically i am trying to solve this equation-
here N=6
ie. summation of the Function P from 1 to 6
and integral is from t0 to tf
and X(t) is 6x2 matrix, whose all elements are time-dependent.
CONSTRAINTS-
Vanshika Singh
Vanshika Singh on 18 Feb 2019
please help me in minimizing P

Sign in to comment.

Categories

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