F[t_] = Piecewise[{{Subscript[F, 0] t/(T/2), 0 <= t <= T/2}, {-Subscript[F, 0], T/2 <= t <= T}}] Subscript[F, 0] = 268(*N*); T=33921.8; Plot[{F[t]}, {t, 0, T}, PlotRange -> All, Frame -> True, FrameLabel -> {"t [s]", "M [Nm]"}, BaseStyle -> {FontFamily -> "Courier New", FontSize -> 10}] a0 = 2/T Integrate[F[t], {t, 0, T}, Assumptions -> {T [Element] Reals, T > 0}]; aj[j_] = 2/ T Integrate[Cos[j 2 Pi t/T] F[t], {t, 0, T/2}, Assumptions -> {T [Element] Reals, T > 0}]; bj[j_] = 2/ T Integrate[Sin[j 2 Pi t/T] F[t], {t, 0, T}, Assumptions -> {T [Element] Reals, T > 0}]; x[t_, num_] := x0 + Sum[xa[t, j], {j, 1, num}] + Sum[xb[t, j], {j, 1, num}] β[j_] = 1/ Sqrt[(1 - ((j 2 Pi)/(T ω0))^2)^2 + (2 δ ( j 2 Pi)/(T ω0))^2]; ϕ[j_] = ArcTan[(1 - ((j 2 Pi )/(τ ω0))^2), (2 δ ( j 2 Pi)/(τ ω0))]; x0 = a0/(2 ω0^2 Jn); xa[t_, j_] := aj[j]/(Jn ω0^2) β[j] Cos[j 2 Pi t/τ - ϕ[j]]; xb[t_, j_] := bj[j]/(Jn ω0^2) β[j] Sin[j 2 Pi t/τ - ϕ[j]]; omegas={0.000154355, 0.00029819, 0.000421705, 0.000516481, 0.00057606} diagM={{2964, 0, 0, 0, 0}, {0, 988, 0, 0, 0}, {0, 0, 741, 0, 0}, {0, 0, 0, 988, 0}, {0, 0, 0, 0, 2964}} x[t_, num_] := Table[x0[[i]] + Sum[xa[[i]], {j, 1, num}] + Sum[xb[[i]], {j, 1, num}], {i, 1, 5}] δ = 0.23; x0 = Table[a0/(2 ω0^2 diagM[[i, i]]), {i, 1, 5}]; xa = Table[ aj[j]/(diagM[[i, i]] omegas[[i]]^2) 1/ Sqrt[(1 - ((j 2 Pi)/(T omegas[[i]]))^2)^2 + (2 δ ( j 2 Pi)/(T omegas[[i]]))^2] Cos[j 2 Pi t/T - ArcTan[(1 - ((j 2 Pi )/(T omegas[[i]]))^2), (2 δ ( j 2 Pi)/(T omegas[[i]]))]], {i, 1, 5}]; xb = Table[ bj[j]/(diagM[[i, i]] omegas[[i]]^2) 1/ Sqrt[(1 - ((j 2 Pi)/(T omegas[[i]]))^2)^2 + (2 δ ( j 2 Pi)/(T omegas[[i]]))^2] Sin[j 2 Pi t/T - ArcTan[(1 - ((j 2 Pi )/(T omegas[[i]]))^2), (2 δ ( j 2 Pi)/(T omegas[[i]]))]], {i, 1, 5}];