Hi all. Today I came across a function f(X,Y) = cos(2*pi*X)(1+3Y) + ((2*pi*y)^2)/2.
I thought this was a 3d function but apparently it's not. How do i plot this 2D function in MATLAB.
Is there a special function for handling potential functions in MATLAB? thank you very much

 採用された回答

Stephan
Stephan 2019 年 2 月 27 日
編集済み: Stephan 2019 年 2 月 27 日

0 投票

f = @(X,Y) cos(2*pi.*X).*(1+3.*Y) + ((2*pi.*Y).^2)/2
fsurf(f)
func_sirf.PNG

3 件のコメント

MatlabEnthusiast
MatlabEnthusiast 2019 年 2 月 27 日
編集済み: MatlabEnthusiast 2019 年 2 月 27 日
so it indeed is 3d, right? does that mean the script had an error when it said 2d plot of the potential function?
thanks for the answer btw
Stephan
Stephan 2019 年 2 月 27 日
編集済み: Stephan 2019 年 2 月 27 日
Yes, you have independent 2 input variables and a resulting value which is usually shown in the 3rd dimension. But of course you also can show this in 2D by using:
fcontour(f)
This results in:
If this answer was helpful, please accept it.
MatlabEnthusiast
MatlabEnthusiast 2019 年 2 月 27 日
yes. this is very helpful

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で 2-D and 3-D Plots についてさらに検索

製品

リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by