symsum undefined error for input arguments
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Margherita Premoli
il 5 Mar 2020
Risposto: Steven Lord
il 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 Commenti
Risposta accettata
Steven Lord
il 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Calculus in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!