How to change the color of a plane

16 次查看(过去 30 天)
This is extra credit on our homework. Our instructor wants us to recreate our original plot and add a magenta plane corresponding to the XY plane (Z=0) and plot our points evaluated in the function. I was able to get everything done, except for changing the color of the plane. I have searched on here but I can't seem to find the right wording to get the help I need. Here is the code I have:
figure(4)
mesh(X,Y,Z)
xlabel('x')
ylabel('y')
zlabel('z')
title('MAE 284, Homework 4, Problem 4, Part f')
v = axis;
axis([-2 4 -6 6 -2 2])
hold on
mesh(X,Y,Z0)
for i = 1:length(X_xc) % for loop to plot points
for j = 1:length(Y_xc)
plot3(X_xc(i),Y_xc(j),f(X_xc(i),Y_xc(j)),'*r')
end
end
legend('Function','XY Plane @ Z=0','Evaluated Points','Location','best')
hold off
*mesh(X,Y,Z0) is the plane that I am trying to get the correct color for

回答(1 个)

Star Strider
Star Strider 2019-10-19
How would you define ‘Z0’ as a matrix the size of ‘X’ (or Y’) that is uniformly zero?
(We only give hints to homework problems here.)
See the documentation on surf or mesh to understand how to change the color of the surface faces.

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by