Main Content

pdearcl

Represent arc lengths as parametrized curve

Description

pp = pdearcl(p,xy,s,s0,s1) returns parameter values for a parametrized curve corresponding to a given set of arc length values.

The arc length values s,s0, and s1 can be an affine transformation of the arc length.

example

Examples

collapse all

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

Figure contains an axes object. The axes object contains 5 objects of type line, text.

Input Arguments

collapse all

Parameter values corresponding to the points xy on the curve, specified as a monotone row vector.

Data Types: double

Points on the curve, specified as a 2-row matrix. Each column specifies the coordinates of a point on the curve.

Data Types: double

Arc length values, specified as a vector.

Data Types: double

Arc length value for the first point, specified as a real number.

Data Types: double

Arc length value for the last point, specified as a real number.

Data Types: double

Output Arguments

collapse all

Parameter values corresponding to the arc length values s, returned as a vector.

Version History

Introduced before R2006a

See Also