1

下面是参数为 e 的微分方程参数系统的数学代码。我想为不同的 e 值找到 Re[g[[1]] .....但是在 Matlab 中没有类似 table 的语法。

  m = 3.5;
     pot[x_] := -(I*x)^m;
     d = 9;
     zaf = Table[
     sol1 = 
          NDSolve[{sy''[x] + sy[x]*(e - (pot[x])) == 0, sy[0] == 1, 
            sy'[0] == 0},
           {sy}, {x, 0, d}];
         u1 = sy[d] /. sol1; pu1 = sy'[d] /. sol1;
         sol2 = 
          NDSolve[{fy''[x] + fy[x]*(e - (pot[x])) == 0, fy[0] == 0, 
            fy'[0] == 1},
           {fy}, {x, 0, d}];
         v1 = fy[d] /. sol2; pv1 = fy'[d] /. sol2;
         sol3 = 
          NDSolve[{ty''[x] + ty[x]*(e - (pot[x])) == 0, ty[0] == 1, 
            ty'[0] == 0},
           {ty}, {x, 0, -d}];
         u2 = ty[-d] /. sol3; pu2 = ty'[-d] /. sol3;
         sol4 = 
          NDSolve[{zy''[x] + zy[x]*(e - (pot[x])) == 0, zy[0] == 0, 
            zy'[0] == 1},
           {zy}, {x, 0, -d}];
         v2 = zy[-d] /. sol4; pv2 = zy'[-d] /. sol4;
         f = v1/u1 - v2/u2;
         g = v1*u2 - v2*u1;
         {e, Re[g[[1]]]}, {e, 0.8, 30, .01}]
4

0 回答 0