How do i plot a 3D structure as in the attached picture?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ni2
el 16 de Oct. de 2019
Comentada: Ni2
el 17 de Oct. de 2019
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 comentarios
Fabio Freschi
el 16 de Oct. de 2019
Is there a specific criterion for the position of vertical legs?
A curiosity: is it a grounding system for an electrical installation?
Respuesta aceptada
Fabio Freschi
el 16 de Oct. de 2019
Editada: Fabio Freschi
el 17 de Oct. de 2019
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 comentarios
Fabio Freschi
el 17 de Oct. de 2019
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
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!