필터 지우기
필터 지우기

How do I add a flat line on the z-axis?

조회 수: 18 (최근 30일)
Luis
Luis 2023년 3월 5일
답변: Voss 2023년 3월 5일
I figured out how to code my function, but I am being asked to add the ultimate stress alongside my graph, which would be a flat line on the z axis at Z=40. I tried doing this the same way as a flat line would be added on the y axis (yline[ ]), but it does not work. Any assistance is greatly appreciated. Thank you!
Here is my code:
[x,y]=meshgrid(0:0.0001:0.004,-pi/4:0.1:pi/4)
c=cos(y).*sqrt(pi.*x)
d=cos(y).^2
e=sin(y).^2
KI2=0.78^2
KII2=1.47^2
f=(d/KI2)+(e/KII2)
g=sqrt(f)
h=c.*g
z=1./h
surf(z)
xlabel("Crack Size (a)")
ylabel("Angle (b)")
zlabel("Critical Stress")
title("Failure Envelope Surface")

채택된 답변

Voss
Voss 2023년 3월 5일
[x,y]=meshgrid(0:0.0001:0.004,-pi/4:0.1:pi/4);
c=cos(y).*sqrt(pi.*x);
d=cos(y).^2;
e=sin(y).^2;
KI2=0.78^2;
KII2=1.47^2;
f=(d/KI2)+(e/KII2);
g=sqrt(f);
h=c.*g;
z=1./h;
surf(z)
xlabel("Crack Size (a)")
ylabel("Angle (b)")
zlabel("Critical Stress")
title("Failure Envelope Surface")
hold on
surf(40*ones(size(z)),'FaceColor','r','FaceAlpha',0.3,'EdgeColor','none')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Stress and Strain에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by