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 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
KSSV
le 5 Avr 2022
Modifié(e) : KSSV
le 5 Avr 2022
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 commentaires
KSSV
le 5 Avr 2022
?You have orange colored undeline in the code right? Those are warning, place the cursor there and see what MATLAB suggesting you.
Plus de réponses (1)
John D'Errico
le 5 Avr 2022
Modifié(e) : John D'Errico
le 5 Avr 2022
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 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!