Problem with adjusting axis limits in surface plot
12 ビュー (過去 30 日間)
古いコメントを表示
Here's the code. I want to show only X values between 0 and 1. Y values between 0.001 and 1000, and adjust the Z automatically.
YS = @(X,Y) (0.38*X^2-0.31*X-0.02)*log(Y)+2.7287*sin(1.1732*X+1.1613);
%the coefficients are not constant numbers, this is just an example.
fsurf(Z);
xlim ([0 1]);
ylim ([0.001 1000]);
When I first plot the surface, this is how it looks like:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/991505/image.png)
After I double click on the plot, it adjusts the Z automatically to this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/991510/image.png)
How do you get the second/correct view without interacting with the plot?
0 件のコメント
採用された回答
KSSV
2022 年 5 月 9 日
Use zlim as well.
zlim([-3 3])
3 件のコメント
KSSV
2022 年 5 月 9 日
I would rather prefer:
x = linspace(0,1) ;
y = linspace(0,1000) ;
[X,Y] = meshgrid(x,y) ;
Z = (0.38*X.^2-0.31*X-0.02).*log(Y)+2.7287*sin(1.1732*X+1.1613);
%the coefficients are not constant numbers, this is just an example.
surf(X,Y,Z);
その他の回答 (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!