How to plot an implicit and dicontinues function?
2 ビュー (過去 30 日間)
古いコメントを表示
Francisco Patitucci Perez
2020 年 10 月 23 日
コメント済み: Francisco Patitucci Perez
2020 年 10 月 24 日
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
0 件のコメント
採用された回答
Alan Stevens
2020 年 10 月 24 日
Do you mean like this (type doc contour for more detail):
x1 = -2:0.01:2;
x2 = -2:0.01:2;
[x, y] = meshgrid(x1, x2);
z = THb(x,y);
lvls = [1 2 5 10 15 20 40 60]*10^-6; % Set the contour values you want to see
contour(x,y,z,lvls,'ShowText','on')
xlabel('x1'),ylabel('x2'),zlabel('z')
... etc.
その他の回答 (1 件)
Alan Stevens
2020 年 10 月 24 日
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
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!