Subscript - Symbolic serie
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Gennaro Arguzzi
le 18 Août 2017
Commenté : Walter Roberson
le 18 Août 2017
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 commentaires
Réponse acceptée
Walter Roberson
le 18 Août 2017
Modifié(e) : Walter Roberson
le 18 Août 2017
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 commentaires
Walter Roberson
le 18 Août 2017
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);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Assumptions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!