How to plot an implicit and dicontinues function?
Show older comments
Hello, I want to ask how to plot the level curves of this function. I have tried with fimplicit and with fcontour but I can't plot it because of its discontinuities. If anyone knows it will be very helpful because it is for my composite structures course.
function [z] = THb(x1,x2)
E1 = 100*10^3;E2 = 7*10^3;nu12=.3;F1t=1000;F2t=45;F1c=600;F2c=150;F6=65;
if x1>=0
A=1/F1t^2;
C=-(1/F1t^2);
else
A=1/F1c^2;
C=-(1/F1c^2);
end
if x2>=0
B=1/F2t^2;
else
B=1/F2c^2;
end
z=A*x1.^2 + B*x2.^2 +C*x1.*x2;
end
Accepted Answer
More Answers (1)
Alan Stevens
on 24 Oct 2020
Something like the following? (You could use surfc if you want contours as well):
x1 = -10:10;
x2 = -10:10;
[x, y] = meshgrid(x1, x2);
z = THb(x,y);
surf(x,y,z)
xlabel('x1'),ylabel('x2'),zlabel('z')
function [z] = THb(x1,x2)
E1 = 100*10^3;E2 = 7*10^3;nu12=.3;F1t=1000;F2t=45;F1c=600;F2c=150;F6=65;
if x1>=0
A=1/F1t^2;
C=-(1/F1t^2);
else
A=1/F1c^2;
C=-(1/F1c^2);
end
if x2>=0
B=1/F2t^2;
else
B=1/F2c^2;
end
z=A*x1.^2 + B*x2.^2 +C*x1.*x2;
end
1 Comment
Francisco Patitucci Perez
on 24 Oct 2020
Categories
Find more on Contour Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!