Symsum function within a for loop
4 views (last 30 days)
Show older comments
Hi this is my first time posting a question here so I hope I'm typing it all out correctly so it is easy to view. I am attempting to use the symsum function within a for loop in order to create an array for a thermally radiative network. For the math background, I am basically trying to create the matrix a and array C and solve ax = C.

My code is as follows:
A = .001;
sig = 5.67E-8;
F = [0 ,.2803 ,.389 ,0 ,.0055 ,.0139;
.5606 ,.389 ,.5606 ,.011 ,.0139 ,.011;
.389 ,.2803 ,0 ,.0139 ,.0055 ,0;
0 ,.0055 ,.0139 ,0 ,.2803 ,.389;
.011 ,.0139 ,.011 ,.5606 ,.389 ,.5606;
.0139 ,.0055 ,0 ,.389 ,.2803 ,0];
T = [803.1 776.2 750 805.2 778.4 752.2];
for k = 1:6
syms j
C(k)=symsum(F(j,k)*sig*(T(k)^4-T(j)^4),j,1,6);
for j = 1:6
a(k,j)=kronDel(k,j)/.8-F(j,k)*.25;
end
end
X = linsolve(a,C)
I am getting an error at the C(k) = symsum line as follows:
Error using sym/subsindex (line 836)
Invalid indexing or function definition. Indexing must follow
MATLAB indexing. Function arguments must be symbolic variables,
and function body must be sym expression.
Any idea why this is happening?
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!