Hi there,
what does work is:
syms a b
vals = [4 5];
subs(a + b, [a, b], vals);
This returns 9 as expected.
What I'm trying to do is
syms a b
vals = [4 5; 6 7];
subs(a + b, [a, b], vals);
With the expected result of 9; 13.
Some technical framework:
The result does not need to be symbolic, if this does matter, I'm using vpa(subs(...)) anyway. The problem is: I have a symbolic solution of a large equation, where I want to replace parameters to gain the numeric value of the solution. The (symbolic) solution is also long and complicated, so that substituition in a loop lasts quite long.
Is there a way to define a vector with known parameters to pass it to subs/vpa (?) so that the numerical evaluation takes place only once?

 採用された回答

Alexander
Alexander 2019 年 5 月 22 日

0 投票

Ok... found the solution now. It is listed in the help
under the section
Substitute Multiple Scalars with Arrays
sorry for noise.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

製品

リリース

R2018b

質問済み:

2019 年 5 月 22 日

回答済み:

2019 年 5 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by