numerical answer required for sumation
8 ビュー (過去 30 日間)
古いコメントを表示
a very basic question, say i use
symsum(((-1)^(sym('k')-1))*(sin(sym('k'))), k, 0, 12)
I just get
sin(311/250) - sin(311/125) - sin(311/625) - sin(622/625) - sin(933/625) + sin(311/1250) - sin(1244/625) + sin(933/1250) - sin(1866/625) + sin(2177/1250) + sin(2799/1250) + sin(3421/1250)
but i want a single numeric value (like 0.2354 or whatever) not this expanded string of sin's. I dont want like 0.254 +0.056 +0.214 etc I just want a single value.
Ive tried searching on google but i have the normal problem of not knowing what the keyword is to search for.
0 件のコメント
採用された回答
Walter Roberson
2011 年 3 月 2 日
You can apply double() to a symbolic expression to get back the Matlab double precision number that is equivalent.
If you want the result to be a symbolic number instead, such as if you need to evaluate to more decimal places, then use vpa() on the symbolic expression.
0 件のコメント
その他の回答 (2 件)
Paulo Silva
2011 年 3 月 2 日
double(sin(311/250)-sin(311/125)-sin(311/625)-sin(622/625)-sin(933/625)+sin(311/1250)-sin(1244/625)+sin(933/1250)-sin(1866/625)+sin(2177/1250)+sin(2799/1250)+sin(3421/1250))
0 件のコメント
Paulo Silva
2011 年 3 月 2 日
eval('sin(311/250)-sin(311/125)-sin(311/625)-sin(622/625)-sin(933/625)+sin(311/1250)-sin(1244/625)+sin(933/1250)-sin(1866/625)+sin(2177/1250)+sin(2799/1250)+sin(3421/1250)')
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!