Implementation of basic waveforms used in control systems

Implementation of basic waveforms used in control systems

Sun, Jun 18, 2017

Categories: Academic

The control theory uses the following waveforms.

  • Step
  • Square
  • Rectangular
  • Sine
  • Triangular
  • Sawtooth

There are several techniques to produce these inputs. This post presents an easy way of creating and testing them.

Note that the functions presented here are easy to implement but not always efficient.

Generalized step function $S_0(t)$

A step wave has only two states and changes from one state to another at a single instance of time. It is given by

$${S_0(t)}=AH\left( t-{{t}_{0}} \right)+O,$$ \[H(t-t_0)=\left\{ \begin{matrix} 0 & \begin{matrix} \text{if} & t \lt t_0 \\ \end{matrix} \\ 1 & \begin{matrix} \text{if} & t\ge t_0 \\ \end{matrix} \\ \end{matrix} \right.\] where $A$ is the signal amplitude, ${{t}_{0}}$ is the time at which $S_0(t)$ changes its state, and $O$ is an offset.

Testing

Generalized square wave function $S_1(t)$

A square wave function also has only two states and it changes from one state to another at a regular interval of time..

$ \newcommand{\sech}{\mathop{\rm sech}\nolimits} \newcommand{\csch}{\mathop{\rm csch}\nolimits} \newcommand{\sgn}{\mathop{\rm sgn}\nolimits} $
\[S_1(t)=A\sgn \left[ \sin \left( {\omega}t \right) \right] + O ,\] \[\sgn (t)=\left\{ \begin{matrix} -1 & \text{if }t\lt0 \\ 1 & \text{if t}\ge \text{0} \\ \end{matrix} \right.\] \[\omega = 2\pi f\] where $f$ is the frequency, $A$ is the signal amplitude, and $O$ is the offset.

Testing

Generalized rectangular wave function $R(t)$

A rectangular wave function is similar to a square wave where the period of each state is not the same. The percentage duration of the higher state with respect to lower state is called duty cycle. This function is given by

\[R(t)=A\sgn\left[ \sin \left( \omega\left[ t+\frac{1}{2{{f}}}\left( 0.5-D \right) \right] \right)-\sin \left( \pi \left( 0.5-D \right) \right) \right]+ O\] \[\sgn (t)=\left\{ \begin{matrix} -1 & \text{if }t\lt0 \\ 1 & \text{if t}\ge \text{0} \\ \end{matrix} \right.\] \[\omega = 2\pi f\] where $D$ is the duty cycle, $f$ is the frequency, $A$ is the signal amplitude, and $O$ is the offset.

Testing

Generalized sine wave function $S_2(t)$

\[S_2(t)=A \sin \left( \omega t \right)+ O\] \[\omega = 2\pi f\] where $f$ is the frequency, $A$ is the signal amplitude, and $O$ is the offset.

Testing

Generalized Sawtooth wave function $S_3(t)$

\[S_3(t)= A \left[f\bmod\left(t, \frac{1}{f} \right) -0.5 \right] + O \] where $\bmod \,\left[ m,n \right]$gives the remainder of the division $\frac{m}{n}$, $f$ is the frequency, $A$ is the signal amplitude, and $O$ is the offset.

Testing

Generalized Triangular wave function $T(t)$

\[T(t)= \frac{2A}{\pi} \sin^{-1}\left[\sin\left( \omega t \right)\right] + O \] \[\omega = 2\pi f\] where $\bmod \,\left[ m,n \right]$gives the remainder of the division $\frac{m}{n}$, $f$ is the frequency, $A$ is the signal amplitude, and $O$ is the offset.

Testing