How to make contour plot from this function in MATLAB R2013a?

답변 (1개)

KSSV
KSSV 2018년 4월 9일
f = @(x,y) x.^5 + x.^4- 2*x.^2.*y + y.^2 ;
N = 100 ;
x = linspace(0,1,N) ;
y = linspace(0,1,N) ;
[X,Y] = meshgrid(x,y) ;
Z = f(X,Y) ;
contour(X,Y,Z,100)

댓글 수: 5

Where do you get the value of N? And also the 0,1 on the right side of x and y.
To get the function solved, you need to have x,y values. (0,1) is the range of x and y I gave. N = 100, it divides (0,1) interval into 100 points. Read about linspace.
I see, thank you very much. But, there is an error "unexpected matlab operator", do you know how to fix it?
Where is the error? The given code works fine. Show us the code, if you have made any changes.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by