0
$\begingroup$
cf = 200000000;
α = .7;
r = 0.4;
g0 = 1;
g1[t_] := g0 Sin[t/τ];
g2[t_] := -g0 Cos[t/τ];
γc1 = 000 Pi;
γc2 = 000 Pi;
γf = 44000 Pi;
τ = 1;
ξi = {{Re[α]}, {Im[α]}};
ai = {{E^(-2 r), 0}, {0, E^(2 r)}};
hassan = Table[{L, FSR = Pi (cf/L);
   γ1 = (2 γf g1[t]^2)/FSR;
   γ2 = (2 γf g2[t]^2)/FSR;
   γ12 = (2 γf g1[t] g2[t])/FSR;
   sol1 = 
    NDSolve[{m1'[t] == (-γc1 + γ1/2) m1[t] - 
        g1[t] f0[t] - γ12/2 m2[t], 
      f0'[t] == -(γf/2 f0[t] + g1[t] m1[t] + g2[t] m2[t]), 
      m2'[t] == (-γc2 + γ2/2) m2[t] - 
        g2[t] f0[t] - γ12/2 m1[t], m1[0] == 1, f0[0] == 0, 
      m2[0] == 0}, {m1, m2, f0}, {t, 0, (Pi/2 ) τ}];
   MM[t_] = Evaluate[m2[t] /. sol1[[1]]];
   ans = MM[(Pi/2) τ];
    ξf = (ans) ξi;
   af = (.75) (ans^10) (ai);
   ξ1 = ξi - ξf;
   ξT1 = Transpose[ξ1];
   det = Det[ai + af];
   inv = Inverse[ai + af];
   zarb1 = ξT1.inv.ξ1},
  {L, 1, 1000, 100}]
ListPlot[hassan]
{{1, {{1.09029}}}, {101, {{1.06622}}}, {201, {{1.04201}}}, {301, \
{{1.01766}}}, {401, {{0.993172}}}, {501, {{0.968559}}}, {601, \
{{0.943825}}}, {701, {{0.91898}}}, {801, {{0.89403}}}, {901, \
{{0.868985}}}}

I have some differential equations as below. I have tried to solve them numerically with NDSolve and to plot zarb1 versus L. what's the problem I want to plot hassan versus L.

$\endgroup$
1
$\begingroup$

The matrix product ξT1.inv.ξ1 gives a $1\times 1$ matrix. In order to turn it into a scalar replace the last line in the first argument of the Table with (ξT1.inv.ξ1)[[1,1]] and your plot should work.

This is what I got with only this change to your code:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.