9 node mesh generation

15 ビュー (過去 30 日間)
Lokesh Mangal
Lokesh Mangal 2020 年 1 月 9 日
回答済み: Sai Sri Pathuri 2020 年 1 月 13 日
how we can convert the dotted figure in to another figure shown below? To get 9 node mesh.
%% code to get dooted figure
clc ; clear;
% Dimensions of the plate
L = 1 ; % Length of the Plate along X-axes
B = 1 ; % Breadth of the Plate along Y-axes
% Number of Elements required
Nx = 4 ; % Number of Elements along X-axes
Ny = 4 ; % Number of Elements along Y-axes
%----------------------------------------
nel = Nx*Ny ; % Total Number of Elements in the Mesh
nnel = 9 ; % Number of nodes per Element
% Number of points on the Length and Breadth
npx = 2*Nx+1 ;
npy = 2*Ny+1 ;
nnode = npx*npy ;
nx = linspace(0,L,npx) ;
ny = linspace(0,B,npy) ;
[xx yy] = meshgrid(nx,ny) ;
% To get the Nodal Connectivity Matrix
coordinates = [xx(:) yy(:)] ;
plot(xx,yy,'b.','MarkerSize',10)
xx(:,[2 4 6 8]) = [];
yy([2 4 6 8],:)=[];
coordinates1 =[xx(:) yy(:)] ;
x = coordinates1(:,1);
y = coordinates1(:,2);
hold on
plot (x,y,'r*')

採用された回答

Sai Sri Pathuri
Sai Sri Pathuri 2020 年 1 月 13 日
The line function can be used to draw the lines between the dots.
for i = 0.25 : 0.25 : 0.75
line([i i],[0 1],'LineStyle','-','Color','black') % To draw vertical lines
line([0,1],[i i],'LineStyle','-','Color','black') % To draw horizontal lines
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by