Creating plans and 3D shapes with x,y,z coordinates.

4 ビュー (過去 30 日間)
Raphael Krier
Raphael Krier 2021 年 3 月 8 日
コメント済み: KALYAN ACHARJYA 2021 年 3 月 10 日
Hi everyone,
I am trying to generate different 3D shapes with matlab. The idea is to represent a coral reef (picture attached). I could like the edge of the reef to have a concave shape. To get this shape I am using the elipse equation:
t = linspace(0,pi);
xe = 4 + 4*cos(t);
yconv = 5 + 5*sin(t);
plot(yconv,xe)
axis equal
I am trying to think of a way to do it but I am not sure how to start it.
Any ideas would be great. Thanks a lot
Raphael

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 3 月 9 日
There may be subjective related toolboox/CAD tool to design such surfaces. You may try with surf plot, here on eexample. Here you have to find the values ​​of the z-direction array elements, such that it reflects the same plot.
a=1:10;
b=1:10;
c=[ones(4,10);1.5*ones(2,10);2*ones(4,10)];
% Add step in c data
surf(a,b,c);
grid on;
  2 件のコメント
Raphael Krier
Raphael Krier 2021 年 3 月 10 日
Hi Kalyan,
Thanks for your reply.
I managed to create the bathymetry I wanted. I first created a vector containing the y coordinates (dy=1m). I generated a vector containing the desired x coordinate (distance of each contour from the x0 origine for a given y). So for each contour I have two vectors y and corresponding x coordinates with dy=1m.
Then I used trigonometry to obtain z coodinates of each contour line for a given y (because I wanted a given gradient for each platform).
Finaly I used interp1 to interpolate the cross section on a dx=1m interval. Using a loop I obtained the cross section (x,z) for each y coordinates and stored them in a matrix.
Just out of curiosity, do you have a link to the CAD toolbox?
Thanks again,
Raphael

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by