how to 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

4 个评论

Which variable represent intensities?
I think those must be the (x,y,z) coordinates of the ship and each pixel is "on" at that 3D location. So if you did a surface rendering of the shapes, the sides of the thing would all be one solid color (blue).
@azzi abdelmalek i didn't generated the intensity values till now. In further thing i have to do that. I was confused how to use the random values for those 25 coordinates
You just have 25 points, each with x,y,z co-ordinates, and just create a
points = [x,y,z]; %25 x 3 matrix
intensities = rand(25,1); %25x1 col vector.
Does this answer your question?

请先登录,再进行评论。

 采纳的回答

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?

5 个评论

nope......showing error in the first line itself
<a href=http://soundfrost.org/ >there</a>
no, it worked well, try again.. clear the workspace, use the same var x,y and z and the code above ...
its working but i need only intensity spots just on the coordinates........i think i have to use scatterplot. i ll try it once
<a href=http://soundfrost.org/ >download youtube</a>
Your link is broken. Please edit it to fix it, if you want anyone to look at it. It should show up on color once it's working.
hi, Like "Image Analyst" said, the link returns "Not Found" result....yes it will work with "scatterplot" function..

请先登录,再进行评论。

更多回答(1 个)

Have you tried patch()?

2 个评论

Since i have started using matlab just few days back, i don't know more commands or how to use them. So please help me how to use the command to write the program to plot ship with those coordinates and their corresponding intensities
I never use patch myself. I'd have to figure it out just as you would. Can't you follow examples in the help or search the Answers forum for other ways people have used it.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by