MINIMIZE symbolic function P
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
Walter Roberson
le 18 Fév 2019
Modifié(e) : Walter Roberson
le 18 Fév 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 commentaires
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

