How to plot a 3D wire frame from a given set of nodes?
12 ビュー (過去 30 日間)
古いコメントを表示
How would I go about plotting something like a rectangular or pyramid “wire” frame in matlab? I found this link for a 3D truss analysis, but it has a lot of extra stuff and I don’t quite understand everything that is happening.
For example, let’s say I want to make a simple rectangular frame made of solid tubes. If I have one point at the origin (0,0,0) and another point at (5,0,0). How could I plot a member between these two points and then specify a thickness? From here, how could I continue to connect members until my rectangular frame is built? I don’t want to continue building from where the last member built, but rather specify all given nodes beforehand, select where/how many members exist between each node and then plot with a given thickness.
I’m just trying to make 3D wire frame structures in MATLAB, no analysis needed. I can do it in SolidWorks, but haven’t found a video on this on the MathWorks website yet.
So far from what I understand I have to specify my points in space as matrices, but then from here I got lost in that huge code.
Thanks in advance and any insight would be helpful.
0 件のコメント
回答 (1 件)
Walter Roberson
2021 年 12 月 11 日
[cX, cY, cZ] = cylinder(); %radius 1, points up z
fig = figure();
ax = axes('Parent', fig);
tf(1) = hgtransform(ax);
tf(1).Matrix = makehgtform('scale', [5 1 1], 'yrotate', pi/2);
s(1) = surf(cX, cY, cZ, 'Parent', tf(1));
view(3)
axis equal
xlabel('x'); ylabel('y'); zlabel('z')
2 件のコメント
Walter Roberson
2021 年 12 月 11 日
[cX, cY, cZ] = cylinder(); %radius 1, points up z
fig = figure();
ax = axes('Parent', fig);
tf(1) = hgtransform(ax);
tf(1).Matrix = makehgtform('scale', [5 0.05 0.05], 'yrotate', pi/2);
s(1) = surf(cX, cY, cZ, 'Parent', tf(1));
view(3)
axis equal
xlabel('x'); ylabel('y'); zlabel('z')
... Tube, like you requested.
If what you needed was a line then you could plot3()
For 3D surfaces, you would use surf() like I used here, or you would use patch() -- or sometimes you would use warp()
It is not difficult to create simple 3D meshes and create vertices and faces, and pass those to patch() . But curved segments like a tube get tedious to define by hand, so you would generally create functions to generate the appropriate parts.
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

