Why does my matrix not change with each iteration?

1 回表示 (過去 30 日間)
J
J 2024 年 11 月 16 日
コメント済み: J 2024 年 11 月 16 日
In my code:
B = Bmat_4n(x,y,xi,eta);
for point = 1:length(xiList)
xi = xiList(point);
eta = etaList(point);
strain = B*U;
strainList(:, point) = strain;
disp(B);
end
I run 4 iterations (length of xilist) and I get 4 different xi and eta values as intended. B here refers to a seperate function file which when tested by itself naturally gives different results for B for different xi and eta values but when I run the loop here I get 4 times the same B matrix? what am I missing?
The B is meant to draw the matrix B at the end of the function file

採用された回答

Matt J
Matt J 2024 年 11 月 16 日
編集済み: Matt J 2024 年 11 月 16 日
I don't know why you think B should be changed by the loop when you generate it prior to the loop and never touch it again. Perhaps this is what you meant to have:
for point = 1:length(xiList)
xi = xiList(point);
eta = etaList(point);
B = Bmat_4n(x,y,xi,eta);
strain = B*U;
strainList(:, point) = strain;
disp(B);
end
  1 件のコメント
J
J 2024 年 11 月 16 日
Thank you! I knew it was something dumb like that

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFinancial Toolbox についてさらに検索

タグ

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by