how will i get a mesh in 2d region

7 ビュー (過去 30 日間)
ekrem yilmaz
ekrem yilmaz 2019 年 12 月 30 日
コメント済み: Aman Jaiswal 2020 年 9 月 21 日
Hi community,
I need to create a mesh data like in this image, mesh will be cartesian mesh in rectangular part and polar mesh in circular part, how can i do it in matlab?
Any help will be appreciated, thanks.
  2 件のコメント
darova
darova 2020 年 1 月 1 日
Did you try create circular and rectangular part in cartesian system? And then just concantenate matrices?
What have you tried?
ekrem yilmaz
ekrem yilmaz 2020 年 1 月 1 日
Hi darova,
I tried to create a coeff. matrix but i couldn't get it since i m new to matlab
As you said, i need to concatenate rectangular grid's coeff. matrix and circular grid's coeff. matrix to get whole system's coeff. matrix so i think i can solve my problem (it is a heat conduction problem).

サインインしてコメントする。

回答 (1 件)

darova
darova 2020 年 1 月 2 日
I tried to simplify the task (plain rectangle instead of ellipse(cylinder))
Here is what i got
clc,clear
data = load('simple.txt.');
x = data(:,1);
y = data(:,2);
z = data(:,3);
dx = diff(x);
dy = diff(y);
dL = hypot(dx,dy);
[X,Y] = meshgrid([-1 1]);
cla
plot3(x,y,z,'-')
axis equal
hold on
for i = 1:length(x)-1 -4000 % too much rectangles
X1 = X/2; % rectangle width is 1
Y1 = Y*dL(i)/2; % rectangle height is dL
% rotation matrix
R = [dx(i) -dy(i); dy(i) dx(i)]/dL(i);
V = R*[Y1(:) X1(:)]';
X1 = reshape(V(1,:),[2 2])+x(i)+dx(i)/2;
Y1 = reshape(V(2,:),[2 2])+y(i)+dy(i)/2;
Z = [z(i) z(i); z(i+1) z(i+1)];
surf(X1,Y1,Z)
% pause(0.5)
end
hold off
  1 件のコメント
Aman Jaiswal
Aman Jaiswal 2020 年 9 月 21 日
what is simple.txt has in it? can you upload it here.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by