MINIMIZE symbolic function P

조회 수: 8 (최근 30일)
Vanshika Singh
Vanshika Singh 2019년 2월 18일
편집: Vanshika Singh 2019년 2월 18일
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

답변 (1개)

Walter Roberson
Walter Roberson 2019년 2월 18일
편집: Walter Roberson 2019년 2월 18일
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
Vanshika Singh
Vanshika Singh 2019년 2월 18일
편집: Vanshika Singh 2019년 2월 18일
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 2019년 2월 18일
please help me in minimizing P

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by