recursion – How to rewrite this part of Mathematica code in Matlab

I have the following part of Mathematica code which contain recursive function and I want to rewrite it in Matlab (really, I don’t have any experience in Mathematica).

Can any one help me to do this?
thank you in advance.

    `Np = IntegerPart(L/(2*Om));
      
       Et = L - Np*2*Om;
        
       $RecursionLimit = 1000;

       dz = 5*10^-9;

       Ns = Round(N(2*Om/dz));

       Nsrem = Round(N(Et/dz));

      Mp(l0_, th_, ph_) := Module({pm, x, exm, smat},

      pm(x_) := Ppm(x, l0, th);

      exm(n_) := MatrixExp(I pm(h*p*(n + 0.5)*dz - ph)*dz);

      smat(0) = IdentityMatrix(4);

      smat(n_) := exm(n - 1).smat(n - 1);

      smat(Nsrem).MatrixPower(smat(Ns), Np))

      Mm(l0nm_, thdeg_, phdeg_) := Bm(p*L).Mp(l0*10^-9, thdeg*dtr, phdeg*dtr)`