Need help coding this

조회 수: 3 (최근 30일)
Omar
Omar 2023년 1월 26일
다시 열림: John D'Errico 2023년 1월 26일
I’m needing to create a contour plot and a surface plot of the function f(x)=((x_2-x_1)^4)+(8(x_1)(x_2))-x_1+x_2+3, where -1<=x_1,x_2<=1. I am sure that this is a very basic question but I am new to Matlab and cannot seem to be understand it now. Can someone please help??
  댓글 수: 1
John D'Errico
John D'Errico 2023년 1월 26일
Did you try fcontour? Why not? Did you try using meshgrid? Why not? Yes, you might say that you don't know how to use those tools. But that just means you need to spend the time to learn enough of MATLAB to even make some effort there. So start with doing the MATLAB Onramp tutorial. Spend some time learning the basics. Then spend some time making an effort. Try to solve the problem. If you then get stuck, show what you tried, and you might get some help.

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

답변 (1개)

Walter Roberson
Walter Roberson 2023년 1월 26일
Example.
fun = @(x, y) (x + y).^3 - 5*(x.*y) - 1;
[X, Y] = meshgrid( linspace(0,2));
z = fun(X, Y);
contour(X, Y, z);

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by