Home > Archive > Matlab > September 2006 > Construct Bigger Matrix with Linear Restriction
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Construct Bigger Matrix with Linear Restriction
|
|
| ikuyasu@gmail.com 2006-09-13, 4:12 am |
| Hi,
I have a symmetric matrix A which is n x n, and I want to construct
another symmetric matrix B which is (n+1) x (n+1),
but the last row and last column are -sum(each row) or -sum(each
column)[they are the same since it's symmetric).
I will be able to do using for-loop, but there's got to be an easy way
to do this in Matlab.
| |
| Greg Heath 2006-09-13, 4:12 am |
|
ikuyasu@gmail.com wrote:
> Hi,
>
> I have a symmetric matrix A which is n x n, and I want to construct
> another symmetric matrix B which is (n+1) x (n+1),
> but the last row and last column are -sum(each row) or -sum(each
> column)[they are the same since it's symmetric).
>
> I will be able to do using for-loop, but there's got to be an easy way
> to do this in Matlab.
sumA = sum(A);
B = [A sumA' ; sumA sum(sumA)];
Hope this helps.
Greg
|
|
|
|
|