Multiple reference planes defining color in a 3D SURF plot?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello MATLAB experts!
I have a problem getting the colors right when plotting the buckling deformations of a rectangular beam with the SURF command.
I would like the colors on each side of the beam to be defined for the actual side, meaning that the deformation for each side is shown (by color) relative to the side itself.
At the moment the color of the beam is gradually going from blue to red defined by the z-distance from coordinate (0,0,0). So the bottom side of the beam, which lies in -500 relative to the xy-plane is dark blue, and the top (+500 relative to the xy-plane) is dark red – the sides (-500, +500 relative to the xz-plane) are colored like rainbows.
I want to see the individual deformation of each side relative to the undeformed side. Top and bottom side deforms in the z-direction, and the sides deform in the y-direction.
I think that I need to do something with the C in the command SURF(X,Y,Z,C), but I can’t seem to figure it out. I have the deformation data of each side relative to the undeformed side. I am plotting one side at a time, but in the same figure using 'hold on'.
Help would be very much appreciated! Thank you in advance.
Kind regards Dennis Thøgersen, Denmark
0 Commenti
Risposte (1)
Patrick Kalita
il 8 Lug 2011
I think you are on the right track with using the C input to surf(X, Y, Z, C). C should be an array that is the same size as X, Y, and Z, and it will control the color of each quadrilateral piece of the surface.
I don't know if I completely understand all the details of what you're doing, but I think you want something like this:
% surface aligned with xy-plane
[x1,y1] = meshgrid(0 : 0.1 : 1);
z1 = 1 + 0.01*randn(11);
% surface aligned with xz-plane
[x2,z2] = meshgrid(0 : 0.1 : 1);
y2 = 1 + 0.01*randn(11);
% draw surface
surf(x1, y1, z1, z1) % color is controlled by variations in z (the default)
hold on
surf(x2, y2, z2, y2) % color is controlled by variations in y
0 Commenti
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!