%% Using ToMatlab, transferring mathematical expressions from Mathematica to MATLAB
clc; close all; clear

% Parameters
zeta = 1;
kappa3 = 0.2;
gamma1 = 5;
alpha3 = 2;

sig = linspace(-6,4,2e3).';

% Copied from Mathematica
a01 = (-1).*(2/3).^(1/2).*((-1).*(alpha3.^2+kappa3.^2).^(-1).*(2.* ...
  alpha3.*sig+4.*kappa3.*zeta+(kappa3.^2.*(gamma1.^2+(-4).*sig.^2)+ ...
  16.*alpha3.*kappa3.*sig.*zeta+alpha3.^2.*(gamma1.^2+(-16).* ...
  zeta.^2)).^(1/2))).^(1/2);
a02 = (2/3).^(1/2).*((-1).*(alpha3.^2+kappa3.^2).^(-1).*(2.*alpha3.*sig+ ...
  4.*kappa3.*zeta+(kappa3.^2.*(gamma1.^2+(-4).*sig.^2)+16.*alpha3.* ...
  kappa3.*sig.*zeta+alpha3.^2.*(gamma1.^2+(-16).*zeta.^2)).^(1/2))) ...
  .^(1/2);
a03 = (-1).*(2/3).^(1/2).*((alpha3.^2+kappa3.^2).^(-1).*((-2).*alpha3.* ...
  sig+(-4).*kappa3.*zeta+(kappa3.^2.*(gamma1.^2+(-4).*sig.^2)+16.* ...
  alpha3.*kappa3.*sig.*zeta+alpha3.^2.*(gamma1.^2+(-16).*zeta.^2)) ...
  .^(1/2))).^(1/2);
a04 = (2/3).^(1/2).*((alpha3.^2+kappa3.^2).^(-1).*((-2).*alpha3.*sig+( ...
  -4).*kappa3.*zeta+(kappa3.^2.*(gamma1.^2+(-4).*sig.^2)+16.* ...
  alpha3.*kappa3.*sig.*zeta+alpha3.^2.*(gamma1.^2+(-16).*zeta.^2)) ...
  .^(1/2))).^(1/2);

% Analyze the data - Ignor complex values
a01(abs(imag(a01))>eps) = nan;
a02(abs(imag(a02))>eps) = nan;
a03(abs(imag(a03))>eps) = nan;
a04(abs(imag(a04))>eps) = nan;
% Plot
figure(1);
plot(sig,[a01 a02 a03 a04],'linewidth',2)
    xlabel('$\sigma$','interpreter','Latex')
    ylabel('$a_0$','interpreter','Latex')
    hl = legend('$a_{01}$','$a_{02}$','$a_{03}$','$a_{04}$');
    set(hl,'interpreter','Latex')
    set(gca,'fontsize',11)
    set(gcf,'color','w','units','centimeters','outerposition',[5 5 15 10])