MATLAB Answers

Translated by

このページのコンテンツは英語から自動翻訳されています。自動翻訳をオフにする場合は「<a class="turn_off_mt" href="#">ここ</a>」をクリックしてください。

0

I want to mesh a square element with a circular hole in the middle

Rawaha Nakhuda さんによって質問されました 2019 年 3 月 24 日
最新アクティビティ Rawaha Nakhuda さんによって 編集されました 2019 年 3 月 25 日
I want to discretize a unit square with a circulae hole in the middle, something similar to the picture below:
I'm having problems using the mesh function to actually create something like this. The mesh I need to create should be changable, like large meshes or small meshes for different results. Any help in creating this structure for my code would be greatly appreciated!
Capture.JPG

  0 件のコメント

サインイン to comment.

製品


リリース

R2018b

1 件の回答

回答者: John D'Errico
2019 年 3 月 24 日
編集済み: John D'Errico
2019 年 3 月 24 日

Use polar coordinates.
Surely you know the equation of a circle in polar coordinates.
r = r0
What is the equation of a unit square in polar form? I think this trick may be less commonly known.
r = min(1/abs(sin(theta)), 1/abs(cos(theta)))
Scale it up for a non-unit square. So just take a linear combination of the two, at any value for theta. That will give you your mesh. Do I need to write it out?
theta = linspace(0,2*pi,17);
u = linspace(0,1,5)';
r0 = 0.5;
R = r0.*u + (1-u).*min(1./abs(sin(theta)), 1./abs(cos(theta)));
X = R.*cos(theta);
Y = R.*sin(theta);
plot(X,Y,'k-',X',Y','k-')
axis([-1.2,1.2,-1.2,1.2])
untitled.jpg
And, yes, the above code will require at least R2016b to run properly. Still fixable using an older release via bsxfun, but much cleaner this way.
(My use of plot to create the meshed grid there was kind of cute, I think.)

  1 件のコメント

Thanks for the help, I just have a question,
All the small meshes in the figure represent truss elements and I wish to use each of them seperately. I have found a way to generate a list of the coordinates in a nx2 matrix. But I also wish to create an element list where each small line is represented by the adjoining coordinates. For example, I have a point in the middle which is the first row of my nx2 matrix, so it is given number 1, and the rest of the coordinates are given subsequent numbers. I wish to show each line as an element list and which numbered coordinates is it connected with. I hope it's not too confusing and you can help me in this regard.
Thank you so much for the help though, really appreciate it!

サインイン to comment.



Translated by