So, I have this pre calculate matrixes of A that are 4×4 and they are all positioned to be along the diagonal I then have matrix r that are 4×1, set up in a similar pattern but begin with 2. Now, I have set this matrix to go up to 4 calculated values but I need it to completed this pattern for a number of n=1:ntotal, where ntotal is any number. The BA matrix will always be something like (ntotal*4)X(ntotal*5) while by BR will be something like (ntotal*4)X(ntotal-1).
clear; clc;nspan=4;EI=[200,600,600,200];L=[10,20,20,10];%%constants setup
a=zeros(1,nspan);b=a;c=a; d=a;for n=1:nspana(n)=L(n);b(n)=L(n)/EI(n);c(n)=L(n)^2/(2*EI(n));d(n)=L(n)^3/(6*EI(n));end%%Compute A to the n
for n = 1:nspan A{n} = [1,0,0,0;a(n),1,0,0;c(n),b(n),1,0;-d(n),-c(n),-a(n),1];endfor n = 1:nspan r{n} = [1;a(n);c(n);-d(n)];endI=eye(4);Z = zeros(4,4);Z1 = zeros(4,1);BA=[A{1},-I,Z,Z,Z;... Z,A{2},-I,Z,Z;... Z,Z,A{3},-I,Z;... Z,Z,Z,A{4},-I];BR=[Z1,Z1,Z1;... -r{2},Z1,Z1;... Z1,-r{3},Z1;... Z1,Z1,-r{4}];B=[BA,BR];
Best Answer