So here's a working version of the alternative solution, in case someone else has a similar query. We've still not quite mastered the problem, but we're getting feasible solutions in most of the regions.
If there are any other solutions to this I'd love to hear them.
Thanks again for your help!
DV = 1.9102*xp^2-274.3428*rho*xp^2+3.5527e-14*rho*xp+0.7161*xp^3-244.6211*rho*xp^3-74.3883*rho*xp^4-7.9622*rho*xp^5;
V = 10*xp^2;
d = 3.820474944+1.4322*xp;
delta = 1.0e-6;
% Create some lagrange multipliers
pdeg = 4;
[L, cL, vL] = polynomial(xp, pdeg, 0);
[M, cM, vM] = polynomial(xp, pdeg, 0);
% Set up our constraints
C1 = -DV - L*(1-V);
C2 = d - delta - M*(1-V);
next_rho = 1.0;
this_rho = 10.0;
tol = 1.0e-5;
i = 0;
while (abs(next_rho - this_rho) > tol)
this_rho = next_rho;
i = i+1;
disp(strcat('step ', num2str(i), ', rho=',num2str(this_rho)));
% First step: optimize for Legrange multiplier coefficients
sos1 = sos(replace(C1,rho,this_rho));
sos2 = sos(replace(C2,rho,this_rho));
sos3 = sos(L);
sos4 = sos(M);
coefList = [cL;cM];
consList = [sos1;sos2;sos3;sos4];
[sol, q, Q, res] = solvesos(consList,[], options, coefList);
if (sol.problem ~= 0)
disp(strcat('Error solving for lagrange multiplier coefficients at
[',num2str(x_n),'] "',yalmiperror(sol.problem),'"'));
continue;
end
% Assuming this worked, fix the coefficients and solve for rho
sos1 = sos(replace(C1,cL,value(cL)));
sos2 = sos(replace(C2,cM,value(cM)));
sos3 = sos(replace(L,cL,value(cL)));
sos4 = sos(replace(M,cM,value(cM)));
coefList = rho;
consList = [sos1;sos2;sos3;sos4];
[sol, q, Q, res] = solvesos(consList,[], options, coefList);
if (sol.problem ~= 0)
disp(strcat('Error solving for rho at [',num2str(x_n),'] "',yalmiperror(sol.problem),'"'));
continue;
end
next_rho = value(rho);
end;