Undefined function 'symsum' for input arguments of type 'double'.

Hi, I am getting the error
Undefined function 'symsum' for input arguments of type 'double'.
Error in LoopsumQ2 (line 40)
T=symsum(Q,k,1,200)
I do not understand what this means as I am trying to sum this objective function.
The values of l,q,s,pk(k),y(k),z(k) are all computed already before this for loop takes place.
Is there something wron in my code?
syms k
for k=1:1:200;
Q=pk(k)*((l-q).'*z(k)-s.'*y(k));
T=symsum(Q,k,1,200)
end

7 commentaires

T=cell(200,1);
syms kk
for k=1:200;
Q=pk(k)*((l-q).'*z(k)- s.'*y(k));
T{k}=symsum(Q,kk,1,200)
end
As a result I would like to get A func. Which looiks like
Sigma [pk(k)*((l-q).'*z(k)-s.'*y(k))] from k=1:1:200
and put this in another objective function. This is not the output of the code which I am having now, would you now how I can solve this?
Which variable is symbolic? symsum() is only for symbolic expressions.
I think k,
now not certain if using symsum is right one to use
I want to create a summation of a function, for 200 instances. With k=1:1:200
so actually pk(1)*((l-q).'*z(1)-s.'*y())+pk(2)*((l-q).'*z(2)-s.'*y(2))+pk(3)*((l-q).'*z(3)-s.'*y(3))]
should I use something else for this?
What size are l, q, s?
bus14
bus14 le 8 Mai 2019
Modifié(e) : bus14 le 8 Mai 2019
l=1 q=11 s=2
this is is simplied version of the larger problem
If those are constant then the .' operators have no reason to be there so I have to assume that they are vector or 2D array in the real problem. The solution if they are constant is very simple but with them being multivalued I need to think carefully about putting the expression together.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by