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

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 Comments

Your attached picture is not there. Could you post it?
Is there a specific criterion for the position of vertical legs?
A curiosity: is it a grounding system for an electrical installation?
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.

Sign in to comment.

 Accepted Answer

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 Comments

Ni2
Ni2 on 16 Oct 2019
Edited: Ni2 on 16 Oct 2019
Number of those legs should be specified (N). Should be present 'only in the intersections along perimeter' or 'only in intersections other than perimeter'. However, their position can be random.
I also need to keep this grid below 0 by a height certain height (K) and draw a rectangular frame with a semi-transparent filling on XY plane just above the mesh.
And the matlab file you attached shows some error.
What error do you see? It is running with no errors on my computer
I edited the script to allow the z translation and I added the rectangular frame
i am not sure.
and i wanna plot L-shape grid also whose outer length/width is L1/W1 and inner(missing part) length/width is L2/W2. how would u suggest me to do that.
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
I dont know codes to subtract missing part :(

Sign in to comment.

More Answers (0)

Asked:

Ni2
on 16 Oct 2019

Commented:

Ni2
on 17 Oct 2019

Community Treasure Hunt

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

Start Hunting!