create a three-dimensional surface plot
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hidd_1
am 18 Dez. 2020
Beantwortet: Star Strider
am 18 Dez. 2020
Hello everybody!
I want to create a three-dimensional surface plot using the function surf, but unfortanatley there is a bug in my code which i coudn't solve or understand.
I would be greatful for any help!
Here is the code:
creates a three-dimensional surface plot:
[x,y] = meshgrid(1:0.5:10,1:20);
z = ((x^2)/(1+(x^2))) + y^2;
xlabel(x)
ylabel(y)
zlabel(z)
surf(x,y,z)
the function is the following ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/465050/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/465050/image.png)
Thnak you very much in advance!
Best regards,
0 Kommentare
Akzeptierte Antwort
Star Strider
am 18 Dez. 2020
Use element-wise operations for exponentiation (.^) and division (./):
z = ((x.^2)./(1+(x.^2))) + y.^2;
Then, it works.
0 Kommentare
Weitere Antworten (0)
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!