How do I simplify this symbolic summation?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, I have this operation
syms e(k) T_s k
e(k) = symsum(e*T_s,k,[0 k])
result = e(k)-e(k-1)
So with k integer, the result have to be ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1157433/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1157433/image.png)
So there is a way to simplify the result in matlab or to set this result in the code?
Thanks
0 comentarios
Respuestas (1)
Torsten
el 15 de Oct. de 2022
syms e(k) T_s n
e(n) = symsum(T_s*e(k),k,[0 n])
result = simplify(e(n)-e(n-1)) % doesn't simplify
result = simplify(e(20)-e(19)) % simplifies
2 comentarios
Torsten
el 15 de Oct. de 2022
Editada: Torsten
el 15 de Oct. de 2022
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.
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!