3D plot surface

조회 수: 9 (최근 30일)
GibonCZ
GibonCZ 2022년 3월 23일
댓글: GibonCZ 2022년 4월 1일
Hello ! I am working on a project that uses ultrasonic sensors to map objects in a room. The module is traveling in a straight line in the middle of a rooom at different altitudes and picking up objects closest to it . I am recording the date in vectors x(module movement) , y(sensor measurements) and z the module altitude. The picture shown illustrates a large object at 40cm floor level and another above it at 100cm between the module flight path and the wall.
I have used plot3 to create this 3d plot and its working fine although the quality will be improved . Is there any way to create a surface over all the points that would have been seen if loooking from the x axis ? I am trying to actually show the objects without the points. I have tried using mesh and other methods found on the matlab help pages but with no luck.
Any help would be much appriated :)

답변 (1개)

Sam Chak
Sam Chak 2022년 3월 23일
The best is the provide a small sample of the spatial data for testing. Otherwise, the function surf can be used to create a surface plot. See the following example:
[x, y] = meshgrid(-pi:0.15:pi, -pi:0.15:pi);
z = (tanh(x - 1) + tanh(x + 1))/2 + ((tanh(x - 1) - tanh(x + 1))/2).*sign(y);
surf(x, y, z)
  댓글 수: 1
GibonCZ
GibonCZ 2022년 4월 1일
Thank you Sam for getting back to me ! I am attaching the sample vectors that I am working with ( x,y,z) this is a small scan area of approximatly 1 m width and 40 cm height with two objects (boxes) in the view. All zero values were replaced with NaN with x(x==0) = NaN command.
Figure explanation - the scanning was performed at 3 differents heights with the first points at +- 120 being the wall , second at 60 being the first object and then 3rd object following at the right side of the plot.
I have tried surf function Z = meshgrid(z) , surf (x,y,Z) and this is what Im getting
Its getting closer but not quite there :) I would like for all the points to be joined together, creating a surface that can be seen from the x axis (0-100axis) so the objects can resemble the original ones. Also for some reason the points were duplicated and more were added to the graph , possibly because of the meshgrid. Any ideas for improvements ?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by