Surface plot for two variable piecewise function
2 次查看(过去 30 天)
显示 更早的评论
I need help plotting the following piecewise function in Matlab as surface plot. Any help is appreciated!!
x1 and x2 are [0,1]
3 个评论
回答(1 个)
Dyuman Joshi
2023-10-21
9 个评论
Torsten
2023-10-21
编辑:Torsten
2023-10-21
A bracket around 1/3 was missing. Should be
U = @(x1,x2) (1-exp(-5*(x1.^3+x2.^2).^(1/3))-(1-exp(-5))) .* (((x1.^3 + x2.^2) >= 0) & ((x1.^3 + x2.^2) <= 1)) + (x1.^3 + x2.^2 - 1) .* (((x1.^3 + x2.^2) >= 1) & ((x1.^3 + x2.^2) <= 2));
figure
fsurf(U, [ 0 1 0 1], 'MeshDensity',75)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!