symsum undefined error for input arguments
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Margherita Premoli
el 5 de Mzo. de 2020
Respondida: Steven Lord
el 5 de Mzo. de 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 comentarios
Respuesta aceptada
Steven Lord
el 5 de Mzo. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots 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!