Contour not being rendered for non-finite data??
11 次查看(过去 30 天)
显示 更早的评论
I am getting the following warning and my contourf is returning blank
Warning: Contour not rendered for non-finite ZData
> In contourf (line 60)
In Project1 (line 23)
%crack length - for Kanalytical
a = 0.1;
K = sqrt(pi*a)*1000;
%grid for results to look like plate, adjusting for crack edge tip
[x,y] = meshgrid(-0.1:0.01:1-a, -0.5:0.01:0.5);
%polar coordinates
r = sqrt(x.^2+y.^2);
theta = atan(y./x);
%Airy stress ; for a = 10cm
sigmaxx = (K./sqrt(2*pi*r)).*cos(theta/2).*(1-(sin(theta/2).*sin(3*theta/2)));
sigmayy = (K./sqrt(2*pi*r)).*cos(theta/2).*(1+(sin(theta/2).*sin(3*theta/2)));
tauxy = (K./sqrt(2*pi*r)).*cos(theta/2).*(sin(theta/2).*cos(3*theta/2));
sigmavm = ((.5*(((sigmaxx-sigmayy)^2)+(sigmaxx^2)+(sigmayy^2)))+(3*(tauxy^2))^.5);
%surface of plate
surf(x,y,sigmavm);
xlabel('X'), ylabel('Y'), zlabel('von Mises Stress')
figure(1);
contourf(x,y,sigmavm)
xlabel('X'), ylabel('von Mises Stress')
%sigmayy along theta = 0
figure(2);
[i,j]=meshgrid(-0.1:0.01:1-a, -0.5:0.01:0.5);
rr = sqrt(x.^2+y.^2);
M=K./(sqrt(2*pi*rr));
figure(2)
plot(rr,M,'-',Color='b')
xlim([-0.1, 0.9])
xlabel('X'), ylabel('Sigmayy'), title('Sigmayy versus r at theta = 0');
0 个评论
回答(1 个)
VBBV
2022-12-5
%crack length - for Kanalytical
a = 0.1;
K = sqrt(pi*a)*1000;
%grid for results to look like plate, adjusting for crack edge tip
[x,y] = meshgrid(-0.1:0.03:1-a, -0.5:0.03:0.5);
%polar coordinates
r = sqrt(x.^2+y.^2);
theta = atan(y./x);
%Airy stress ; for a = 10cm
sigmaxx = (K./sqrt(2*pi*r)).*cos(theta/2).*(1-(sin(theta/2).*sin(3*theta/2)));
sigmayy = (K./sqrt(2*pi*r)).*cos(theta/2).*(1+(sin(theta/2).*sin(3*theta/2)));
tauxy = (K./sqrt(2*pi*r)).*cos(theta/2).*(sin(theta/2).*cos(3*theta/2));
sigmavm = ((.5*(((sigmaxx-sigmayy)^2)+(sigmaxx^2)+(sigmayy^2)))+(3*(tauxy^2))^.5);
%surface of plate
surf(x,y,real(sigmavm));
xlabel('X'), ylabel('Y'), zlabel('von Mises Stress')
figure(1);
contourf(x,y,real(sigmavm))
xlabel('X'), ylabel('von Mises Stress')
%sigmayy along theta = 0
figure(2);
[i,j]=meshgrid(-0.1:0.03:1-a, -0.5:0.03:0.5);
rr = sqrt(x.^2+y.^2);
M=K./(sqrt(2*pi*rr));
figure(2)
plot(rr,M,'-',Color='b')
xlim([-0.1, 0.9])
xlabel('X'), ylabel('Sigmayy'), title('Sigmayy versus r at theta = 0');
1 个评论
VBBV
2022-12-5
use a grid resolution to avoid singularity, i.e. zero
[x,y] = meshgrid(-0.1:0.03:1-a, -0.5:0.03:0.5); %
since these expressions have the reciprocals of x and y variables at which value becomes infinite
sigmaxx = (K./sqrt(2*pi*r)).*cos(theta/2).*(1-(sin(theta/2).*sin(3*theta/2)));
sigmayy = (K./sqrt(2*pi*r)).*cos(theta/2).*(1+(sin(theta/2).*sin(3*theta/2)));
tauxy = (K./sqrt(2*pi*r)).*cos(theta/2).*(sin(theta/2).*cos(3*theta/2));
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!