MATLAB: How to use vectors in the symprod fuction

symprodvector

Hi,
I would like to solve the following equation:
Ck and mk are vectors of length K, with a value corresponding to each k. I have tried but the symprod function doesn't seem to like vectors, this is what I would ideally like to do:
C=2;
K=2;
mk=[2 2];
Ck=[2 2];
SSS=(C+1)*(symprod(nchoosek(Ck(k)+mk(k),Ck(k)),k,1,K)-symprod(nchoosek((Ck(k)-1+mk(k)),(Ck(k)-1)),k,1,K));
Any ideas how to make this work?
Thanks,

Best Answer

You cannot use the symbolic variable of symsum() or symprod() to index a vector.
You need to create the vector of definite values first, and then sum() or prod() that definite vector.