Storing the matrix values in a loop
1 view (last 30 days)
Show older comments
Mubaraq Adeoye-Lawal
on 11 Oct 2019
Answered: Walter Roberson
on 11 Oct 2019
having problem storing the values for the T matrix. I keep getting 3x39 matrix for T instead of 3x3 matrix. So that I can plot later
%aluminum 2024-T3 – IM7 carbon composite composites%
E1f=290E9;
E2f=21E9;
Em=73E9;
G12f=14E9;
Gm=26.6E9;
Vf=0.60;
af1=-0.2e-6;
af2=10e-6;
am=23;
Vm=1-Vf;
v12f=0.2;
v12m=0.33;
E1=(Vf*E1f)+(Vm*Em);
% transverse shear modulus%
xi=2;
eta_E2=((E1f/Em)-1)/((E1f/Em)+xi);
E2=(Em*(1+xi*eta_E2*Vf))/(1-eta_E2*Vf);
v12=(Vf*v12f)+(Vm*v12m);
v21=(E2/E1)*v12;
eta_G12=((G12f/Gm)-1)/((G12f/Gm)+ xi);
G12=(Gm*(1+xi*eta_G12*Vf))/(1-eta_G12*Vf);
% alpha unit m/m/deg celcius %
alpha_1=(E1*af1*Vf)+(Em*am*Vm)/(E1f*am*Vm)+(Em*Vm);
alpha_2=(af2*Vf)*(1+Vf)+(am*Vm)*(1+Vm)-(v12*af1);
alpha_0= [alpha_1;alpha_2;0];
S11=1/E1;
S12=-v12/E1;
S21=-v21/E2;
S22=1/E2;
S33=1/G12;
%compliance matrix @ 0%
S0=[S11 S12 0;S21 S22 0;0 0 S33];
% stiffness matrix @ 0 %
C=inv(S0);
%Qo=1/S0=inv(S0)=C%
% theta range %
theta=[-90:15:90];
N=length(theta);
T=cell(N,1);
Sxy=cell(N,1);
alpha_theta=cell(N,1);
for i=1:N
m=cosd(theta);
n=sind(theta);
R=[1 0 0;0 1 0;0 0 2];
% T is transform matrix%
T{i}=[m.^2 , n.^2 , 2.*m.*n;
n.^2 , m.^2 , -2.*m.*n;
-m.*n , n.*m ,(m.^2-n.^2)];
% Transformed complaince matrix%
Sxy{i}=R*inv(T{i,1})*inv(R)*T{i,1}*S0;
Ex(i)=1/Sxy{i,1}(1,1);
Ey(i)=1/Sxy{i,1}(2,2);
Gxy(i)=1/Sxy{i,1}(3,3);
vxy(i)=-Sxy{i,1}(1,2)*Ex(i);
% vyx(i)=vxy(i)%
Nsx(i)=Gxy(i)*Sxy{i,1}(1,3);
Nsy(i)=Gxy(i)*Sxy{i,1}(2,3);
Nxs(i)=Ex(i)*Sxy{i,1}(3,1);
Nys(i)=Ey(i)*Sxy{i,1}(3,2);
alpha_theta{i}=inv(R)*inv(T{i})*R*alpha_0;
Axy(i)=alpha_theta{i,1}(3,1);
end
plot(Ex)
0 Comments
Accepted Answer
Walter Roberson
on 11 Oct 2019
theta=[-90:15:90];
N=length(theta);
[...]
for i=1:N
m=cosd(theta);
n=sind(theta);
why bother iterating over the length of theta when you are going to operate on all of theta inside the loop?
0 Comments
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!