Indexing error with syms
7 ビュー (過去 30 日間)
古いコメントを表示
Mackenzie Dennis
2020 年 12 月 13 日
コメント済み: Mackenzie Dennis
2020 年 12 月 13 日
I'm trying to compute a definite integral as follows, but am getting an indexing error. I can run this exact code on my boyfriend's computer, same version of MATLAB, same toolboxes installed, but it works perfectly. I tried 2020a initially and then 2019b as well. Anyone know what could be going on?
syms x
F = int(exp(sin(x)), [0, pi]);
display(F)
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must
be symbolic variables, and function body must be sym expression
0 件のコメント
採用された回答
Walter Roberson
2020 年 12 月 13 日
syms x
F = int(exp(sin(x)), [0, pi]);
display(F)
so you have some other problem happening. For example you might have a variable named exp or sin or int
3 件のコメント
Walter Roberson
2020 年 12 月 13 日
int() is for creating indefinitely precise integrals. When you ask for a pattern matlab does not recognize, or a pattern that matlab recognizes as not having exact solutions, then MATLAB will return the form of the integral. You can use vpa() to approximate. If all you need is the approximation then ude vpaintegral() instead of int()
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Number Theory についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!