필터 지우기
필터 지우기

Can you please help me check my code? It is outputting only the last value instead of all the values generated in for loop. Thank you.

조회 수: 1 (최근 30일)
a = 0.5;
b = 0.1;
E = 0.2;
v = 0.3;
Y= (E/(1-v^2));
ve = [1 v 0; v 1 0; 0 0 (1-v)/2];
uu = [-0.02 0.012 -1.23 0.2343 -0.124 1.111 0.214 0.453];
for i = 1:length(nu);
for j = 1:length(eta);
nu = -1:0.01:1;
eta = -1:0.01:1;
B(i,j) = [-(1-nu)/(4*a) 0 (1-nu)/(4*a) 0 (1+nu)/(4*a) 0 -(1+nu)/(4*a) 0;...
0 -(1-eta)/(4*b) 0 -(1+eta)/(4*b) 0 (1+eta)/(4*b) 0 (1-eta)/(4*b);...
-(1-eta)/(4*b) -(1-nu)/(4*a) -(1+eta)/(4*b) (1-nu)/(4*a) (1+eta)/(4*b) (1+nu)/(4*a) (1-eta)/(4*b) -(1+nu)/(4*a)];
e(i,j) = B(i,j)*uu';
sig(i,j) = Y.*ve*e(i,j); % calculate the sig for each of the count and store it in sigsig
end
end
sigsig = [sig(i,j)]; % store all the sig here, each sig as a row vector

답변 (1개)

Walter Roberson
Walter Roberson 2017년 3월 20일
In the line
for i = 1:length(nu);
nu has not yet been defined.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by