How to change the color of a plane
14 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Star Strider
on 19 Oct 2019
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.
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!