From: William on 29 Jun 2010 18:17 I am trying to create a matrix which is 10x10. The first row should go 1:10, the first column should go from 1:10 (downward), and a diagonal 1:10. I have it seperated as A = 1:10 A' B = diag(A) how would i combine these matricies so i wouldnt still get a 10x10 matrix?
From: us on 29 Jun 2010 18:27 "William " <william.baxter(a)oit.edu> wrote in message <i0drdh$r7l$1(a)fred.mathworks.com>... > I am trying to create a matrix which is 10x10. The first row should go 1:10, the first column should go from 1:10 (downward), and a diagonal 1:10. > > I have it seperated as > > A = 1:10 > A' > B = diag(A) > > how would i combine these matricies so i wouldnt still get a 10x10 matrix? one of the many solutions rc=1:4; m=diag(rc); m(1,:)=rc; m(:,1)=rc; disp(m); %{ 1 2 3 4 2 2 0 0 3 0 3 0 4 0 0 4 %} us
|
Pages: 1 Prev: Simscape Simhydraulics - Hydraulic Fluid Next: Passing integer arrays through mex to ifort |