symsum undefined error for input arguments
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Margherita Premoli
am 5 Mär. 2020
Beantwortet: Steven Lord
am 5 Mär. 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 Kommentare
Akzeptierte Antwort
Steven Lord
am 5 Mär. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!