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

Antworten (1)

Walter Roberson
Walter Roberson am 20 Mär. 2017
In the line
for i = 1:length(nu);
nu has not yet been defined.

Kategorien

Mehr zu Matrix Indexing 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