Effacer les filtres
Effacer les filtres

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

18 vues (au cours des 30 derniers jours)
Luis
Luis le 5 Mar 2023
Réponse apportée : Voss le 5 Mar 2023
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")

Réponse acceptée

Voss
Voss le 5 Mar 2023
[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')

Plus de réponses (0)

Catégories

En savoir plus sur Stress and Strain dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by