|
"Joe Frank" <sascod@gmail.com> wrote in message <grvfqg$9bk$1@fred.mathworks.com>...
> I have this matrix
>
> A =
>
> 1 2 3 1 2 3
> 4 5 6 4 5 6
> 7 8 9 7 8 9
> 4 5 6 4 5 6
> 1 2 3 1 2 3
> 4 5 6 4 5 6
>
>
> I need to add
> A(1,1) and A(1,2)
> A(2,1) A(2,2), A(2,3)
> A(3,2) A(3,3), A(3,4)
> A(4,3) A(4,4), A(4,5)
> A(5,4) A(5,5), A(5,6)
> A(6,5) and A(6,6)
>
> How do I add these? I know I can do A(1,1)+A(1,2) ...... But I dont wanna do it that way.. Are there any other better ways of doing it. Please help me out
What does this do?
tril(A,1) - tril(A,-2)
Can you apply sum to the result to solve your
problem? What dimension will you sum over?
HTH,
John
|