Plotting graph with for-end loop in

조회 수: 1(최근 30일)
Peter Kinsley
Peter Kinsley 2020년 2월 18일
댓글: Peter Kinsley 2020년 2월 18일
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

채택된 답변

Bhaskar R
Bhaskar R 2020년 2월 18일
%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
Peter Kinsley
Peter Kinsley 2020년 2월 18일
that works, thanks.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by