create a three-dimensional surface plot
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Thnak you very much in advance!
Best regards,
댓글 수: 0
채택된 답변
Star Strider
2020년 12월 18일
Use element-wise operations for exponentiation (.^) and division (./):
z = ((x.^2)./(1+(x.^2))) + y.^2;
Then, it works.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
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!