Turn a numeric function into a symbolic one
11 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
do you know ho to turn a function with numeric input and output into a symbolic function?
Thanks!
0 件のコメント
回答 (2 件)
Walter Roberson
2012 年 5 月 11 日
In the case where the numeric function only involves mathematical calculations with respect to the parameter you wish to be symbolic, then pass a symbol to the numeric function.
If the numeric function has any part that is conditional on the input value (e.g., an "if" statement) then there is no mechanical way of handling the situation.
3 件のコメント
Walter Roberson
2012 年 5 月 11 日
Just call the function passing in a symbolic variable. Operator overloading takes care of the details.
For example,
f = @(x) sin(cos(x)^2-tan(x))
then
syms p
f(p)
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!