MATLAB Answers

How to do it?

조회 수: 1(최근 30일)
Gemalyn Apostol
Gemalyn Apostol 25 Oct 2016
답변: xiexiezaijian 25 Oct 2016
How to plot thesurface f=(x1-3)2+(x2-3)2 and add the boundary surface g=10(x1+x2≥4)? Thanks

  댓글 수: 0

로그인 to comment.

답변(1개)

xiexiezaijian
xiexiezaijian 25 Oct 2016
I see, if no boundary, it will be easy with the help of built-in functions:
1. [x,y] = meshgrid(input arguments)% get the mesh grid point
2. z = (x-3).^2 + (y-3).^2;%calculate the z value
3. surface(x,y,z);% plot the surface
4. shading interp% make the surface more pretty
I get quite confused about your boundary condition: g = 10(x1+x2≥4); maybe you should set z value at these points to NaN, and continue with surface(x,y,z); shading interp
z(points out the boundary) = nan;

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by