Dear all,
I haveA= [ 29 1; 27 4; 31 0; 28 0; 28 3; 25 5; 23 8; 20 10; 18 13; 15 16; 29 1; 27 4; 31 0; 28 0; 28 3; 25 5; 23 8; 20 10; 18 13; 15 16]
and
B=[0.4607 0.4400 0.9167 0.8701; 0.4400 0.4432 0.8701 0.8808; 0.4432 0.4419 0.8808 0.8809; 0.4419 0.4607 0.8809 0.9156; 0.4607 0.4547 0.9156 0.9039; 0.4547 0.4377 0.9039 0.8679; 0.4377 0.4461 0.8679 0.8839; 0.4461 0.4396 0.8839 0.8740; 0.4396 0.4409 0.8740 0.8752; 0.4409 0.4409 0.8752 0.8752; 0.8487 0.8742 1.6974 1.7484; 0.8742 0.7616 1.7484 1.5232; 0.7616 0.7522 1.5232 1.5044; 0.7522 0.8492 1.5044 1.6984; 0.8492 0.8986 1.6984 1.7971; 0.8986 0.9138 1.7971 1.8275; 0.9138 0.7911 1.8275 1.5821; 0.7911 0.9008 1.5821 1.8016; 0.9008 0.9285 1.8016 1.8570; 0.9285 0.9285 1.8570 1.8570]
And I want to calculate
sum(A.*B(:,1:2),2)
sum(A.*B(:,3:4),2)
in one step because my B contains 120 columns and I want to multiply A with every 2 columns of B that is B(:,1:2) B(:,3:4) B(:,5:6)
S0, I am looking something like
sum(A.*[B(:,1:2) B(:,3:4) B(:,5:6) ],2)
thanks
Best Answer