Can symbolic vectors (not vectors of symbols) be defined and manipulated in the Symbolic Math Toolbox?

6 ビュー (過去 30 日間)
I would like to define symbolic functions that are functions of vector-valued quantities, like
syms A x
f(x)=x.'*A*x
where A and x are understood to be a matrix and compatibly-sized vector. I would like to be able to do matrix-vector calculus which gives the result in matrix vector form, such as
>> G = gradient(f)
G = 2*A*x %I would like this to be the result
I would also like to define functions involving indexing expressions, like
h(x) = x(1) + x(2) + x(3)
Are these things possible? The closest thing I can find is the syntax
x = syms('x',N,1)
but this doesn't seem to behave as I've described. For one thing, manipulations with x do not get simplified to matrix-vector forms.

採用された回答

Walter Roberson
Walter Roberson 2019 年 6 月 25 日
No this is not possible. Any variable name is expanded to its contents and any symbolic variable names left are assumed to refer to scalar values and expressions will be rewritten assuming scalar communitivity.
  4 件のコメント
Catalytic
Catalytic 2019 年 6 月 26 日
No this is not possible.
Darn it. Thanks, anyway.
Walter Roberson
Walter Roberson 2022 年 2 月 9 日
Note that a new facility was added as of R2021a; https://www.mathworks.com/help/symbolic/symmatrix.html
I have not had reason to experiment with it yet.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by