필터 지우기
필터 지우기

How to plot a 2d potential function

조회 수: 10 (최근 30일)
MatlabEnthusiast
MatlabEnthusiast 2019년 2월 27일
댓글: MatlabEnthusiast 2019년 2월 27일
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일
f = @(X,Y) cos(2*pi.*X).*(1+3.*Y) + ((2*pi.*Y).^2)/2
fsurf(f)
func_sirf.PNG
  댓글 수: 3
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개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by