How do i plot a 3D structure as in the attached picture?
1 回表示 (過去 30 日間)
古いコメントを表示
I want to plot a mesh like in the attached picture.
1. Lengths of each sides are specified ( L and W) 2. Number of horizontal and vertical lines are fixed ( m and n) 3. Distance between parallel lines are same (d1 and d2) 4. Perpendicular legs all have same length(H) 5. Perepndicular legs are placed at various intersections depending upon some condition.
3 件のコメント
Fabio Freschi
2019 年 10 月 16 日
Is there a specific criterion for the position of vertical legs?
A curiosity: is it a grounding system for an electrical installation?
採用された回答
Fabio Freschi
2019 年 10 月 16 日
編集済み: Fabio Freschi
2019 年 10 月 17 日
I share with you a couple of function that I use to plot grounding grids. They are attached. Then you can use the following script to plot the grid
clear variables, close all
% setup grid params
lx = 20; % x edge length
ly = 20; % y edge length
lz = 2; % z edge length
nx = 10; % divisions along x
ny = 10; % divisions along y
hz = -2; % z translation
% grid creation
% P: points coordinates (z = 0, translate as needed)
% E: edge connectivity
[P1,E1] = createGrid(lx,ly,nx,ny);
% vertical rods: we can use createGrid but we change the connectivity
[P2,~] = createGrid(lx,ly,nx/2,ny/2); % note that nx/2 and ny/2 are integer
nP2 = size(P2,1);
% we must add points with the same x,y coordinates of P2 and -lz as z
P2 = [P2; P2(:,1:2) -lz*ones(nP2,1)];
% connectivity
E2 = [1:nP2; nP2+1:2*nP2]';
% merge
P = [P1; P2];
E = [E1; E2+size(P1,1)];
% translation
P(:,3) = P(:,3)+hz;
% plot
figure, hold on, axis equal
patch('Faces',E,'Vertices',P,'EdgeColor','k','LineWidth',2);
view([1 1 1])
% transparent frame
Q = [-lx -ly 0; lx -ly 0; lx ly 0; -lx ly 0];
F = [1 2 3 4];
patch('Faces',F,'Vertices',Q,...
'EdgeColor','k','LineWidth',1,'FaceColor','r','FaceAlpha',0.2);
EDIT: I added the grid translation of hz in vertical position
5 件のコメント
Fabio Freschi
2019 年 10 月 17 日
The files I shared can be used only for rectangurale grids. For an L-shaped grid you can add two regtangular grids and remove the coincident nodes/edges
その他の回答 (0 件)
参考
カテゴリ
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!