Matlab 3D Plot Multiple surfaces

3 views (last 30 days)
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.

Accepted Answer

Star Strider
Star Strider on 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')

More Answers (0)

Community Treasure Hunt

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

Start Hunting!