pdearcl
Represent arc lengths as parametrized curve
Description
Examples
Polygonal Approximation
Create a cardioid geometry by using the pdearcl
function with a polygonal approximation to the geometry. The finite element method uses a triangular mesh to approximate the solution to a PDE numerically. You can avoid loss in accuracy by taking a sufficiently fine polygonal approximation to the geometry. The pdearcl
function maps between parametrization and arc length in a form well suited to a geometry function. Write this geometry function for the cardioid:
function [x,y] = cardioid1(bs,s) % CARDIOID1 Geometry file defining the geometry of a cardioid. if nargin == 0 x = 4; % four segments in boundary return end if nargin == 1 dl = [0 pi/2 pi 3*pi/2 pi/2 pi 3*pi/2 2*pi 1 1 1 1 0 0 0 0]; x = dl(:,bs); return end x = zeros(size(s)); y = zeros(size(s)); if numel(bs) == 1 % bs might need scalar expansion bs = bs*ones(size(s)); % expand bs end nth = 400; % fine polygon, 100 segments per quadrant th = linspace(0,2*pi,nth); % parametrization r = 2*(1 + cos(th)); xt = r.*cos(th); % points for interpolation of arc lengths yt = r.*sin(th); % Compute parameters corresponding to the arc length values in s th = pdearcl(th,[xt;yt],s,0,2*pi); % th contains the parameters % Now compute x and y for the parameters th r = 2*(1 + cos(th)); x(:) = r.*cos(th); y(:) = r.*sin(th); end
Plot the geometry function.
pdegplot("cardioid1","EdgeLabels","on") axis equal
Input Arguments
p
— Parameter values corresponding to points on curve
row vector
Parameter values corresponding to the points xy
on the curve,
specified as a monotone row vector.
Data Types: double
xy
— Points on curve
2-row matrix
Points on the curve, specified as a 2-row matrix. Each column specifies the coordinates of a point on the curve.
Data Types: double
s
— Arc length values
vector
Arc length values, specified as a vector.
Data Types: double
s0
— Arc length value for first point
real number
Arc length value for the first point, specified as a real number.
Data Types: double
s1
— Arc length value for last point
real number
Arc length value for the last point, specified as a real number.
Data Types: double
Output Arguments
pp
— Parameter values corresponding to arc length values
vector
Parameter values corresponding to the arc length values s
,
returned as a vector.
Version History
Introduced before R2006a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)