MATLAB: How to plot a 3d ship with random intensity values

plot a 3d ship with random intensity values

close all;
clc;
x=[0 50 50 0 0 0 50 50 50 50 50 50 0 0 0 -20 0 0 -20 0 0 15 35 35 15 15 15 35 35 35 35 35 35 15 15 15 15 20 30 30 20 20 20 30 30 30 30 30 30 20 20 20 20];
y=[0 0 5 5 0 -2.5 -2.5 0 -2.5 7.5 5 7.5 7.5 5 7.5 2.5 -2.5 0 2.5 5 7.5 7.5 7.5 -2.5 -2.5 7.5 7.5 7.5 7.5 7.5 -2.5 -2.5 -2.5 -2.5 -2.5 -2.5 7.5 7.5 7.5 -2.5 -2.5 7.5 7.5 7.5 7.5 7.5 -2.5 -2.5 -2.5 -2.5 -2.5 -2.5 7.5];
z=[0 0 0 0 0 5 5 0 5 5 0 5 5 0 5 5 5 0 5 0 5 5 5 5 5 5 10 10 5 10 10 5 10 10 5 10 10 10 10 10 10 10 15 15 10 15 15 10 15 15 10 15 15];
plot3(x,y,z);
This is the program i wrote for plotting a 3d ship. I need to generate random values of intensities for all the 25 coordinates and need to plot the ship with corresponding intensities…………someone please help me out. hope somebody will respond soon…….thank u

Best Answer

hi,
That is great work, however i tried here a different approach
% The length is 53 i incremented each vec with 1 to get 9x6 matrices
x(end+1)=x(end);
y(end+1)=y(end);
z(end+1)=z(end);
% figure, plot3(x,y,z)
X=reshape(x,6,9);
Y=reshape(y,6,9);
Z=reshape(z,6,9);
surf(X,Y,Z)
shading interp
Is that ok?