draw principal directions on a plot

4 vues (au cours des 30 derniers jours)
Jay
Jay le 8 Mai 2014
I am trying to draw principal directions from strain tensors on a plot. I attached some part of my code.
for j=1:15 ..
for k=1:(sizetemp(1,2)-1)
..
% e2_j_k is 2 X 2 strain tensors.
[V,D] = eig(e2_j_k);
if (D(1,1) > D(2,2))
eigen_j_k = D(1,1);
p= [V(1,1);V(2,1)];
if (V(2,1) < 0)
theta_j_k = -acosd(dot([1 0],p));
else
theta_j_k = acosd(dot([1 0],p));
end
else
eigen_j_k = D(2,2);
p= [V(1,2);V(2,2)];
if (V(2,2) < 0)
theta_j_k = -acosd(dot([1 0],p));
else
theta_j_k = acosd(dot([1 0],p));
end
end
eval(sprintf('e_%d_%d =e_j_k;',j,k));
eval(sprintf('eigen_%d_%d = eigen_j_k',j,k));
eval(sprintf('theta_%d_%d = theta_j_k',j,k));
% I already know xc and zc.
xc(j,k) = xx(1,k);
zc(j,k) = xz(1,k);
eigen(j,k) = eigen_j_k;
theta(j,k) = theta_j_k;
% xc2 and zc2 are new points to draw lines representing principal directions.
xc2(j,k) = xc(j,k) + 0.3*cosd(theta(j,k));
zc2(j,k) = zc(j,k) + 0.3*sind(theta(j,k));
figure(6);
plot([xc(j,k),xc2(j,k)],[zc(j,k),zc2(j,k)]);
hold on;
end
end
======================================
I know what results are supposed to be, but I don't get the reasonable results with this code. Can you see anything that I am doing wrong? Or do you have any suggestions for different method? I would appreciate any help. Thanks,
Jay

Réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differential Equations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by