Range of matrices?
조회 수: 8 (최근 30일)
이전 댓글 표시
I am having trouble with getting a range of Qbar matrix values for my different orientation angles below. I input the number of plies (n) and the orientation for each ply (theta). Now, I am trying to calculate a Qbar matrix for each ply based on its orientation but I keep getting an error. So i defined k=1:n and that u=theta(k)*pi/180 to convert it to radians. I do not know if I am even applying the orientation angle right for each ply. Does anyone know what I am doing wrong?
Thank you.
% Number of plies and orientation of each ply
prompt2 = {'Number of plies'};
dlgtitle2 = 'Number of plies definition';
dims2 = [1 100];
definput2 = {'4'}; % Default input
answer2 = inputdlg(prompt2,dlgtitle2,dims2,definput2);
n = str2num(answer2{1});
theta = zeros(1,n);
for i = 1:length(theta)
prompt3 = {sprintf('Enter orientation angle (in degrees) for ply #%d',i)};
dlgtitle3 = 'Laminate stacking sequence definition';
dims3 = [1 100];
definput3 = {'0'}; % Default input
answer3 = inputdlg(prompt3,dlgtitle3,dims3,definput3);
theta(i) = str2num(answer3{1});
end
%
% define an array h that stores the location of ply interfaces here ...
% the array should be the length of the theta array plus one (i.e., there
% are n+1 interfaces for a n ply laminate)
% be careful to take account of the cases of even and odd number of plies
% when there are an odd number of plies, interfaces are located at 1.5t, 2.5t, etc.
%%
% Compute Qbar for each ply
for k=1:n
u = theta(k)*pi/180;
c = cos(u);
s = sin(u);
Tsigma(k)= [c^2 s^2 2*c*s;...
s^2 c^2 -2*c*s;...
-c*s c*s c^2-s^2];
Tepsilon(k)= [c^2 s^2 c*s;...
s^2 c^2 -c*s;...
-2*c*s 2*c*s c^2-s^2]
Teps = inv(Tepsilon)
Sbar(k) = Teps*S*Tsigma
Qbar(k) = inv(Sbar);
end
댓글 수: 0
채택된 답변
Steven Lord
2021년 5월 2일
Tsigma(k)= [c^2 s^2 2*c*s;...
s^2 c^2 -2*c*s;...
-c*s c*s c^2-s^2];
What's on the right side of the equals sign is probably a 3-by-3 matrix since c and s are likely 1-by-1 matrices.
What's on the left side of the equals sign is a 1-by-1 matrix.
If you were buying groceries, how would you stuff 9 eggs into 1 cup of an egg carton without scrambling them? You wouldn't. MATLAB doesn't know how to stuff 9 elements into 1 element of a matrix either.
If you need to store the matrices for later use, store them in a cell array. If you don't, eliminate the (k) part of the left side of the equals sign.
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!