Skip to main content
2 of 3
deleted 61 characters in body
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456

NDSolve and Plotting

So I am having an issue using NDSolve and plotting the function. So I have two different NDSolve's in my plotting function (they are technically the same, just have different names but that can be changed back if at all possible because I want them to be the same) but the second one is not working.

When I remove it from the plot/manipulate command, it works fine and outputs an answer. I just need the expanded form so that I can manipulate the variables (if there is a way around this, that would be great too!)

Here is what I have so far, any help would be appreciated as I have no idea why I am getting this error.

Manipulate[
 Plot[{
   (Evaluate[
     ReplaceAll[
      Paorta[t],
      NDSolve[
       {Paorta'[t] == 
         1/Caorta ((1/2*k*(1 + Cos[ω t]) + 10 - Paorta[t])/
            Piecewise[{{Ro, 
               1/2*k*(1 + Cos[ω t]) + 10 - Paorta[t] > 0}}, 
             x*Ro] - Paorta[t]/Rsystemic), Paorta[0] == 90},
       {Paorta[t]},
       {t, 0, 10}
       ]
      ]
     ]), (1/2*k*(1 + Cos[ω t]) + 
     10), (((1/2*k*(1 + Cos[ω t]) + 10) - 
      Evaluate[
       ReplaceAll[Pao[t], 
        NDSolve[{Pao'[t] == 
           1/Caorta ((1/2*k*(1 + Cos[ω t]) + 10 - Pao[t])/
              Piecewise[{{Ro, 
                 1/2*k*(1 + Cos[ω t]) + 10 - Pao[t] > 0}}, 
               x*Ro] - Pao[t]/Rsystemic), Pao[0] == 90}, {Pao[t]}, {t,
           0, 10}
         ]
        ]
       ])/Ro)},
  {t, 0, 10},
  ImageSize -> Large,
  PlotRange -> Full,
  PlotLegends -> {"Aortic Pressure", "Pressure in Left Ventricle", 
    "Flow"}
  ],
 {{Caorta, 1/.48}, 1, 6},
 {{Rsystemic, 3.1}, .1, 6},
 {{x, 8000}, 1, 10000},
 {{ω, 2 π}, π, 3 π},
 {{k, 110}, 60, 200},
 {{Ro, .01}, .007, .05}
 ]

Thanks in advance!