How can I generate this shapes with matlab code?

조회 수: 4 (최근 30일)
SAMUEL AYINDE
SAMUEL AYINDE 2019년 9월 12일
댓글: darova 2019년 9월 12일
Please, I need a code to generate this kind of shapes in Matlab. The two shapes on the left hand side mesh perfectly to that on the right hand side. Thank you so much.
Capture5.JPG
  댓글 수: 1
darova
darova 2019년 9월 12일
What have you tried?
What about
y = linspace(0,50);
x = sin(x);
?

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

답변 (1개)

Walter Roberson
Walter Roberson 2019년 9월 12일
Generate a list of (x, y) values for the center division. Ensure that they are sorted by y coordinate.
Now take one copy of that list, and on the end of it add on the x and y coordinates for the left side box.
Take a second copy of the list, and add a constant offset to the x (the offset will be the distance between the two halves), and on the end of it add on the xy coordinates for the right hand box.
Now you can polyshape() the two list of coordinates, and you can plot() the polyshapes.
To slide them together, adjust the coordinates in the second polyshape to subtract that constant offset from all of the x coordinates.

카테고리

Help CenterFile Exchange에서 Elementary Polygons에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by