Hi all!, first post!

I'm programming an attitude estimation and control algorithm for a satellite. So I need a reference "trayectory" for my control system to try to follow.

The generation of that attitude profile is tricky: point to the sun, if sat has access to a certain city, point to it, the point again to the sun... and so on.

So I've managed to make a q(t) to make all that possible, but I need the angular velocities that yield that reference attitude quaternion as a function of time.

While I have already figured out a way to get them, they are not perfectly mathematically calculated, showing some nasty discontinuities at certain times.

So, the problem is, given the quaternion kinematic equations:

\begin{equation}

\dot q =\frac{1}{2} \left[ \begin{array}{cccc} q_4 & -q_3 & q_2 & q_1 \\ q_3 & q_4 & -q_1 & q_2 \\ -q_2 & q_1 & q_4 & q_3 \\ -q_1 & -q_2 & -q_3 & q_4 \end{array}\right] \left[ \begin{array}{c} \omega_1 \\ \omega_2 \\ \omega_3 \\ 0 \end{array}\right],

\end{equation}

and the quaternion \begin{equation}q(t),\end{equation} what is \begin{equation}\vec \omega(t)?.\end{equation} I think the problem would be a boundary value problem, but I don't really know. Does anyone can point me in the right direction?? maybe a matlab supereasy command

?

Thanks in advance!!