Clear Filters
Clear Filters

Geometry function - domain sketch

3 views (last 30 days)
Sarinthree Udchachone
Sarinthree Udchachone on 21 Mar 2020
Commented: darova on 22 Mar 2020
Hi, I am trying to sketch the domain for PDE solver. It is similar to the example function CIRCLEFUNCTION.m.
My domain has four edges. Left and right edges are parallel to the y-axis. Top and bottom edges are curves:
I have following so far:
________________________
function [x,y]= dom(bs,s)
if nargin = = 0
x=4;
end
if nargin = = 1
A=[ 0, 1, 1, 0 ;
1, 1, 0 , 0 ;
1, 1, 1, 1 ;
0, 0, 0, 0]
I don't know where to go from there. I read examples online, but they are complicated.
You could choose curves connecting top vertices and bottom vertices to be simple quadratic curves, vertices are (0,0), (1,0), (1,1), (0,1).
Thank you!
Sandy

Accepted Answer

darova
darova on 21 Mar 2020
Try pdepoly
x = 0:0.1:1;
y = x.^2-x+1;
x = [0 x 1];
y = [0 y 0];
pdepoly(x,y)
  9 Comments
darova
darova on 22 Mar 2020
What about this?
x= 0:0.1:1;
y= x.^2-x+1;
x=[0 x 1];
y=[0 y 0];
pdepoly(x,y);
pdetool('initmesh')
% pdetool('refine')
darova
darova on 22 Mar 2020
Maybe it would be helpful
x= 0:0.1:1;
y= x.^2-x+1;
x=[0 x 1];
y=[0 y 0];
gd = [2;length(x);x(:);y(:)]; % geometry description matrix
dl = decsg(gd); % decompose matrix
[p,e,t] = initmesh(dl); % create mesh
subplot(121)
pdemesh(p,e,t)
axis equal
subplot(122)
[p1,e1,t1] = refinemesh(dl,p,e,t);
pdemesh(p1,e1,t1)
axis equal

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!