I am solving a dynamical three equation system. Besides plotting the individual effects for each of the state variables in an array and in a tridimensional graph, I would like to export the data points to a .csv file. However, when I try to export the table to a .txt file via the "Export" command, the output is not suitable (as it exports the output in a very disorganized way). I was wondering if there could be a way to do this. The code I am using is below:
f = {L, \[Psi], d} /. NDSolve[{
d'[t] == (1/z) (\[Alpha] -
X \[Beta] (d[t]/Y[t]) - \[Gamma] L[t] - \[Delta] \[Psi][
t] - \[Tau] Y[t]) + \[Beta] (d[t]/Y[t]) d[t],
L'[t] == j (Y[t]/K) - e,
\[Psi]'[t] == p L[t] + 0.035 \[Psi][t],
Y[t] == (I + E + \[Alpha] -
X \[Beta] ( d[t]/Y[t]) - \[Gamma] L[t] - \[Delta] \[Psi][
t])/(1 - (1 - \[Tau]) (\[Psi][
t] + (1 - s) (1 - \[Psi][t]) - m z)),
L[0] == 0, \[Psi][0] == 0,
d[0] == 0} /. { \[Alpha] -> 1, \[Gamma] -> 10, \[Delta] -> 10,
X -> 1, \[Beta] -> 0.5, j -> 0.8, \[Tau] -> 0.01, I -> 1,
s -> 0.85, p -> 0.8, E -> 1, m -> 1.3, e -> 0.035, w -> 0.5,
z -> 1.2, K -> 1}, {L, \[Psi], d, Y}, {t, 0, 200}, MaxSteps -> 1000000 ][[1]]
l = {L[t], \[Psi][t], d[t]};
Show[GraphicsArray[Table[Plot[f[[i]][t], {t, 0, 200}, PlotRange -> All,
PlotStyle -> Blue,
AxesLabel -> TraditionalForm /@ {t, l[[i]]},
DisplayFunction -> Identity], {i, 3}]]]
Export["table.txt", f[t] /. sol, "Table"]
ParametricPlot3D[Evaluate[Append[#[t] & /@ f, Red]], {t, 0, 200}, BoxRatios -> {1, 1,0.5}, PlotRange -> All, PlotPoints -> 1500, AxesLabel -> TraditionalForm /@ l]
E
andI
in Mathematica. These can have very bad side effects. $\endgroup$E
andI
are definitely not variables in Mathematica... ;) $\endgroup$