0
$\begingroup$

I'm trying to perform a List Plot, but I'm having an issue trying to plot the two given functions accordingly. What is the syntax suppose to look like for Sow within the WhenEvent function?

ClearAll["Global`*"]
q = 0.2; \[Omega] = 2.44; \[Beta] = 0.03; m = 3.2; \[Kappa] = 2.63; \
\[CapitalOmega] = 2.4; 
sol = Reap[NDSolveValue[{
    f''[t] + 2 \[Beta] f'[t] + (1 - m \[Omega]^2 u[t]) f[t] == 0,
    u''[t] + 
      2 \[Beta] u[t] + \[Omega]^2 u[
        t] + \[Kappa] (f[t]*f''[t] + (f'[t])^2) == 
     q/m Cos[\[CapitalOmega] t],
    f[0] == 0, f'[0] == 0, u[0] == 0, u'[0] == 0,
    WhenEvent[Mod[t, 2 \[Pi]/\[CapitalOmega]] == 0, 
     Sow[{f[t], f'[t]}, {u[t], u'[t]}]]}
   , {f, u}, {t, 0, 30000}, MaxSteps -> Infinity]]
ListPlot[pst, PlotStyle -> PointSize[0.0025], PlotRange -> All]
$\endgroup$
4
  • $\begingroup$ What is pst in the ListPlot? $\endgroup$
    – 407PZ
    Nov 24, 2019 at 22:45
  • $\begingroup$ That was meant to be my list of points, but I changed the variable for the NDSolveValue setup to see what came out of it without problems regarding the list shapes not matching $\endgroup$
    – TexMexDex
    Nov 24, 2019 at 23:14
  • $\begingroup$ Plot[sol[[1, 2]][x], {x, 0, 30000}]? $\endgroup$ Nov 24, 2019 at 23:59
  • $\begingroup$ Sadly, that doesn't work :( $\endgroup$
    – TexMexDex
    Dec 1, 2019 at 4:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.