My plot won't show any graph
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I try to plot the data i get from step below. But My plot doesn't have any data. Just a clean sheet. Can anyone tell which part I'm wrong
clear
%%Given :
T= 5;
del_t=0.5;
t=0:del_t:T;
E=5;
v=0.3;
Sya=25;
Sy=15;
d=0.4;
vis=0;
gamma=0;
%Assume :
epn=0;
alfa=0;
DevS=0;
M= E/(2*(1+v));
L= (E*v)/[(1+v)*(1-2*v)];
G = norm(DevS)-sqrt(2/3)*Sy+(Sya-Sy)*(1-exp(-d*alfa))-[M*gamma*2];
Gd=-2*M*(1+(Sya-Sy)*d*exp(-d*gamma));
for n = 1:length(t);
strain=6*n*[1 0 0; 0 1 0; 0 0 1]+6*sin(n)*[0 2 0; 2 1 0; 0 0 3/2];
el=strain-(1/3)*trace(strain)*eye(3,3);%
DevStrial=DevS+2*M*(el-epn); %Devatoric Stress Trial
etrial=DevStrial;
y=Sy+(Sya-Sy)*(1-exp(-d*alfa));
ftrial=norm(DevS)-sqrt(2/3)*y;
if ftrial<=0;
DevS=DevStrial;
else
while and((abs((G/Gd)/gamma)) >= 0.001, gamma==0);
%g[dγ(k)]
G = ftrial-[M*gamma*2];
%Dg[dγ(k)]
Gd=-2*M*(1+(Sya-Sy)*d*exp(-d*gamma));
gamma= gamma - G/Gd;
% Derivative of yield limit function: K'(α)
end
del_g= gamma;
normal=etrial/norm(etrial);
alfa=alfa+sqrt(2/3)*del_g;
%Update back stress, plastic strain, and stress
epn=epn+del_g*normal;
k = L+(2/3)*M;
S=k*trace(strain)*eye(3,3)+DevStrial-2*M*del_g;
% Compute consistent elastoplastic tangent moduli
A=eye(3,3);
B=eye(6,6);
Cp=1/3*kron(A,A)-kron(normal,normal);
end
end
figure
hold on
plot(t,S(1:1,1:1),'linewidth',5,'color','r')
plot(t,S(2:2,2:2),'linewidth',5,'color','r')
plot(t,S(3:3,3:3),'linewidth',5,'color','r')
legend('s11','s22','s33')
plot(t, alfa ,'linewidth',5,'color','r')
xlabel( 'Time', 'FontSize', 16)
ylabel( 'alfa', 'FontSize', 18)
grid on
figure
hold on
plot(t,Cp(1:1,1:1),'linewidth',5,'color','r')
plot(t,Cp(4:4,4:4),'linewidth',5,'color','r')
plot(t,Cp(5:5,5:5),'linewidth',5,'color','r')
legend('s1','s2','s3')
0 commentaires
Réponse acceptée
VBBV
le 14 Déc 2020
Modifié(e) : VBBV
le 14 Déc 2020
clear
%%Given :
T= 5;
del_t=3;
t=linspace(0,T,del_T);
E=5;
v=0.3;
Sya=25;
Sy=15;
d=0.4;
vis=0;
gamma=0;
%Assume :
epn=0;
alfa=zeros(size(t));
DevS=0;
M= E/(2*(1+v));
L= (E*v)/[(1+v)*(1-2*v)];
G = norm(DevS)-sqrt(2/3)*Sy+(Sya-Sy)*(1-exp(-d*alfa))-[M*gamma*2];
Gd=-2*M*(1+(Sya-Sy)*d*exp(-d*gamma));
for n = 1:length(t);
strain=6*n*[1 0 0; 0 1 0; 0 0 1]+6*sin(n)*[0 2 0; 2 1 0; 0 0 3/2];
el=strain-(1/3)*trace(strain)*eye(3,3);%
DevStrial=DevS+2*M*(el-epn); %Devatoric Stress Trial
etrial=DevStrial;
y=Sy+(Sya-Sy)*(1-exp(-d*alfa));
ftrial=norm(DevS)-sqrt(2/3)*y;
if ftrial<=0;
DevS=DevStrial;
else
while and((abs((G/Gd)/gamma)) >= 0.001, gamma==0);
%g[dγ(k)]
G = ftrial-[M*gamma*2];
%Dg[dγ(k)]
Gd=-2*M*(1+(Sya-Sy)*d*exp(-d*gamma));
gamma= gamma - G/Gd;
% Derivative of yield limit function: K'(α)
end
del_g= gamma;
normal=etrial/norm(etrial);
alfa(n)=alfa(n)+sqrt(2/3)*del_g;
%Update back stress, plastic strain, and stress
epn=epn+del_g*normal;
k = L+(2/3)*M;
S=k*trace(strain)*eye(3,3)+DevStrial-2*M*del_g;
% Compute consistent elastoplastic tangent moduli
A=eye(3,3);
B=eye(6,6);
Cp=1/3*kron(A,A)-kron(normal,normal);
end
end
% figure plots
figure(1)
plot(t,S(1:3,1:3),'linewidth',5,'color','r')
legend('s11','s22','s33')
hold on
plot(t, alfa ,'linewidth',5,'color','r')
xlabel( 'Time', 'FontSize', 16)
ylabel( 'alfa', 'FontSize', 18)
grid on
figure(2)
plot(t,Cp(1:3,1:3),'linewidth',5,'color','r')
legend('s1','s2','s3')
0 commentaires
Plus de réponses (1)
Jan
le 14 Déc 2020
I assume, this is an effect or drawing a line with just 1 point, which produces no line.
Try
plot(t, S(1,1), 'linewidth', 5, 'color', 'r', 'Marker', 'o')
Voir également
Catégories
En savoir plus sur Stress and Strain 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!