# Question:matlab code to maple

## Question:matlab code to maple

Maple

clc
clc
clear all
E1=181*10^9;
E2=10.30*10^9;
G12=7.17*10^9;
nu_12=0.28;
nu_21=(nu_12*E2)/E1;
fprintf('Please enter a numerical value for Total Height.')
htotal=input('htotal=');
fprintf('Number of entries for ply orientations should equal the number of entries for aspect ratios .','Please enter values separated by spaces in [].')
O(1,:)=input('ORIENTATION=');
fprintf('Please enter values separated by spaces in [] for the Independent Ply Aspect Ratios(=Thickness of each ply/Total Height).')
AR=input('ASPECT-RATIO=');
[ARrows,ARcols] = size(AR(1,:));
[orows,ocols] = size(O(1,:));
if ocols~=ARcols
fprintf('Check Number of Independent Ply Orientation and Aspect Ratio.')
end
plycount = ocols;
k=0;
sumAR = sum(AR);
H = htotal*(AR/sumAR)
% Define matrix with ply orientations as row one and corresponding height
% as row two for beter display
OHmatrix = [O;H]
Z=zeros(1,plycount+1);
hindex = -(htotal)/2 ;
for i=1:plycount+1
if i==1
Z(:,i) = hindex;
else
Z(:,i) = Z(:,i-1)+ H(i-1);
end
end
s11=1/E1;
s12=-nu_12/E1;
s16=0;
s21=s12;
s22=1/E2;
s26=0;
s61=s16;
s62=s26;
s66=1/G12;
S=[s11 s12 s16;s21 s22 s26;s61 s62 s66];
Q11 = E1/(1- nu_12*nu_21);
Q22 = E2/(1- nu_12*nu_21);
Q12 = (nu_21*E1)/(1- nu_12*nu_21);
Q66 = G12;
% note that Q21 = Q12
Qp = [ Q11, Q12 , 0 ;Q12, Q22 , 0 ;0 , 0 , Q66 ];
% Intializing ABD as a 3x3 zero matrix
A = zeros(3,3) ;
B = zeros(3,3) ;
D = zeros(3,3) ;
% Calculating the A, B, D Matrices for each ply
Qp(3,3) = Qp(3,3)*2 ;
for l = 1 : plycount
thetar = (O(l)/180)*pi;
% define "m" and "n" as
m = cos(thetar);
n = sin(thetar);
% 2D Transformation matrix T :
T = [m^2 , n^2 , 2*m*n ;n^2 , m^2 , -2*m*n ;-m*n , m*n , m^2 - n^2 ];
% Correcting for engineering strain-true strain
Q = T\Qp*T ;
Q(:,3) = Q(:,3)*.5 ;
l
Q
for i=1:3
for j=1:3
A(i,j)= A(i,j) + (Q(i,j))*( Z(l+1) - Z(l) );
B(i,j)= B(i,j) + 0.5* ((Q(i,j))*( (Z(l+1))^2 - (Z(l))^2 ));
D(i,j)= D(i,j) + (1/3)*((Q(i,j))*( (Z(l+1))^3 - (Z(l))^3 ));
end
end
for i=1:3
for j=1:3
if abs(A(i,j))< 1.0e-4
A(i,j) = 0;
end
if abs(B(i,j))< 1.0e-4
B(i,j) = 0;
end
if abs(D(i,j))< 1.0e-4
D(i,j) = 0;
end
end
end
end
%Finding AB-BD matrix and its inverse
ABDmatrix = [A B ; B D];
A = ABDmatrix(1:3, 1:3)
B = ABDmatrix(1:3, 4:6)
D = ABDmatrix(4:6, 4:6)

﻿