Surface plot for two variable piecewise function
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I need help plotting the following piecewise function in Matlab as surface plot. Any help is appreciated!!
x1 and x2 are [0,1]
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1517431/image.png)
3 Kommentare
Antworten (1)
Dyuman Joshi
am 21 Okt. 2023
9 Kommentare
Torsten
am 21 Okt. 2023
Bearbeitet: Torsten
am 21 Okt. 2023
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)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!