matrix operation

I have an matrix
A=[1 0 0 0 0 0 1;0 1 1 0 1 1 0 ;0 0 0 1 0 0 0 ] want to perform matrix operation using the formula
(summation i=1 to s summation r=1 to 7 q^2ir/Mi*Mr)-1/log(n)
s=3
Mi for ist row is 2,second row is 4,third row is 1
Mr is 1 for all cases
n=7

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 1월 11일

0 개 추천

[m k] = size(A);
i1 = (1:m)';
r = 1:k;
Mi = [2; 4; 1];
Mr = 1;
out1 = bsxfun(@rdivide,i1*r.*q.^2,Mi)*Mr;
out = sum(out1(:)) - 1/log(n);
ADD
out2 = max(out1) - 1/log(n);

댓글 수: 3

FIR
FIR 2012년 1월 11일
thanks andrei is it possible to calculate column wise and take max value .so that i will get seven values each for one column
Andrei Bobrov
Andrei Bobrov 2012년 1월 11일
see ADD
FIR
FIR 2012년 1월 11일
thanks andrei,sorry a small correction .i have to run for loop for every column so that for the first column the max value must be generated ,for second column the max value ans so on

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

질문:

FIR
2012년 1월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by