clc
close all
clear
phi=0;
f=0.995;
k=985;
n=0.3;
e1B=zeros(1,21);
e1A=zeros(1,21);
rhoA=0.01;
for i=1:21
e2A(i)=rhoA.*e1A(i); %strain in the undefected region for 2-direction
alpha_a=(2*rhoA+1)/(2+rhoA); %stress ratio in undefected region
eA(i)=e1A(i).*sqrt(4/3*(1+ rhoA+ rhoA^2)^2); %effective strain in undefected region
sigmaA(i)=k*eA(i)^n; %equivalent stress in undefected region
sigma1A(i)=sigmaA(i)./sqrt(alpha_a^2-alpha_a+1); %stress in undefected region in 1-direction
sigma2A(i)=alpha_a.*sigma1A(i); %stress in the undefected region in 2-direction
e2B(i)=e2A(i);
q_b(i)=e2B(i)./e1B(i); %strain ratio in defect region
alpha_b(i)=(2*q_b(i)+1)./(2+q_b(i)); %stress ratio in defect region
eB(i)=e1B(i).*sqrt(4/3*(1+q_b(i)+q_b(i)^2)^2); %effective strain in defect region
sigmaB(i)=k*eB(i).^n; %equivalent stress in defect region
sigma1B(i)=sigmaB(i)./sqrt(alpha_b(i).^2-alpha_b(i)+1); %stress in defect region in 1-direction
sigma2B(i)=alpha_b(i).*sigma1B(i); %stress in defect region in 2-direction
e1B(i+1)=e1B(i)+0.05;
rhoB(i)=e2B(i)./e1B(i);
e3A(i)=0-e1A(i)-e2A(i);
e3B(i)=0-e1B(i)-e2B(i);
deA(i)=(((f*exp(e3B(i)-e3A(i))*(1+sigmaB(i)./sigma1B(i))*(0.05+eB(i)).^n)/(1+sigmaA(i)./sigma1A(i)))^(1/n))-eA(i);
e1A(i+1)=e1A(i)+deA(i);
end
% plot(e1A(1:21),e2A,'b');
% hold on
% plot(e1B(1:21),e2B,'-.r');
% hold on

 Respuesta aceptada

Star Strider
Star Strider el 11 de Dic. de 2020

0 votos

Except for the first element, all the vectors are NaN. Those don’t plot. (If you plot using only a marker, you would see only the first element anyway.)
If you set these to something other than 0, such as:
e1B=zeros(1,21)+1E-8;
e1A=zeros(1,21)+1E-8;
you then get a plot with:
figure
plot(e1A(1:21),e2A,'b');
hold on
plot(e1B(1:21),e2B,'-.r');
hold off
grid
I did not examine your code closely to determine where the problem originates (NaN values are the result of 0/0, Inf/Inf or existing NaN entries) so I leave that to you. In the interim, setting those vectors to what is essentially the square root of eps at least produces something.

2 comentarios

Ziad Zakhem
Ziad Zakhem el 11 de Dic. de 2020
Thanks for your help!
Star Strider
Star Strider el 11 de Dic. de 2020
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Stress and Strain en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 11 de Dic. de 2020

Comentada:

el 11 de Dic. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by