필터 지우기
필터 지우기

Plotting equations in 3D

조회 수: 90 (최근 30일)
Marco Froelich
Marco Froelich 2017년 7월 5일
답변: HARSH MEHTA 2021년 4월 22일
I have the equation:
x^2 + y^2 + z^2 = 1
How do I tell Matlab to plot this in the 3D plane? This is just one equation, but I will need to plot several in the 3D plane.
  댓글 수: 5
Adam
Adam 2017년 7월 5일
I think you would need the Symbolic Toolbox to do this kind of thing. I only glanced at the equation initially and didn't register the '= 1' at the end of it which turns it into something that base Matlab doesn't cater for.
I've never worked with equation solving in Matlab myself so hopefully someone else can provide more information on usage of the Symbolic Toolbox or whatever other functionality is needed for this.
Marco Froelich
Marco Froelich 2017년 7월 5일
No but I am not trying to solve the equation, only plot its graph. But fair enough, thank you

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

채택된 답변

Ari
Ari 2017년 7월 5일
Your equation x^2 + y^2 + z^2 = 1 resembles a surface and can be plotted with the fsurf command in MATLAB which will need your function handle as an argument. You will need to rewrite the function as z expressed in terms of x and y as follows.
z = @(x,y) sqrt(x.^2 + y.^2 - 1); % function handle to anonymous function
fsurf(z)
You can find other methods to do the same from the documentation here .
For information on function handles see here .
For plotting multiple 3D surfaces on the same graph you can use the hold command as below. The hold command will plot subsequent plots in the same figure.
z1 = @(x,y) sqrt(x.^2 + y.^2 - 1);
z2 = @(x,y) sqrt(x.^2 + 2*y.^2 - 5);
fsurf(z1)
hold on
fsurf(z2)
  댓글 수: 3
Marco Froelich
Marco Froelich 2017년 7월 10일
I found it. Input function, with the command fimplicit3
Sakib Mahmud
Sakib Mahmud 2019년 9월 8일
This equation will give half of a sphere. The rest half will come from -sqrt...

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

추가 답변 (1개)

HARSH MEHTA
HARSH MEHTA 2021년 4월 22일
x^2 + y^3 + z^4 = f(x,y,z)
and X^2(y^3)(z^4) = f(x,y,z) how can i polt this both differently

카테고리

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