producing n*n matrix as an string in a loop

1 回表示 (過去 30 日間)
talayeh tavangar
talayeh tavangar 2020 年 6 月 15 日
コメント済み: Image Analyst 2020 年 6 月 16 日
Hi,
I want to used the following code put I donot know how to safe K as an n*n mtrix in each loop. because by using my code the code only use the last element of K. would you mind helping me with that?
for i=1:20
for j=1:20
for k=1:400
C{k}=E(i,j)/(1-nu(i,j)*nu(i,j))*[1,nu(i,j),0;nu(i,j),1,0;0,0,0.5-0.5*nu(i,j)]; %plane stress nu and E are poisson's ratio and young's modulus
end
end
end
for i=1:400, %element assembly
[B,Jac]=B_func(i); %jacodian function
Ke{i}=B'*C{i}*B*Jac*0.5; %Ke is elemental stiffness matrix
m=elem(i,:);
n=[2*m-1;2*m];
K(n,n)=K(n,n)+Ke{i}; %compute global stiffness matrix K
end
  7 件のコメント
talayeh tavangar
talayeh tavangar 2020 年 6 月 16 日
thanks
but in my code Ke is an string which has 400 elements of 6*6 matrix so I want to creat another sting as K which has 400 elements
Image Analyst
Image Analyst 2020 年 6 月 16 日
Do you have a screenshot of a book or article that shows the formula in standard kind of mathematical notation?
Also, attach a .mat file with all the variables we'll need to run your code.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Identification についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by