How do I simplify this symbolic summation?

4 ビュー (過去 30 日間)
Nélio Dias
Nélio Dias 2022 年 10 月 15 日
編集済み: Torsten 2022 年 10 月 15 日
Hello, I have this operation
syms e(k) T_s k
e(k) = symsum(e*T_s,k,[0 k])
Warning: Summation variable must not occur on the right side.
e(k) = 
result = e(k)-e(k-1)
Warning: Summation variable must not occur on the right side.
Warning: Summation variable must not occur on the right side.
result = 
So with k integer, the result have to be
So there is a way to simplify the result in matlab or to set this result in the code?
Thanks

回答 (1 件)

Torsten
Torsten 2022 年 10 月 15 日
syms e(k) T_s n
e(n) = symsum(T_s*e(k),k,[0 n])
e(n) = 
result = simplify(e(n)-e(n-1)) % doesn't simplify
result = 
result = simplify(e(20)-e(19)) % simplifies
result = 
  2 件のコメント
Nélio Dias
Nélio Dias 2022 年 10 月 15 日
But have to be
Because I have
So the result have to be
Torsten
Torsten 2022 年 10 月 15 日
編集済み: Torsten 2022 年 10 月 15 日
Internally, the result will be correct, but MATLAB doesn't simplify to this simple expression.
And don't use the same variable for upper limit and loop index - it doesn't make sense and MATLAB dislikes it as you could see from the warnings for your first attempt.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by