Subscript - Symbolic serie
2 ビュー (過去 30 日間)
古いコメントを表示
Gennaro Arguzzi
2017 年 8 月 18 日
コメント済み: Walter Roberson
2017 年 8 月 18 日
Hello everyone. Is it possible to create a symbolic serie like this: a_0, a_1, a_2, a_3? I tried with the following wrong code:
close all
clear all
syms a n
x=symsum(a_{n},n,0,3)
Thank you very much.
0 件のコメント
採用された回答
Walter Roberson
2017 年 8 月 18 日
編集済み: Walter Roberson
2017 年 8 月 18 日
a = [sym('a_0'), sym('a_%d', [1, 3])];
However, it is not possible to use a symbolic variable to index anything; in particular, the symbolic index, n, in symsum() cannot be used to index anything. You need to construct the individual terms and add them up, such as
x = sum( a .^ (1:4) )
2 件のコメント
Walter Roberson
2017 年 8 月 18 日
I was giving an example of how to create terms based upon the individual entries and then sum those terms. For your particular case, just
x = sum(a);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Assumptions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!