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});​.

1 次查看(过去 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

采纳的回答

KSSV
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)) ;

更多回答(1 个)

John D'Errico
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?

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by