Filter löschen
Filter löschen

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 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

KSSV
KSSV am 5 Apr. 2022
Bearbeitet: KSSV am 5 Apr. 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 Kommentare
KSSV
KSSV am 5 Apr. 2022
?You have orange colored undeline in the code right? Those are warning, place the cursor there and see what MATLAB suggesting you.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

John D'Errico
John D'Errico am 5 Apr. 2022
Bearbeitet: John D'Errico am 5 Apr. 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?

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by