How to recall values from for loop into a column matrix?
Afficher commentaires plus anciens
Hello everyone,
I am trying to get four values from the for loop statement I made, Q_bar1, Q_bar2, and so forth. But, I don't know how to assign those values into a column matrix. Below is a copy of my code, if anyone is able to help, it will be most appreciated.
CODE:
E1 = 27.1; % measured in Msi
E2 = 1.3; % measured in Msi
E3 = E2;
v12 = 0.33;
v21 = E2*(v12/E1);
v13 = v12;
v31 = E3*(v13/E1);
G12 = 0.80; % measured in Msi
G13 = G12;
v23 = 0.5;
v32 = E3*(v23/E2);
delta = (1-(v12*v21)-(v23*v32)-(v13*v31)-2*(v21*v32*v13))/(E1*E2*E3);
C11 = (1-(v23*v32))/(E2*E3*delta);
C22 = (1-(v13*v31))/(E1*E3*delta);
C33 = (1-(v12*v21))/(E1*E2*delta);
C12 = (v12+(v13*v32))/(E1*E3*delta);
C23 = (v23+(v21*v13))/(E1*E2*delta);
C13 = (v31+(v21*v32))/(E2*E3*delta);
C55 = G13;
C66 = G12;
% Stiffness Matrix
C = [C11 C12 C12 0 0 0;
C12 C22 C23 0 0 0;
C12 C23 C22 0 0 0;
0 0 0 (C22-C23)/2 0 0;
0 0 0 0 C55 0;
0 0 0 0 0 C55]
% Reduced Stiffness Matrix
Q11 = C11-(C12^2/C22);
Q12 = C12-(C23/C22);
Q21 = Q12;
Q22 = C22-(C23^2/C22);
Q55 = C55;
Q66 = C66;
Q = [Q11 Q12 0;
Q21 Q22 0;
0 0 Q55]
% Transformed Reduced Stiffness Matrix
% theta = input('insert desired angle= ')
for theta = [0 17 -63 90]
m = cosd(theta);
n = sind(theta);
Qxx = m^4*Q11 + n^4*Q22 + 2*m^2*n^2*Q12 + 4*m^2*n^2*Q66;
Qxy = m^2*n^2*Q11 + m^2*n^2*Q22 + (m^4+n^4)*Q12 - 4*m^2*n^2*Q66;
Qxs = m^3*n*Q11 - m*n^3*Q22 - m*n*(m^2-n^2)*Q12 - 2*m*n*(m^2-n^2)*Q66;
Qyx = Qxy;
Qyy = n^4*Q11 + m^4*Q22 + 2*m^2*n^2*Q12 + 4*m^2*n^2*Q66;
Qys = m*n^3*Q11 - m^3*n*Q22 + m*n*(m^2-n^2)*Q12 + 2*m*n*(m^2-n^2)*Q66;
Qss = m^2*n^2*Q11 + m^2*n^2*Q22 - 2*m^2*n^2*Q12 + (m^2-n^2)^2*Q66;
Qsx = Qxs;
Qsy = Qys;
Q_bar = [Qxx Qxy Qxs;
Qyx Qyy Qys;
Qsx Qsy Qss]
end
1 commentaire
madhan ravi
le 14 Oct 2018
Format your code correctly.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB 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!