MATLAB Answers

Plotting graph with for-end loop in

5 views (last 30 days)
Peter Kinsley
Peter Kinsley on 18 Feb 2020
Commented: Peter Kinsley on 18 Feb 2020
How do i plot a graph of the data in the for-end loop.
Looking to plot a varying Vf against Ex,Ey,Gxy,vxy.
>> %Setting all original variables
Em=2.4e9;
Ef=76e9;
vm=0.34;
vf=0.22;
theta=30;
for Vf=0:0.1:1
Vm=1-Vf;
%Finding shear and bulk modulus'
Gm=Em/(2*(1+vm));
Gf=Ef/(2*(1+vf));
Km=Em/(3*(1-2*vm));
Kf=Ef/(3*(1-2*vf));
%Find k*,E1,v12,G12
k=(Km*(Kf+Gm)*Vm+Kf*(Km+Gm)*Vf)/((Kf+Gm)*Vm+(Km+Gm)*Vf);
E1=Em*Vm+Ef*Vf;
v12=vm*Vm+vf*Vf+((vf-vm)*((1/Km)-(1/Kf))*Vm*Vf)/((Vm/Kf)+(Vf/Km)+(1/Gm));
G12=Gm+(Vf/((1/(Gf-Gm))+(Vm/(2*Gm))));
%Beta's, gamma's, alphas and roe
betam=1/(3-4*vm);
betaf=1/(3-4*vf);
gamma=Gf/Gm;
alpha=(betam-gamma*betaf)/(1+gamma*betaf);
roe=(gamma+betam)/(gamma-1);
%G23, E2 and v23
G23=Gm*(1+((1+betam)*Vf)/(roe-(1+(3*betam^2*Vm^2)/(alpha*Vf^3+1))*Vf));
E2=4/((1/G23)+(1/k)+(4*v12^2/E1));
v23=(E2/2*G23)-1;
%Creating reduced lamina stiffness matrix
Z=(E1-v12^2*E2)/E1;
Q11=E1/Z;
Q22=E2/Z;
Q12=v12*E2/Z;
Q66=G12;
Q=[Q11,Q12,0;Q12,Q22,0;0,0,Q66];
%Transformation matrices
n=sind(theta);
m=cosd(theta);
q11=Q11*m^4+Q22*n^4+2*m^2*n^2*(Q12+2*Q66);
q12=m^2*n^2*(Q11+Q22-4*Q66)+(m^4+n^4)*Q12;
q16=(Q11*m^2-Q22*n^2-(Q12+2*Q66)*(m^2-n^2))*m*n;
q22=Q11*n^4+Q22*m^4+2*m^2*n^2*(Q12+2*Q66);
q26=(Q11*n^2-Q22*m^2+(Q12+2*Q66)*(m^2-n^2))*m*n;
q66=(Q11+Q22+Q12*2)*m^2*n^2+Q66*((m^2-n^2)^2);
q=[q11,q12,q16;q12,q22,q26;q16,q26,q66];
%Finally calculating the laminate properties
Ex=q11-q12^2/q22
Ey=q22-q12^2/q11
Gxy=q66
vxy=q12/q22
end

  0 Comments

Sign in to comment.

Accepted Answer

Bhaskar R
Bhaskar R on 18 Feb 2020
%Setting all original variables
Em=2.4e9;
Ef=76e9;
vm=0.34;
vf_samll=0.22;
theta=30;
Vf=0:0.1:1;
Ex = zeros(1, length(Vf));
Ey = zeros(1, length(Vf));
Gxy = zeros(1, length(Vf));
vxy = zeros(1, length(Vf));
c = 1;
for ii = 1:length(Vf)
Vm=1-Vf(ii);
%Finding shear and bulk modulus'
Gm=Em/(2*(1+vm));
Gf=Ef/(2*(1+vf_samll));
Km=Em/(3*(1-2*vm));
Kf=Ef/(3*(1-2*vf_samll));
%Find k*,E1,v12,G12
k=(Km*(Kf+Gm)*Vm+Kf*(Km+Gm)*Vf(ii))/((Kf+Gm)*Vm+(Km+Gm)*Vf(ii));
E1=Em*Vm+Ef*Vf(ii);
v12=vm*Vm+vf_samll*Vf(ii)+((vf_samll-vm)*((1/Km)-(1/Kf))*Vm*Vf(ii))/((Vm/Kf)+(Vf(ii)/Km)+(1/Gm));
G12=Gm+(Vf(ii)/((1/(Gf-Gm))+(Vm/(2*Gm))));
%Beta's, gamma's, alphas and roe
betam=1/(3-4*vm);
betaf=1/(3-4*vf_samll);
gamma=Gf/Gm;
alpha=(betam-gamma*betaf)/(1+gamma*betaf);
roe=(gamma+betam)/(gamma-1);
%G23, E2 and v23
G23=Gm*(1+((1+betam)*Vf(ii))/(roe-(1+(3*betam^2*Vm^2)/(alpha*Vf(ii)^3+1))*Vf(ii)));
E2=4/((1/G23)+(1/k)+(4*v12^2/E1));
v23=(E2/2*G23)-1;
%Creating reduced lamina stiffness matrix
Z=(E1-v12^2*E2)/E1;
Q11=E1/Z;
Q22=E2/Z;
Q12=v12*E2/Z;
Q66=G12;
Q=[Q11,Q12,0;Q12,Q22,0;0,0,Q66];
%Transformation matrices
n=sind(theta);
m=cosd(theta);
q11=Q11*m^4+Q22*n^4+2*m^2*n^2*(Q12+2*Q66);
q12=m^2*n^2*(Q11+Q22-4*Q66)+(m^4+n^4)*Q12;
q16=(Q11*m^2-Q22*n^2-(Q12+2*Q66)*(m^2-n^2))*m*n;
q22=Q11*n^4+Q22*m^4+2*m^2*n^2*(Q12+2*Q66);
q26=(Q11*n^2-Q22*m^2+(Q12+2*Q66)*(m^2-n^2))*m*n;
q66=(Q11+Q22+Q12*2)*m^2*n^2+Q66*((m^2-n^2)^2);
q=[q11,q12,q16;q12,q22,q26;q16,q26,q66];
%Finally calculating the laminate properties
Ex(c)=q11-q12^2/q22;
Ey(c)=q22-q12^2/q11;
Gxy(c)=q66;
vxy(c)=q12/q22;
c =c+1;
end
plot(Vf, Ex, Vf, Ey, Vf, Gxy, Vf, vxy);
grid on , legend({'Ex', 'Ey', 'Gxy', 'vxy'})

  1 Comment

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Products


Release

R2019b