フィルターのクリア

My plot won't show any graph

2 ビュー (過去 30 日間)
Steve
Steve 2020 年 12 月 14 日
編集済み: VBBV 2020 年 12 月 14 日
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')

採用された回答

VBBV
VBBV 2020 年 12 月 14 日
編集済み: VBBV 2020 年 12 月 14 日
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')

その他の回答 (1 件)

Jan
Jan 2020 年 12 月 14 日
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')
  2 件のコメント
Steve
Steve 2020 年 12 月 14 日
It still doesn't work, the S function is a matrix 3x3, and I want to plot the value of the first row and first column when t=0 till t=5
Jan
Jan 2020 年 12 月 14 日
編集済み: Jan 2020 年 12 月 14 日
The first row is S(1, :), not S(1:1, 1:1).
What about:
plot(t,S,'linewidth',5,'color','r')

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStress and Strain についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by