How to plot 3d plane of type where one variable is missing like x + y = 0.....

4 views (last 30 days)
x = -2:.05:2;
y = -2:.05:2;
[X,Y] = meshgrid(x,y);
now how do i define Z to relate with X,Y to create plane so i can do surf(X,Y,Z) ?

Accepted Answer

Matt J
Matt J on 18 Jun 2021
Edited: Matt J on 18 Jun 2021
If you mean that you have a plane equation of the form a*x+b*y+0*z=d, then you can use
obj=planarFit.groundtruth([],[a,b,0],d);
obj.showfit
xlabel X, ylabel Y, zlabel Z
  1 Comment
Mesbahose Salekeen
Mesbahose Salekeen on 18 Jun 2021
i figured an easy way now
t = linspace(-1,1,50);
x = t;
z = linspace(-5,5,50);
[X,Z] = meshgrid(x,z);
Y = X;
surf(X,Y,Z)
this will create planer surface of x - y = 0

Sign in to comment.

More Answers (0)

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!