Skip to main content
edited tags
Link

I have a function Ca[t] that oscillates like a Sine curve, that I used NDSolve to obtain. I want to calculate the average value of Ca[t] so 1/2(Max+Min) but I have not been able to do this successfully and I don't know what to do.

     Manipulate[

      k1 = 0.5; k2 = 0.2;
      r1 = -k1 Ca[t]^m;
      r2 = -k2 Cb[t]^n;
      xa = (Cao[0] - 
        0.5*(MaxValue[Ca[t], Reals] + MinValue[Ca[t], Reals]))/Cao[0];
      Cao[t_] = 5 + A Sin[\[Omega]Sin[ω t];
      sol = NDSolve[{
         Ca'[t] == r1*\[Tau]r1*τ + -Ca[t] + Cao[t],
         Cb'[t] == r2*\[Tau]r2*τ - r1*\[Tau]r1*τ - Cb[t],
         Cc'[t] == -r2*\[Tau]r2*τ - Cc[t],
         Ca[0] == 0,
         Cb[0] == 0,
         Cc[0] == 0},
        {Ca, Cb, Cc}, {t, 0, 100}];
     
   {{\[Tau]τ, 5, "residence time/min"}, 2, 10, Appearance -> "Labeled"},
   {{\[Omega]ω, 0.6, "frequency"}, 0.2, 2, 0.02, 
           Appearance -> "Labeled"},
   {{A, 2, "amplitude"}, 0.5, 5, 0.05, 
           Appearance -> "Labeled"},
   {{m, 1, "m"}, 0, 2, 1, ControlType -> SetterBar},
   {{n, 1, "n"}, 0, 2, 1, ControlType -> SetterBar}]

This is as much as I can trim my notebook, my latest attempt at calculating the average of Ca[t] inside the expression xa.

I have a function Ca[t] that oscillates like a Sine curve, that I used NDSolve to obtain. I want to calculate the average value of Ca[t] so 1/2(Max+Min) but I have not been able to do this successfully and I don't know what to do.

     Manipulate[

      k1 = 0.5; k2 = 0.2;
      r1 = -k1 Ca[t]^m;
      r2 = -k2 Cb[t]^n;
      xa = (Cao[0] - 
        0.5*(MaxValue[Ca[t], Reals] + MinValue[Ca[t], Reals]))/Cao[0];
      Cao[t_] = 5 + A Sin[\[Omega] t];
      sol = NDSolve[{
         Ca'[t] == r1*\[Tau] + -Ca[t] + Cao[t],
         Cb'[t] == r2*\[Tau] - r1*\[Tau] - Cb[t],
         Cc'[t] == -r2*\[Tau] - Cc[t],
         Ca[0] == 0,
         Cb[0] == 0,
         Cc[0] == 0},
        {Ca, Cb, Cc}, {t, 0, 100}];
     
   {{\[Tau], 5, "residence time/min"}, 2, 10, Appearance -> "Labeled"},
   {{\[Omega], 0.6, "frequency"}, 0.2, 2, 0.02, 
           Appearance -> "Labeled"},
   {{A, 2, "amplitude"}, 0.5, 5, 0.05, 
           Appearance -> "Labeled"},
   {{m, 1, "m"}, 0, 2, 1, ControlType -> SetterBar},
   {{n, 1, "n"}, 0, 2, 1, ControlType -> SetterBar}]

This is as much as I can trim my notebook, my latest attempt at calculating the average of Ca[t] inside the expression xa.

I have a function Ca[t] that oscillates like a Sine curve, that I used NDSolve to obtain. I want to calculate the average value of Ca[t] so 1/2(Max+Min) but I have not been able to do this successfully and I don't know what to do.

     Manipulate[

      k1 = 0.5; k2 = 0.2;
      r1 = -k1 Ca[t]^m;
      r2 = -k2 Cb[t]^n;
      xa = (Cao[0] - 
        0.5*(MaxValue[Ca[t], Reals] + MinValue[Ca[t], Reals]))/Cao[0];
      Cao[t_] = 5 + A Sin[ω t];
      sol = NDSolve[{
         Ca'[t] == r1*τ + -Ca[t] + Cao[t],
         Cb'[t] == r2*τ - r1*τ - Cb[t],
         Cc'[t] == -r2*τ - Cc[t],
         Ca[0] == 0,
         Cb[0] == 0,
         Cc[0] == 0},
        {Ca, Cb, Cc}, {t, 0, 100}];
     
   {{τ, 5, "residence time/min"}, 2, 10, Appearance -> "Labeled"},
   {{ω, 0.6, "frequency"}, 0.2, 2, 0.02, 
           Appearance -> "Labeled"},
   {{A, 2, "amplitude"}, 0.5, 5, 0.05, 
           Appearance -> "Labeled"},
   {{m, 1, "m"}, 0, 2, 1, ControlType -> SetterBar},
   {{n, 1, "n"}, 0, 2, 1, ControlType -> SetterBar}]

This is as much as I can trim my notebook, my latest attempt at calculating the average of Ca[t] inside the expression xa.

Tweeted twitter.com/#!/StackMma/status/349303327781167104
Source Link
baumannr
  • 787
  • 3
  • 10

Averaging an oscillating function

I have a function Ca[t] that oscillates like a Sine curve, that I used NDSolve to obtain. I want to calculate the average value of Ca[t] so 1/2(Max+Min) but I have not been able to do this successfully and I don't know what to do.

     Manipulate[

      k1 = 0.5; k2 = 0.2;
      r1 = -k1 Ca[t]^m;
      r2 = -k2 Cb[t]^n;
      xa = (Cao[0] - 
        0.5*(MaxValue[Ca[t], Reals] + MinValue[Ca[t], Reals]))/Cao[0];
      Cao[t_] = 5 + A Sin[\[Omega] t];
      sol = NDSolve[{
         Ca'[t] == r1*\[Tau] + -Ca[t] + Cao[t],
         Cb'[t] == r2*\[Tau] - r1*\[Tau] - Cb[t],
         Cc'[t] == -r2*\[Tau] - Cc[t],
         Ca[0] == 0,
         Cb[0] == 0,
         Cc[0] == 0},
        {Ca, Cb, Cc}, {t, 0, 100}];
     
   {{\[Tau], 5, "residence time/min"}, 2, 10, Appearance -> "Labeled"},
   {{\[Omega], 0.6, "frequency"}, 0.2, 2, 0.02, 
           Appearance -> "Labeled"},
   {{A, 2, "amplitude"}, 0.5, 5, 0.05, 
           Appearance -> "Labeled"},
   {{m, 1, "m"}, 0, 2, 1, ControlType -> SetterBar},
   {{n, 1, "n"}, 0, 2, 1, ControlType -> SetterBar}]

This is as much as I can trim my notebook, my latest attempt at calculating the average of Ca[t] inside the expression xa.