Contour not being rendered for non-finite data??

조회 수: 13 (최근 30일)
Natali Petani
Natali Petani 2022년 12월 4일
댓글: VBBV 2022년 12월 5일
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');

답변 (1개)

VBBV
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
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 CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by