function [A, b] = apply_pec_bele(A, b, mesh, phy, pecEdgeIds)
%APPLY_PEC_BELE  散射场 PEC：n×(E_s+E_b)=0 → E_s·e = -(E_b·e)

pecEdgeIds = pecEdgeIds(:);
n = mesh.NbrEdge;

for k = 1:numel(pecEdgeIds)
    id = pecEdgeIds(k);
    v1 = mesh.Edge(id, 1);
    v2 = mesh.Edge(id, 2);
    p1 = mesh.Vertex(v1, :);
    p2 = mesh.Vertex(v2, :);
    edgeVec = (p2 - p1).';
    mid = 0.5 * (p1 + p2);
    Eb = phy.bele.Eb(mid(1), mid(2), mid(3));
    rhs = -dot(Eb, edgeVec);

    A(id, :) = 0;
    A(:, id) = 0;
    A(id, id) = 1;
    b(id) = rhs;
end

end
