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

18 次查看(过去 30 天)
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