The Symbolic Math Toolbox is inefficient for this sort of problem.
Try this:
U = 1;
B = 0.1;
H = 0.5;
pfcn = @(a) [2*exp(2*a*(1-H)).*(1 - tanh(a*H)), -6*U*(1 + tanh(a*H)).*exp(2*a*(1 - H)) + 2*U*(1 - tanh(a*H)),(7*U^2 *(1 + tanh(a*H)) - 2*B^2 *tanh(a*H)).*exp(2*a*(1 - H)) - 5*U^2 *(1 - tanh(a*H)), exp(2*a*(1 - H)).*(2*U*B^2 *tanh(a*H) - 4*U^3 *(1 + tanh(a*H))) - (2*U*B^2 *tanh(a*H) - 4*U^3 *(1 + tanh(a*H))), U^2 *(U^2 *(1 + tanh(a*H)) - B^2 *tanh(a*H)).*exp(2*a*(1 - H)) - U^2 *(U^2 *(1 - tanh(a*H)) - B^2 *tanh(a*H))];
a=2.0:-0.02:0.0;
for k1 = 1:numel(a)
p = pfcn(a);
R = roots(p);
C(:,k1) = imag(R);
end
figure
plot(a, C, '.')
grid
figure
meshc(C)
grid on
That should tell you all you need to know about the imaginary roots of your function at each ‘a’ value.
Best Answer