필터 지우기
필터 지우기

how can i make graph i n which first i want function f(x,y) from user by input command but then i HAVE TO PLOT THAT FUNCTION f(x,y) 3D plot.

조회 수: 2 (최근 30일)
how can i make graph i n which first i want function f(x,y) from user by input command but then i HAVE TO PLOT THAT FUNCTION f(x,y) 3D plot. I first convert the function in to inline function using inlne command then i don,t know how to plot 3d graph. because one error always showing conversion from inline to double is not possible
clear
clc
syms x y
a=input('Enter function f(x,y) = ');
b=inline(a);
x=[-2:0.1:2];
y=[-2:0.1:2];
[X,Y]=meshgrid(x,y)
x=X;
y=Y;
z=a;
mesh(z)
  댓글 수: 3

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

채택된 답변

Cris LaPierre
Cris LaPierre 2024년 4월 5일
편집: Cris LaPierre 2024년 4월 5일
I think you are not using inline correctly. You likely need to use the following syntax.
There are many types of 3D plots. Since you haven't specified what type of 3D plot you want, here's an example using surf (surface example taken from here)
F = inline('Y.*sin(X) - X.*cos(Y)','X','Y');
[X,Y] = meshgrid(-5:.5:5);
Z = F(X,Y);
surf(X,Y,Z)
  댓글 수: 2
SYED
SYED 2024년 4월 5일
이동: Torsten 2024년 4월 5일
clear
clc
syms x y
a=input('Enter function f(x,y) = ');
b=inline(a);
x=[-2:0.1:2];
y=[-2:0.1:2];
[X,Y]=meshgrid(x,y)
x=X;
y=Y;
z=a;
mesh(z)

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by