Matlab 3D Plot Multiple surfaces

3 vues (au cours des 30 derniers jours)
Yellow Canary
Yellow Canary le 19 Jan 2015
Commenté : Prachi Arora le 9 Juin 2018
I have two functions that I need to compare on a single figure. I want see which function gives higher results. For example, I want my first function to have blue dots on z-axis, and second function to have red dots on z-axis again. So, I can see both results on the same figure. I calculated the results for both function on Matlab and imported the results excel file. I know how to plot single function but don't have any idea how to plot both on a single figure. How can I do this? For my current figure I use
plot3(Pa,Pb,Profit1)
Also, I tried to use surface (surf) but it didn't work. Maybe surface would be better to see the difference between these two function.
Thank you everyone in advance.

Réponse acceptée

Star Strider
Star Strider le 19 Jan 2015
See if this does what you want:
N = 1000;
x = rand(N,1);
y = rand(N,1);
z1 = 20+0.5*randn(N, 1);
z2 = 10+0.5*randn(N, 1);
figure(1)
scatter3(x, y, z1, '.b')
hold on
scatter3(x, y, z2, '.r')
hold off
grid on
xlabel('x')
ylabel('y')
zlabel('z')
  1 commentaire
Prachi Arora
Prachi Arora le 9 Juin 2018
Thank you so much sir it worked.

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