Combining vectors in a for loop to form a final matrix
Afficher commentaires plus anciens
Hi there,
I am writing a script to solve problems using the Moment Distribution Method for structural analysis. I have 4 loops that generate row vectors. What I want to do is combine the final calculated vectors into one large matrix. Here is the code:
DF = [0 0.625 0.375 0.6 0.4 0];
FEM = [-10 10 -18 12 -16 16];
MBal = [FEM(2)+FEM(3) FEM(4)+FEM(5)];
if MBal < 0
MBal = abs(MBal);
end
Fdistribution = [0 DF(2:3)*MBal(1) DF(4:5)*MBal(2) 0];
for i = 1:4
Fdistribution([1,2,3,4,5,6]) = Fdistribution([2,1,4,3,6,5]);
Carry_over = Fdistribution./2;
idistribution = [ 0 Carry_over(3).*DF(2:3) Carry_over(4).*DF(4:5) 0];
if idistribution >= 0
idistribution = -idistribution;
else idistribution = abs(idistribution);
end
Fdistribution = idistribution;
if i == 4
idistribution(1) = idistribution(2)/2;
idistribution(6) = idistribution(5)/2;
end
Table = [Carry_over; idistribution]
end
Basically I want to combine the vector 'Table' so its displays all the Table vectors together. So, I would have a 8 by 6 matrix.
Can anybody help please? Then I can manipulate the matrix and sum up the columns.
Many thanks for any help.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!