Plotting hyperplane created using meshgrid (something simple)

27 vues (au cours des 30 derniers jours)
John G
John G le 13 Juil 2019
Commenté : Star Strider le 13 Juil 2019
Dear all,
I created the following hyperplane:
y = [-20:0];
z = [-30:-5];
x = [-50:50];
[xx,yy,zz] = meshgrid(x,y,z);
When I try to plot it using surf(xx,yy,zz) I get an error "Value must be a vector or 2D array of numeric type".
How do I solve this?
Thank you a lot!

Réponse acceptée

Star Strider
Star Strider le 13 Juil 2019
I am not certain what you want to do.
One approach:
N = 25;
y = linspace(-20,0,N);
x = linspace(-50,50,N);
z = linspace(-30,-5,N);
B = [x(:) y(:) ones(N,1)] \ z(:);
[xx,yy] = meshgrid(x,y);
zz = B(1)*xx + B(2)*yy + B(3)*ones(size(xx));
figure
surf(xx, yy, zz)
grid on
You could also use the isosurface function, however it is not obvious to me what you would use as the ‘isovalue’.
  2 commentaires
John G
John G le 13 Juil 2019
Excellent, thanks a lot!
Star Strider
Star Strider le 13 Juil 2019
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by