There are two or three tricks that we can use to solve for {a, b, c, ω}. First, of course, we write our equation. But, since that is only one equation, we will take one or more derivatives to generate additional equations. Then, we will substitute certain values for $x$. The result will be a set of equations that Mathematica can handle.
Specifically, we write our equation, take the second derivative and evaluate both equatinos at $x = 0$ and at $x=\pi$. This brings $\omega$ out into the open. We also use TrigExpand.
lhs = m Sin[x] + n Cos[x] + p ; rhs = a Sin[ω x + b] + c; eqn = {lhs == rhs, D[lhs, x, x] == D[rhs, x, x]}; eqs = {eqn /. x -> 0, eqn /. x -> π} // Flatten // TrigExpand; eqs // Column (* { n + p == c + a Sin[b], -n == -a ω^2 Sin[b], -n + p == c + a Cos[π ω] Sin[b] + a Cos[b] Sin[π ω], n == -a ω^2 Cos[π ω] Sin[b] - a ω^2 Cos[b] Sin[π ω] } *)
Now, we eliminate Sin[b] and Cos[b] and solve for $\omega$, like this
eq2 = List @@ Eliminate[eqs /. Cos[b] -> ρ /. Sin[b] -> σ, {ρ, σ}]; eq2 // Column Reduce[eq2, ω] (* { c n == n p, c ω^2 == p ω^2, n (-1 + ω^2) == 0 } (c == p && ω == -1) || (c == p && ω == 1) || (n == 0 && c == p) || (n == 0 && ω == 0) *)
So, if $n\neq 0$, we must have $c = p$ and $\omega = 1$ or $\omega=-1$. We note that if $n=0$ then we don't have a solution for $\omega$. We also note that when we used Eliminate we introduced the tacit assumptions that $\sin b\neq 0$ and $\cos b\neq 0$.
All of that just to get $\omega = \pm 1$. Now, we can substitute $\omega \rightarrow 1$ into our equation, remind Mathematica to consider what happens at $x=0$ and at $x=\pi$, and then solve for variables $a, b, c$. We get two families of solutions, so we pick the one that is simplest.
eqs = eqn /. ω -> 1; eq2 = {eqs, eqs /. x -> 0, eqs /. x -> π} // Flatten // TrigExpand; soln = Solve[eq2, {a, b, c}]; Simplify[soln // Last, Assumptions -> C[1] == 0] (* { a -> Sqrt[m^2 + n^2], c -> p, b -> ArcTan[m/Sqrt[m^2 + n^2], n/Sqrt[m^2 + n^2]] } *)
ExpToTrig[FullSimplify[TrigToExp[<Your Expression Here>]]]$\endgroup$mnandpwith real number and implemented your code. Then I got my origin expression yet. So is there anything wrong? $\endgroup$