How do i plot a 3D structure as in the attached picture?

3 次查看(过去 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
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?
Ni2
Ni2 2019-10-16
Yes i m trying to do substation grounding design.
1. These legs should only be present in the intersections of the horizontal and vertical lines.
2. Number of legs is predetermined variable.
3. It can either be only in the perimeter or only inside the perimeter depending on some condition.

请先登录,再进行评论。

采纳的回答

Fabio Freschi
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
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 CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by