Problem with symsum: not working with vector of matrix elements
3 ビュー (過去 30 日間)
古いコメントを表示
Help Plz, I want to calculate summation from 1 to j of (x(6,k).*dz./sin((pi/180).*atan((pi/180).*x(6,k))), but no results
Note that Pas(j)=j with j =1:nz-1; nz= a number
Thank's for any answer !!
0 件のコメント
採用された回答
Walter Roberson
2020 年 1 月 10 日
It is never possible to use a symbolic variable as an index into an array. You should just calculate the expression in vectorized form outside of symsum and then sum() them.
0 件のコメント
その他の回答 (1 件)
Steven Lord
2020 年 1 月 10 日
If I understand what you're trying to do correctly, symsum is the wrong tool to use because you're trying to use that variable of summation as indices into a variable. Instead just use sum, something like:
>> x = 1:10;
>> syms dz
>> sY = sum(x.*dz./sin((pi/180).*atan((pi/180)*x)))
The degree-based trigonometry functions like sind and atand functions may also be of interest to you.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Numbers and Precision についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!