Professional Documents
Culture Documents
FRC Assignment
FRC Assignment
(193010032)
clc;clear;close
%% Material Properties
syms U u B b
J = input('Enter [U] to feed Fiber properties or [B] to use built-in High Modulus
Carbon Fiber (HMCF) Properties [U/B]= ','s');
if (strcmpi(J,'U'))
disp(' ')
N = input('Enter the name of the Fiber Properties to be feeded ','s');
disp(' ')
disp(['For ' upper(N) ', Enter the following properties:'])
disp(' ')
E1 = input('Longitudinal Modulus Value in Gpa = ');
E1 = E1*10^9;
disp(' ')
E2 = input('Transverse Modulus Value in Gpa = ');
E2 = E2*10^9;
disp(' ')
g = input('Shear Modulus Value in Gpa = ');
g = g*10^9;
disp(' ')
v = input('Poissons Ratio Value = ');
disp(' ')
tc1 = input('Longitundinal Co-effiecient of Thermal Expansion in (10^-6) = ');
tc1 = tc1*10^-6;
disp(' ')
tc2 = input('Transverse Co-effiecient of Thermal Expansion in (10^-6) = ');
tc2 = tc2*10^-6;
disp(' ')
else
end
%% Laminate Schedule
ls = input('Enter [U] to feed Fiber Laminate Schedule or [B] to use built-in Fiber
Laminate Schedule [U/B] = ','s');
if (strcmpi(ls,'U'))
disp(' ')
K = input('please insert number of plies = ');
orientation = zeros(1,K);
fprintf('\nplease insert the plies orientation from bottom to top \n\n')
LS1 = 1;
for i= 1:K
switch i
case 1
fprintf('Enter the value of %dst',i)
orientation(1,i) = input(' lamina orientation angle = ');
case 2
fprintf('Enter the value of %dnd',i)
orientation(1,i) = input(' lamina orientation angle = ');
case 3
fprintf('Enter the value of %drd',i)
orientation(1,i) = input(' lamina orientation angle = ');
otherwise
fprintf('Enter the value of %dth',i)
orientation(1,i) = input(' lamina orientation angle = ');
switch LS1
case 1
tl=' [ 0(8) / 90(8) ] S ';
disp(' ')
K = 32;
orientation = zeros(1,K);
orientation(1,1) = 0; orientation(1,2) = 0; orientation(1,3) = 0;
orientation(1,4) = 0; orientation(1,5) = 0;
orientation(1,6) = 0; orientation(1,7) = 0; orientation(1,8) = 0;
orientation(1,9) = 90; orientation(1,10) = 90;
orientation(1,11) = 90; orientation(1,12) = 90; orientation(1,13) = 90;
orientation(1,14) = 90; orientation(1,15) = 90;
orientation(1,16) = 90; orientation(1,17) = 90; orientation(1,18) = 90;
orientation(1,19) = 90; orientation(1,20) = 90;
orientation(1,21) = 90; orientation(1,22) = 90; orientation(1,23) = 90;
orientation(1,24) = 90; orientation(1,25) = 0;
orientation(1,26) = 0; orientation(1,27) = 0; orientation(1,28) = 0;
orientation(1,29) = 0; orientation(1,30) = 0;
orientation(1,31) = 0; orientation(1,32) = 0;
case 2
tl='[ 0 / 30 / -30 / 0 ] S ';
disp(' ')
K = 8;
orientation = zeros(1,K);
orientation(1,1) = 0; orientation(1,2) = 30; orientation(1,3) = -30;
orientation(1,4) = 0; orientation(1,5) = 0;
orientation(1,6) = -30; orientation(1,7) = 30; orientation(1,8) = 0;
case 3
tl=' [ 45 / -30 / 15 / -5 ] S ';
disp(' ')
K = 8;
orientation = zeros(1,K);
orientation(1,1) = 45; orientation(1,2) = -30; orientation(1,3) = 15;
orientation(1,4) = -5; orientation(1,5) = -5;
orientation(1,6) = 15; orientation(1,7) = -30; orientation(1,8) = 45;
case 4
tl=' [ 45 / 45 / 45 / 45 / -45 / -45 / -45 / -45 ] T ';
disp(' ')
K = 8;
orientation = zeros(1,K);
orientation(1,1) = 45; orientation(1,2) = 45; orientation(1,3) = 45;
orientation(1,4) = 45; orientation(1,5) = -45;
orientation(1,6) = -45; orientation(1,7) = -45; orientation(1,8) = -45;
case 5
tl=' [ 45 / -45 ] S ';
disp(' ')
K = 4;
orientation = zeros(1,K);
orientation(1,1) = 45; orientation(1,2) = -45; orientation(1,3) = -45;
orientation(1,4) = 45;
case 6
switch All
case 1
tl=' [ 0(8) / 90(8) ] S ';
disp(' ')
disp('For the Laminate Schedule [ 0(8) / 90(8) ] S :')
disp(' ')
K = 32;
orientation = zeros(1,K);
orientation(1,1) = 0; orientation(1,2) = 0;
orientation(1,3) = 0; orientation(1,4) = 0; orientation(1,5) = 0;
orientation(1,6) = 0; orientation(1,7) = 0;
orientation(1,8) = 0; orientation(1,9) = 90; orientation(1,10) = 90;
orientation(1,11) = 90; orientation(1,12) = 90;
orientation(1,13) = 90; orientation(1,14) = 90; orientation(1,15) = 90;
orientation(1,16) = 90; orientation(1,17) = 90;
orientation(1,18) = 90; orientation(1,19) = 90; orientation(1,20) = 90;
orientation(1,21) = 90; orientation(1,22) = 90;
orientation(1,23) = 90; orientation(1,24) = 90; orientation(1,25) = 0;
orientation(1,26) = 0; orientation(1,27) = 0;
orientation(1,28) = 0; orientation(1,29) = 0; orientation(1,30) = 0;
orientation(1,31) = 0; orientation(1,32) = 0;
case 2
tl='[ 0 / 30 / -30 / 0 ] S ';
disp(' ')
disp('For the Laminate Schedule [ 0 / 30 / -30 / 0 ] S :')
disp(' ')
K = 8;
orientation = zeros(1,K);
orientation(1,1) = 0; orientation(1,2) = 30;
orientation(1,3) = -30; orientation(1,4) = 0; orientation(1,5) = 0;
orientation(1,6) = -30; orientation(1,7) = 30;
orientation(1,8) = 0;
case 3
tl=' [ 45 / -30 / 15 / -5 ] S ';
disp(' ')
disp('For the Laminate Schedule [ 45 / -30 / 15 / -5 ]
S :')
disp(' ')
K = 8;
orientation = zeros(1,K);
orientation(1,1) = 45; orientation(1,2) = -30;
orientation(1,3) = 15; orientation(1,4) = -5; orientation(1,5) = -5;
orientation(1,6) = 15; orientation(1,7) = -30;
orientation(1,8) = 45;
case 4
tl=' [ 45 / 45 / 45 / 45 / -45 / -45 / -45 / -45 ] T ';
disp(' ')
disp('For the Laminate Schedule [ 45 / -30 / 15 / -5 ]
S :')
disp(' ')
K = 8;
orientation = zeros(1,K);
orientation(1,1) = 45; orientation(1,2) = 45;
orientation(1,3) = 45; orientation(1,4) = 45; orientation(1,5) = -45;
orientation(1,6) = -45; orientation(1,7) = -45;
orientation(1,8) = -45;
case 5
tl='[ 45 / -45 ] S ';
disp(' ')
disp('For the Laminate Schedule [ 45 / -45 ] S :')
disp(' ')
K = 4;
orientation = zeros(1,K);
orientation(1,1) = 45; orientation(1,2) = -45;
orientation(1,3) = -45; orientation(1,4) = 45;
if All == 1
Fo = input('Enter [U] to feed External Forces or [B] to use built-
in External Forces [U/B]= ','s');
if (strcmpi(Fo,'U'))
disp(' ')
Nx=input('Enter the Force along x-direction (N/m) = ');
Ny=input('Enter the Force along y-direction (N/m) = ');
Nxy=input('Enter the Force along xy-direction (N/m) = ');
Mx=input('Enter the Moment along x-direction (Nm/m) = ');
My=input('Enter the Moment along y-direction (Nm/m) = ');
Mxy=input('Enter the Moment along xy-direction (Nm/m) = ');
disp(' ')
else
end
%% Thermal Stresses
disp(' ')
Te = input('Enter [U] to feed Temperature or [B] to use built-
in Temperature [U/B]= ','s');
disp(' ')
if (strcmpi(Te,'U'))
disp(' ')
Ter=input('Enter the Reference Temperature (°C) = ');
Tea=input('Enter the Ambient Temperature (°C) = ');
disp(' ')
else
Ter=80; Tea=23;
disp(' ')
disp(['Reference Temprature = ' num2str(Ter) '°C']);
disp(['Ambient Temprature = ' num2str(Tea) '°C']);
disp(' ')
end
end
for n= 1:K
c=cosd(orientation(1,n));
s=sind(orientation(1,n));
a11=c.^2; a12=s.^2; a13=2*c*s;
a21=s.^2; a22=c.^2; a23=(-2*c*s);
a31=(-c*s); a32=c*s; a33=c.^2-s.^2;
T = [a11 a12 a13; a21 a22 a23; a31 a32 a33];
sm = [ 1/E1, -v/E2, 0 ; -v/E1, 1/E2, 0 ; 0, 0, 1/g];
r = [1 0 0; 0 1 0; 0 0 2];
S = r*inv(T)*inv(r)*sm*T;
Q_bar = inv(S);
M{n} = Q_bar;
end
%% Z-Cordinates
h=K*t;
for j=1:K+1
Z(1,j)=h/2-t*(j-1);
end
%% ABBD Matrix
aa=0;
bb=0;
dd=0;
A=zeros(3,3);
B=zeros(3,3);
D=zeros(3,3);
for yy = 1:3
for zz = 1:3
for xx = 1:K
aa = aa + (M{xx}(yy,zz)) * (Z(1,xx)-Z(1,xx+1));
bb = bb + (M{xx}(yy,zz)) * (Z(1,xx)^2-(Z(1,xx+1))^2);
dd = dd + (M{xx}(yy,zz)) * (Z(1,xx)^3-(Z(1,xx+1))^3);
A(zz,yy)=aa;
B(zz,yy)=0.5*bb;
D(zz,yy)=(1/3)*dd;
aa=0;
bb=0;
dd=0;
ABBD=zeros(6,6);
e=vpa(inv(ABBD)*F);
Si=cell(2*K,1);
for b=1:K
si=M{b} * ([(e(1))+((Z(1,b)-Z(1,b+1))*(e(4)))-(TG{b}
(1,1))*(Tea-Ter) ; (e(2))+((Z(1,b)-Z(1,b+1))*(e(5)))-(TG{b}(2,1))*(Tea-Ter); (e(3))
+((Z(1,b)-Z(1,b+1))*(e(6)))-(TG{b}(3,1))*(Tea-Ter)]);
Si{b}=si;
end
ax=zeros(K,1);
for k=1:K
ax(k,1) = Si{k}(1);
end
f=0;
for i=1:K
if i == K
AX(2*i,1)=ax(i,1);
AX(2*i-1,1)=ax(i,1);
else
AX(f+i,1)=ax(i,1);
AX(f+i+1,1)=ax(i,1);
f=1+f;
end
end
f=0;
for i=1:(K+1)
switch i
case 1
Q(i,1)=Z(1,i);
case K+1
Q((i-1)*2,1)=Z(1,i);
otherwise
Q(f+i,1)=Z(1,i);
Q(f+i+1,1)=Z(1,i);
f=1+f;
end
end
ay=zeros(K,1);
for k=1:K
ay(k,1) = Si{k}(2);
end
f=0;
for i=1:K
if i == K
AY(2*i,1)=ay(i,1);
AY(2*i-1,1)=ay(i,1);
else
AY(f+i,1)=ay(i,1);
AY(f+i+1,1)=ay(i,1);
f=1+f;
end
end
axy=zeros(K,1);
for k=1:K
axy(k,1) = Si{k}(3);
end
f=0;
for i=1:K
if i == K
AXY(2*i,1)=axy(i,1);
AXY(2*i-1,1)=axy(i,1);
else
AXY(f+i,1)=axy(i,1);
AXY(f+i+1,1)=axy(i,1);
f=1+f;
end
end
%% Graph
figure ('Name',tl,'NumberTitle','off')
plot(AX,Q,'r','linewidth',4.5)
hold on
plot(AY,Q,'g','linewidth',3);plot(AXY,Q,'b','linewidth',1.5)
yline(0,'k','linewidth',1.15);xline(0,'k','linewidth',1);
grid on
lg =
legend({'\sigmaxx','\sigmayy','\sigmaxy'},'Location','best');
title(lg,'Stress')
xlabel('Stress (Pa)'); ylabel('Z-Cordinate');
title({'Stress variation for the Laminate Schedule
\color{magenta} ';tl ;'\color{black} including Thermal Strain'})
hold off
if LS1 == 6
disp(' ')
disp('......END......END......END......END......END............END......END......EN
D............END......END......END......')
else
%% Force Input
if (strcmpi(Fo,'U'))
disp(' ')
Nx=input('Enter the Force along x-direction (N/m) = ');
Ny=input('Enter the Force along y-direction (N/m) = ');
Nxy=input('Enter the Force along xy-direction (N/m) = ');
Mx=input('Enter the Moment along x-direction (Nm/m) = ');
My=input('Enter the Moment along y-direction (Nm/m) = ');
Mxy=input('Enter the Moment along xy-direction (Nm/m) = ');
disp(' ')
else
end
%% Thermal Stresses
disp(' ')
Te = input('Enter [U] to feed Temperature or [B] to use built-in Temperature [U/B]=
','s');
disp(' ')
if (strcmpi(Te,'U'))
disp(' ')
Ter=input('Enter the Reference Temperature (°C) = ');
Tea=input('Enter the Ambient Temperature (°C) = ');
disp(' ')
else
Ter=80; Tea=23;
disp(' ')
disp(['Reference Temprature = ' num2str(Ter) '°C']);
disp(['Ambient Temprature = ' num2str(Tea) '°C']);
disp(' ')
end
for n= 1:K
c=cosd(orientation(1,n));
s=sind(orientation(1,n));
a11=c.^2; a12=s.^2; a13=2*c*s;
a21=s.^2; a22=c.^2; a23=(-2*c*s);
a31=(-c*s); a32=c*s; a33=c.^2-s.^2;
T = [a11 a12 a13; a21 a22 a23; a31 a32 a33];
sm = [ 1/E1, -v/E2, 0 ; -v/E1, 1/E2, 0 ; 0, 0, 1/g];
r = [1 0 0; 0 1 0; 0 0 2];
S = r*inv(T)*inv(r)*sm*T;
Q_bar = inv(S);
M{n} = Q_bar;
end
%% Z-Cordinates
h=K*t;
for j=1:K+1
Z(1,j)=h/2-t*(j-1);
end
%% ABBD Matrix
aa=0;
bb=0;
dd=0;
A=zeros(3,3);
B=zeros(3,3);
D=zeros(3,3);
for yy = 1:3
for zz = 1:3
for xx = 1:K
aa = aa + (M{xx}(yy,zz)) * (Z(1,xx)-Z(1,xx+1));
bb = bb + (M{xx}(yy,zz)) * (Z(1,xx)^2-(Z(1,xx+1))^2);
dd = dd + (M{xx}(yy,zz)) * (Z(1,xx)^3-(Z(1,xx+1))^3);
A(zz,yy)=aa;
B(zz,yy)=0.5*bb;
D(zz,yy)=(1/3)*dd;
aa=0;
bb=0;
dd=0;
ABBD=zeros(6,6);
e=vpa(inv(ABBD)*F);
Si=cell(2*K,1);
for b=1:K
si=M{b} * ([(e(1))+((Z(1,b)-Z(1,b+1))*(e(4)))-(TG{b}(1,1))*(Tea-Ter) ;
(e(2))+((Z(1,b)-Z(1,b+1))*(e(5)))-(TG{b}(2,1))*(Tea-Ter); (e(3))+((Z(1,b)-
Z(1,b+1))*(e(6)))-(TG{b}(3,1))*(Tea-Ter)]);
Si{b}=si;
end
ax=zeros(K,1);
for k=1:K
ax(k,1) = Si{k}(1);
end
f=0;
for i=1:K
if i == K
AX(2*i,1)=ax(i,1);
AX(2*i-1,1)=ax(i,1);
else
AX(f+i,1)=ax(i,1);
AX(f+i+1,1)=ax(i,1);
f=1+f;
end
end
f=0;
for i=1:(K+1)
switch i
case 1
Q(i,1)=Z(1,i);
case K+1
Q((i-1)*2,1)=Z(1,i);
otherwise
Q(f+i,1)=Z(1,i);
Q(f+i+1,1)=Z(1,i);
f=1+f;
end
end
ay=zeros(K,1);
for k=1:K
ay(k,1) = Si{k}(2);
end
f=0;
for i=1:K
if i == K
AY(2*i,1)=ay(i,1);
AY(2*i-1,1)=ay(i,1);
else
AY(f+i,1)=ay(i,1);
AY(f+i+1,1)=ay(i,1);
f=1+f;
end
end
axy=zeros(K,1);
for k=1:K
axy(k,1) = Si{k}(3);
end
f=0;
for i=1:K
if i == K
AXY(2*i,1)=axy(i,1);
AXY(2*i-1,1)=axy(i,1);
else
AXY(f+i,1)=axy(i,1);
AXY(f+i+1,1)=axy(i,1);
f=1+f;
end
end
%% Graph
figure ('Name',tl,'NumberTitle','off')
plot(AX,Q,'r','linewidth',4.5)
hold on
plot(AY,Q,'g','linewidth',3);plot(AXY,Q,'b','linewidth',1.5)
yline(0,'k','linewidth',1.15);xline(0,'k','linewidth',1);
grid on
lg = legend({'\sigmaxx','\sigmayy','\sigmaxy'},'Location','best');
title(lg,'Stress')
xlabel('Stress (Pa)'); ylabel('Z-Cordinate');
title({'Stress variation for the Laminate Schedule \color{magenta}
';tl ;'\color{black} including Thermal Strain'})
hold off
disp(' ')
disp('......END......END......END......END......END............END......END......EN
D............END......END......END......')
end