how to create symbolic function?

11 ビュー (過去 30 日間)
Michal
Michal 2017 年 10 月 30 日
コメント済み: Michal 2021 年 5 月 9 日
I need to transform the following function to the symbolic form to evaluate it with arbitrary precision.
Z(N,Thetas) = prod((1 - exp(-(N:-1:2).*Thetas))./(1 - exp(-Thetas)),2)
where Thetas is matrix M x N-1 of the positive real numbers. So the expected result is vector Z (M x 1). I am not able to rewrite function Z to symbolic form and than evaluated it by vpa() command.
Any idea how to effectively solve it?

採用された回答

Michal
Michal 2017 年 10 月 30 日
編集済み: Michal 2017 年 10 月 30 日
function Z=symZ(N,Thetas,Ndigit)
Thetas = sym(Thetas);
Zsym = prod((1 - exp(-(N:-1:2).*Thetas))./(1 - exp(-Thetas)),2);
Z = vpa(Zsym,Ndigit);
end

その他の回答 (1 件)

Alfonso Salas-Cruz
Alfonso Salas-Cruz 2021 年 5 月 9 日
how evaluate an symbolic expresion?
  1 件のコメント
Michal
Michal 2021 年 5 月 9 日
use the "vpa" command:
Z = vpa(Zsym,Ndigit);

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

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by