フィルターのクリア

I have a problem with surface parameters (fsurf)

3 ビュー (過去 30 日間)
Jake Simmonds
Jake Simmonds 2018 年 10 月 30 日
コメント済み: madhan ravi 2018 年 10 月 30 日
Hello there, this is my first time using this site for help so if i don't get the etiquette right please do let me know. OK so i am trying to plot the following surface f(x,y)= (3*x^2+y^2)*exp(-x-y) with intervals -2 < x < 2 and -2 < y < 2 i have produced the following code:
syms x y
f(x,y) = (3*x^2+y^2)*exp(-y-x);
fsurf(f,[-2 2 -2 2])
However the results are terrible i have tried changing the parameters and tried using a mesh but i get nowhere. Now i have been using a tool online called Calcplot3D see here https://www.monroecc.edu/faculty/paulseeburger/calcnsf/CalcPlot3D/ this tool displays the function how i would expect it to look, i don't understand why i can't replicate this in matlab.
Any help would be brilliant Best Regards Jake

採用された回答

madhan ravi
madhan ravi 2018 年 10 月 30 日
編集済み: madhan ravi 2018 年 10 月 30 日
syms x y %edited
f(x,y) = (3*x^2+y^2)*exp(-y-x);
ezsurf(f)
xlim([-2 2])
ylim([-2 2])
zlim([-5 5])
  13 件のコメント
Jake Simmonds
Jake Simmonds 2018 年 10 月 30 日
Ah ok, it's still not as nice though is it as the plot above? it's an improvement though so thanks. I think i will stick to that web-tool though.
madhan ravi
madhan ravi 2018 年 10 月 30 日
If you get used to Matlab you may find it easy to manipulate anyways glad that you got the answer for your question , make sure to accept the answer so that people know that question is solved

サインインしてコメントする。

その他の回答 (1 件)

Matt J
Matt J 2018 年 10 月 30 日
編集済み: Matt J 2018 年 10 月 30 日
f = @(x,y) (3*x.^2+y.^2).*exp(-y-x);
fsurf(f,[-2 2 -2 2])
  2 件のコメント
Jake Simmonds
Jake Simmonds 2018 年 10 月 30 日
Should it not have the dot before *exp ? like so: f = @(x,y) (3*x.^2+y.^2).*exp(-y-x); Also this still does not replicate the function as it should be!!!
Matt J
Matt J 2018 年 10 月 30 日
Yes, I have added .*

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by