How can I plot this function
1 回表示 (過去 30 日間)
古いコメントを表示
I want to plot this function in the interval ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/242998/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/242998/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/242999/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/243000/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/243001/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/243002/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/243008/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/243004/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/243005/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/243006/image.png)
Thank you
1 件のコメント
Sulaymon Eshkabilov
2019 年 10 月 16 日
Could you please show here what you've done so far?
General points: you'd need to employ logical indexing or [for .. end] or [while .. end] loop interation operators.
Good luck.
採用された回答
Fabio Freschi
2019 年 10 月 16 日
編集済み: Fabio Freschi
2019 年 10 月 16 日
You may use surf
% define a suitable number of x and y divisions. Here I used 200
x = linspace(0,10,200);
y = linspace(1,30,200);
% crate regular grid (xx and yy are 2d matrices)
[xx,yy] = meshgrid(x,y);
% you can also put your z function with if-else in a separate m-file
>> fun = @(x,y)(exp(-x.^2)+cos(pi*x))+(x>5).*log(y);
% evaluate your function
zz = fun(xx,yy);
% use surf to plot
figure,surf(xx,yy,zz)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graphics Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!