how to plot f(x,y) = x^2/y, y>0

조회 수: 3 (최근 30일)
Jetty Rakesh Aditya
Jetty Rakesh Aditya 2021년 3월 24일
답변: Jan 2021년 3월 24일
how can i plot the above problem in matlab ?

채택된 답변

Alan Stevens
Alan Stevens 2021년 3월 24일
Set the range of values of x and y of interest, then use meshgrid and surf
doc meshgrid
doc surf
  댓글 수: 2
Jetty Rakesh Aditya
Jetty Rakesh Aditya 2021년 3월 24일
i am new to matlab. Can you kindly explain how to do it using mesh grid?
Jan
Jan 2021년 3월 24일
Accepting an answer shows, that the problem is solved. Is it solved already?

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

추가 답변 (2개)

DGM
DGM 2021년 3월 24일
Perhaps an example will suffice.
% plot 2-x^2+y^2 for x=[-1,1], y=[-1,1]
x=linspace(-1,1,10);
y=linspace(-1,1,10);
[X Y]=meshgrid(x,y);
Z=2 - X.^2 + Y.^2;
surf(X,Y,Z)

Jan
Jan 2021년 3월 24일
x = linspace(-10, 10, 100);
y = linspace(0, 10, 100).';
f = x .^ 2 ./ y;
surf(x, y, f)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by