Hi all,
I am trying to assmeble matrices, I already wrote a code for which I could do, but I would like to do edit/develop commands so it work for any matrix size.
Now my matrix is 2*2 if i change it to 4*4, or 5*5 and so on.. I get matrix dimension must agree ?
Looking for any help!
clearvarsclc;NE=2;NN=NE+1;NDOF=NN*2ke=[1 -1;-1 1]; % IF I change this matrix to be 4*4 or 5*5 and so on... will not work to assemble
ke=[1 -1 3;-1 1 5];K=zeros(NDOF);for i=1:NE K(i:i+1,i:i+1)=K(i:i+1,i:i+1)+keend
Best Answer