フィルターのクリア

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

採用された回答

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)) ;
  2 件のコメント
Mahmoud Chawki
Mahmoud Chawki 2022 年 4 月 5 日
thank you,
it worked ,
why would i initiaalize them i don't understand
KSSV
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
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 Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by