I need N variables for my equation system:
X = cell(N,1)
for k=1:N
X(k) = {sym('X(k)')};
end
After creating these variables I want to utilize them in an equation system:
for i=1:N
for j=1:N
if i~=j
S(i)=sum(X(j))
end
end
f(i)=x(i)+2*S(i)+3
end
I get the error Undefined function 'sum' for input arguments type 'cell'
. How should I define the variables X(1),...X(N)
without using 'cell'?