Date: Feb 27, 2013 2:42 PM
Author: Milos Milenkovic
Subject: Matrix sum

Dear,
how to generate matrix A[4,4] which is defined as the B0(j,b)*Ke1(a,b)*B1(i,a)+B0(j,b)*Ke1(a,b)*Delta1(i,a)+Delta0(j,b)*Ke1(a,b)*B1(i,a):
Delta1=sym('Delta1%d%d', [4,4]);
Delta0=sym('Delta0%d%d', [4,4]);
Inputs are:
K1=[-0.2582 -18.596 0 -0.2582; -34.737 -1300.188 0 -34.737; 0 0 0 0; -0.2582 -18.596 0 -0.2582];
K0=[2.337 48.551 0 2.337; 48.551 3072.487 0 48.551; 0 0 0 0; 2.337 48.551 0 2.337];
B1=[0.01 0.02 0.07 0.03; 0.02 0.05 0.06 0.02; 0.07 0.09 0.01 0.03; 0.01 0.03 0.02 0.04];
B0=[-1 0 0 0; 0 -1 0 0 ; 0 0 -1 0; 0 0 0 -1];
Ke1=[-785 -29351 2 -785; 758 28831 5 758; 72 2623 6 72; -382 -14175 2 -382];

Trial is:

for i=1:4
for j=1:4
A=0;
A=zeros(i,j);
for b=1:4
for a=1:4
A=A+B0(j,b)*Ke1(a,b)*B1(i,a)+B0(j,b)*Ke1(a,b)*Delta1(i,a)+Delta0(j,b)*Ke1(a,b)*B1(i,a)
end
end
end
end
end

the output for cell 1,1 of matrix A is:
(89*Delta011)/100 + (4147*Delta012)/100 + (3*Delta013)/5 + (89*Delta014)/100 + 785*Delta111 - 758*Delta112 - 72*Delta113 + 382*Delta114 - 89/100