symsum undefined error for input arguments
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Margherita Premoli
le 5 Mar 2020
Réponse apportée : Steven Lord
le 5 Mar 2020
Hi, I need to sum the variable Dmet(b,t) over b, which varies from 1 to b-1.
The variable Dmet is the demand met at a certain day t with a certain batch b so Dmet is defined by two indices.
I tried to formulate it but it is not working, can anyone help me out? Thanks!!
This is part of the code:
syms b
D= 10
for t=1
for b=1:3
Dmet(1,t)=3
Dmet(2,t)=4
Dmet(3,t)= D - symsum(Dmet(b,t),b,1,b-1)
end
end
Do I have to use a syms diffferent than b?
0 commentaires
Réponse acceptée
Steven Lord
le 5 Mar 2020
Your b variable isn't symbolic at the time you try to use it in symsum. It was overwritten by the loop variable for your inner loop.
But even if it wasn't, symsum isn't the right tool for this job. Use sum instead.
A = reshape(1:16, 4, 4)
sum(A(:, 1:3), 2)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Calculus 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!