How to plot an implicit and dicontinues function?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Francisco Patitucci Perez
el 23 de Oct. de 2020
Comentada: Francisco Patitucci Perez
el 24 de Oct. de 2020
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 comentarios
Respuesta aceptada
Alan Stevens
el 24 de Oct. de 2020
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.
Más respuestas (1)
Alan Stevens
el 24 de Oct. de 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
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!