i am getting this error "Brace indexing is not supported for variables of this type" at line which contains (S_bar{i}=R{i}*T_1{i}*R_1{i}*S{i}*T{i});.
조회 수: 2 (최근 30일)
이전 댓글 표시
sigma1=0.002;
sigma2=-0.003;
tau_12=0.004;
E1=181;
E2=10.3;
mu_12=0.28;
G12=7.17;
tetha=0:90;
c=cosd(tetha);
s=sind(tetha);
Stress_12=[sigma1; sigma2; tau_12];
%S matrix calculation
S=[1/E1 -mu_12/E1 0;-mu_12/E1 1/E2 0;0 0 1/G12];
%Q matrix calculation
Q=inv(S);
%Strain Vector calculation
Strain_12=S*Stress_12;
for i=1:numel(tetha)
%Transformation matrix calculation
T{i}=[c(i).^2 s(i).^2 2.*s(i).*c(i); s(i).^2 c(i).^2 -2.*s(i).*c(i); -s(i).*c(i) s(i).*c(i) (c(i).^2)-(s(i).^2)];
%Inverse of the transformation matrix
T_1{i}=inv(T{i});
%R matrix
R{i}=[1 0 0; 0 1 0; 0 0 2];
R_1{i}=inv(R{i});
%S bar matrix calculation
S_bar{i}=R{i}*T_1{i}*R_1{i}*S{i}*T{i};
end
댓글 수: 0
채택된 답변
KSSV
2022년 4월 5일
편집: KSSV
2022년 4월 5일
IN this line:
S_bar{i}=R{i}*T_1{i}*R_1{i}*S{i}*T{i};
S is a matrix not a cell. So replace it by:
S_bar{i}=R{i}*T_1{i}*R_1{i}*S*T{i};
Also try initializing R, T_1, R_1 etc. Note that you can also intialize them as 3D matrix.
R = zeros(3,3,numel(tetha)) ;
댓글 수: 2
KSSV
2022년 4월 5일
?You have orange colored undeline in the code right? Those are warning, place the cursor there and see what MATLAB suggesting you.
추가 답변 (1개)
John D'Errico
2022년 4월 5일
편집: John D'Errico
2022년 4월 5일
Is S a regular matrix?
S=[1/E1 -mu_12/E1 0;-mu_12/E1 1/E2 0;0 0 1/G12];
Yes. You then you assume it is a cell array for some reason.
S_bar{i}=R{i}*T_1{i}*R_1{i}*S{i}*T{i};
____
Did MATLAB tell you there was a problem on that line?
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!