Message Boards Message Boards

Plot the result of NDSolve as a RectangleChart3D?

GROUPS:

Hi, I request a solution to my problem where i want to plot the either the energy (x^2) or the signal itself (x) which is being the solution of a differential solution. I am successful only placing the phase-plane of a 2D system but the bar graph on the right does not shown anything. The code is

splot = StreamPlot[{y, -Sin[x] - .25 y}, {x, -4, 4}, {y, -3, 3}];
Manipulate[
 Grid[{{Show[splot, 
     ParametricPlot[
      Evaluate[
       First[{x[t], y[t]} /. 
         NDSolve[{x'[t] == y[t], y'[t] == -Sin[x[t]] - .25 y[t], 
           Thread[{x[0], y[0]} == point]}, {x, y}, {t, 0, T}]]], {t, 
       0, T}, PlotStyle -> Red]], 
    RectangleChart3D[{{0.25, 1, 
       Evaluate[
        First[{x[t]} /. 
          NDSolve[{x'[t] == y[t], y'[t] == -Sin[x[t]] - .25 y[t], 
            Thread[{x[0], y[0]} == point]}, {x, y}, {t, 0, 
            T}]]]}, {0.25, 1, 
       Evaluate[
        First[{y[t]} /. 
          NDSolve[{x'[t] == y[t], y'[t] == -Sin[x[t]] - .25 y[t], 
            Thread[{x[0], y[0]} == point]}, {x, y}, {t, 0, T}]]]}}, 
     ChartLegends -> {"x[t]", "y[t]"}, PlotRange -> {0, 1}, 
     ImageSize -> {200, 250}, ChartStyle -> {Red, Green}, 
     AspectRatio -> 1, BarSpacing -> 0.2, Axes -> False]}}], {{T, 90},
   1, 100}, {{point, {2, 1.0}}, Locator}, SaveDefinitions -> True]
Attachments:
POSTED BY: Salman Zaffar
Answer
1 month ago

Group Abstract Group Abstract