Remove a "plane" from my 3d plot
Mostra commenti meno recenti
When I plot the surface it results into the surface itself but there is something weird in the middle of the surface, I mean it's kind like it is in the xy plane, I do not know how to remove it, here is my code:
clear
figure, hold on
[x,y]=meshgrid(-50:50)
xlabel ("x");
ylabel ("y");
zlabel ("z")
z=sqrt(9*(y.^2)-9*(x.^2))
w=-sqrt(9*(y.^2)-9*(x.^2))
surf(x,y,real(z))
surf(x,y,real(w))
zlim([-150,150])

3 Commenti
Ravi Narasimhan
il 14 Ott 2021
Modificato: Ravi Narasimhan
il 14 Ott 2021
If x^2 > y^2, won't the real part of your square root be 0?
davidcu
il 14 Ott 2021
Ravi Narasimhan
il 14 Ott 2021
Modificato: Ravi Narasimhan
il 14 Ott 2021
You could perhaps set any value of real(z) or real(w) = 0 to NaN (Not a Number) using the find function. Those items wouldn't display on the surface plot, leaving a space between the top and bottom halves. It would look like
z(find(real(z) == 0)) = NaN;
The find function returns the indices where real(z) == 0 and the z(find(...)) = NaN sets those positions in the z array to NaN
You'd tweak it accordingly for w.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Surface and Mesh Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
