0% found this document useful (0 votes)
34 views5 pages

Q1 and Q2 Matleb Code: %when Rigidity Matrix Is Given

This MATLAB code calculates the stresses and strains in a laminated composite material. It first defines material properties and applied forces and moments. It then calculates the A, B, and D stiffness matrices for the laminate based on the fiber angles and thicknesses of each layer. Finally, it calculates the mid-plane strains, curvature terms, global strains and stresses, and principle strains and stresses for each layer.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views5 pages

Q1 and Q2 Matleb Code: %when Rigidity Matrix Is Given

This MATLAB code calculates the stresses and strains in a laminated composite material. It first defines material properties and applied forces and moments. It then calculates the A, B, and D stiffness matrices for the laminate based on the fiber angles and thicknesses of each layer. Finally, it calculates the mid-plane strains, curvature terms, global strains and stresses, and principle strains and stresses for each layer.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Q1 And Q2 Matleb Code

%When Rigidity Matrix is given

clc
clear all

%Rigidity Matrix is Given


Q=[20 .7 0;.7 2 0;0 0 .7]*(1e9);

%Enter all the values at run time


p1 = 'Number Of laminates? ';
N = input(p1);

Angle=zeros(N,1);
thick=zeros(N,1);

%Angle of fiber and thickness of layer


for i=1:1:N
fprintf('Layer %d..........', i);

p2 = 'Angle of laminate? ';


Angle(i)=input(p2);

p3 = 'Thickness of laminate? ';


%Thickness of each Laminate
thick(i)=input(p3);
end

%Total Thickness
h=0;
for i=1:1:N;
h=h+thick(i);
end

Z(1)=-h/2;
Z(N+1)=h/2;
for i=2:1:N;
Z(i)=Z(i-1)+thick(i-1);
end ;

%A=Extensional Stiffness Matrix


A=zeros(3,3);

%B=Coupling Stiffness Matrix


B=zeros(3,3);

%D=Bending Stiffness Matrix


D=zeros(3,3);

for i=1:1:N
A=A+Qbar(Q,Angle(i))*(Z(i+1)-Z(i));
B=B+Qbar(Q,Angle(i))*(((Z(i+1)^2)-(Z(i)^2))/2);
D=D+Qbar(Q,Angle(i))*(((Z(i+1)^3)-(Z(i)^3))/3);
end

disp 'Extensional Stiffness Matrix'


A=A

disp 'Coupling Stiffness Matrix'


B=B

disp 'Bending Stiffness Matrix'


D=D

K=[A B;B D]
Q3 and Q4 Matleb Code

clc
clear all

EL=38e9;
ET=9e9;
GLT=3.6e9;
vLT=.32;

Force=zeros(3,1);
%Unit Force in x,y and xy direction
for i=1:1:3;
fprintf('Force %d..........', i);
pf = 'Force? ';
Force(i)=input(pf);
end

Moment=zeros(3,1);
%Moment in x,y and xy direction
for i=1:1:3;
fprintf('Moment %d..........', i);
pm = 'Moment? ';
Moment(i)=input(pm);
end

F=zeros(6,1);

%Force Matrix
F=[Force(1) Force(2) Force(3) Moment(1) Moment(2) Moment(3)]';

S=S(EL,ET,GLT,vLT);
Q=inv(S);

%Enter all the values at run time


p1 = 'Number Of laminates? ';
N = input(p1);

Angle=zeros(N,1);
thick=zeros(N,1);

%Angle of fiber and thickness of layer


for i=1:1:N
fprintf('Layer %d..........', i);

p2 = 'Angle of laminate? ';


Angle(i)=input(p2);

p3 = 'Thickness of laminate? ';


%Thickness of each Laminate
thick(i)=input(p3);
end

%Total Thickness
h=0;
for i=1:1:N;
h=h+thick(i);
end

Z(1)=-h/2;
Z(N+1)=h/2;
for i=2:1:N;
Z(i)=Z(i-1)+thick(i-1);
end ;

%A=Extensional Stiffness Matrix


A=zeros(3,3);

%B=Coupling Stiffness Matrix


B=zeros(3,3);

%D=Bending Stiffness Matrix


D=zeros(3,3);

for i=1:1:N
A=A+Qbar(Q,Angle(i))*(Z(i+1)-Z(i));
B=B+Qbar(Q,Angle(i))*(((Z(i+1)^2)-(Z(i)^2))/2);
D=D+Qbar(Q,Angle(i))*(((Z(i+1)^3)-(Z(i)^3))/3);
end

disp 'Extensional Stiffness Matrix'


A=A

disp 'Coupling Stiffness Matrix'


B=B

disp 'Bending Stiffness Matrix'


D=D

K=[A B;B D]

syms exo eyo exyo kx ky kxy;


Gstrain=[exo eyo exyo kx ky kxy]';
sol=solve(K*Gstrain==F);

exo=single(sol.exo);
eyo=single(sol.eyo);
exyo=single(sol.exyo);
kx=single(sol.kx);
ky=single(sol.ky);
kxy=single(sol.kxy);

MidPlaneStrain=[exo;eyo;exyo]
Curvature_Terms=[kx;ky;kxy]

for i=1:1:N;
fprintf('Layer %d..........', i);
%Strain in x-y direction
GlobalStrain1= MidPlaneStrain +Z(i)*Curvature_Terms;
GlobalStrain2= MidPlaneStrain +Z(i+1)*Curvature_Terms;

%Stress in x-y direction


GlobalStress1=Qbar(Q,Angle(i))*GlobalStrain1
GlobalStress2=Qbar(Q,Angle(i))*GlobalStrain2

%Principle Strain(LT direction)


P_Strain1=Transform(Angle(i))*GlobalStrain1;
P_Strain2=Transform(Angle(i))*GlobalStrain2;

%Principle Stresses(LT direction)


P_Stress1=Transform(Angle(i))*GlobalStress1;
P_Stress2=Transform(Angle(i))*GlobalStress2;
end

You might also like