Skip to main content
correct Matlab function name
Source Link
TimWescott
  • 14.5k
  • 1
  • 14
  • 29

First, typically when you're exerting a force on something and getting a position, the acceleration varies instantaneously with force. A more or less universal equation of motion for a single-axis linear system would be $m \ddot x = f_v(\dot x) + f_p(x)$. For a mass-spring-damper system, it'd be $m \ddot x = b \dot x + k x$.

So you can easily express that as a 2nd-order state space equation where $\mathbf{x} = \begin{bmatrix}v, x\end{bmatrix}^T$ and $$A = \begin{bmatrix} * & * \\ 1 & 0\end{bmatrix}$$

Getting more complicated than that, as @Gab says, you'll need to have a model of the system.

If you do have a model of the system as a continuous-time state-space linear system, and you can model how the system is driven then you can do this. This is sensible if, for instance, you're trying to find the transfer function of a plant in response to drive outputs from a controller, and those drive outputs have a known form.

In the case of a system that's driven by normal DACs, or otherwise by drive that can be modeled accurately by zero-order holds, then $A_d = e^{A T_s}$, $B_d = A^{-1}(e^{A T_s} - I)$, and $C_d = C$. This gets into obvious numerical difficulties when $A$ is singular -- there's ways around this, but I suggest a dive into a book on state-space control.

I usually detest just referring to Matlab function calls without proof, but -- Matlab's 'c2d' (Scilab's 'dscr', or scipy's 'scipy.signal.cont2discrete') function will do the above, even when $A$ is singular. I can't speak for the other two, but Scilab uses the identity.

$$e^{\begin{bmatrix} A & B \\ 0 & 0 \end{bmatrix}T_s} = \begin{bmatrix} A_d & B_d \\ 0 & I \end{bmatrix}$$

First, typically when you're exerting a force on something and getting a position, the acceleration varies instantaneously with force. A more or less universal equation of motion for a single-axis linear system would be $m \ddot x = f_v(\dot x) + f_p(x)$. For a mass-spring-damper system, it'd be $m \ddot x = b \dot x + k x$.

So you can easily express that as a 2nd-order state space equation where $\mathbf{x} = \begin{bmatrix}v, x\end{bmatrix}^T$ and $$A = \begin{bmatrix} * & * \\ 1 & 0\end{bmatrix}$$

Getting more complicated than that, as @Gab says, you'll need to have a model of the system.

If you do have a model of the system as a continuous-time state-space linear system, and you can model how the system is driven then you can do this. This is sensible if, for instance, you're trying to find the transfer function of a plant in response to drive outputs from a controller, and those drive outputs have a known form.

In the case of a system that's driven by normal DACs, or otherwise by drive that can be modeled accurately by zero-order holds, then $A_d = e^{A T_s}$, $B_d = A^{-1}(e^{A T_s} - I)$, and $C_d = C$. This gets into obvious numerical difficulties when $A$ is singular -- there's ways around this, but I suggest a dive into a book on state-space control.

I usually detest just referring to Matlab function calls without proof, but -- Matlab's 'c2d' (Scilab's 'dscr', or scipy's 'scipy.signal.cont2discrete') function will do the above, even when $A$ is singular.

First, typically when you're exerting a force on something and getting a position, the acceleration varies instantaneously with force. A more or less universal equation of motion for a single-axis linear system would be $m \ddot x = f_v(\dot x) + f_p(x)$. For a mass-spring-damper system, it'd be $m \ddot x = b \dot x + k x$.

So you can easily express that as a 2nd-order state space equation where $\mathbf{x} = \begin{bmatrix}v, x\end{bmatrix}^T$ and $$A = \begin{bmatrix} * & * \\ 1 & 0\end{bmatrix}$$

Getting more complicated than that, as @Gab says, you'll need to have a model of the system.

If you do have a model of the system as a continuous-time state-space linear system, and you can model how the system is driven then you can do this. This is sensible if, for instance, you're trying to find the transfer function of a plant in response to drive outputs from a controller, and those drive outputs have a known form.

In the case of a system that's driven by normal DACs, or otherwise by drive that can be modeled accurately by zero-order holds, then $A_d = e^{A T_s}$, $B_d = A^{-1}(e^{A T_s} - I)$, and $C_d = C$. This gets into obvious numerical difficulties when $A$ is singular -- there's ways around this, but I suggest a dive into a book on state-space control.

Matlab's 'c2d' (Scilab's 'dscr', or scipy's 'scipy.signal.cont2discrete') function will do the above, even when $A$ is singular. I can't speak for the other two, but Scilab uses the identity.

$$e^{\begin{bmatrix} A & B \\ 0 & 0 \end{bmatrix}T_s} = \begin{bmatrix} A_d & B_d \\ 0 & I \end{bmatrix}$$

correct Matlab function name
Source Link
TimWescott
  • 14.5k
  • 1
  • 14
  • 29

First, typically when you're exerting a force on something and getting a position, the acceleration varies instantaneously with force. A more or less universal equation of motion for a single-axis linear system would be $m \ddot x = f_v(\dot x) + f_p(x)$. For a mass-spring-damper system, it'd be $m \ddot x = b \dot x + k x$.

So you can easily express that as a 2nd-order state space equation where $\mathbf{x} = \begin{bmatrix}v, x\end{bmatrix}^T$ and $$A = \begin{bmatrix} * & * \\ 1 & 0\end{bmatrix}$$

Getting more complicated than that, as @Gab says, you'll need to have a model of the system.

If you do have a model of the system as a continuous-time state-space linear system, and you can model how the system is driven then you can do this. This is sensible if, for instance, you're trying to find the transfer function of a plant in response to drive outputs from a controller, and those drive outputs have a known form.

In the case of a system that's driven by normal DACs, or otherwise by drive that can be modeled accurately by zero-order holds, then $A_d = e^{A T_s}$, $B_d = A^{-1}(e^{A T_s} - I)$, and $C_d = C$. This gets into obvious numerical difficulties when $A$ is singular -- there's ways around this, but I suggest a dive into a book on state-space control.

I usually detest just referring to Matlab function calls without proof, but -- Matlab's 'c2d' (Scilab's 'dscr', or scipy's 'scipy.signal.cont2discrete') function will do the above, even when $A$ is singular.

First, typically when you're exerting a force on something and getting a position, the acceleration varies instantaneously with force. A more or less universal equation of motion for a single-axis linear system would be $m \ddot x = f_v(\dot x) + f_p(x)$. For a mass-spring-damper system, it'd be $m \ddot x = b \dot x + k x$.

So you can easily express that as a 2nd-order state space equation where $\mathbf{x} = \begin{bmatrix}v, x\end{bmatrix}^T$ and $$A = \begin{bmatrix} * & * \\ 1 & 0\end{bmatrix}$$

Getting more complicated than that, as @Gab says, you'll need to have a model of the system.

If you do have a model of the system as a continuous-time state-space linear system, and you can model how the system is driven then you can do this. This is sensible if, for instance, you're trying to find the transfer function of a plant in response to drive outputs from a controller, and those drive outputs have a known form.

In the case of a system that's driven by normal DACs, or otherwise by drive that can be modeled accurately by zero-order holds, then $A_d = e^{A T_s}$, $B_d = A^{-1}(e^{A T_s} - I)$, and $C_d = C$. This gets into obvious numerical difficulties when $A$ is singular -- there's ways around this, but I suggest a dive into a book on state-space control.

I usually detest just referring to Matlab function calls without proof, but -- Matlab's 'dscr' function will do the above, even when $A$ is singular.

First, typically when you're exerting a force on something and getting a position, the acceleration varies instantaneously with force. A more or less universal equation of motion for a single-axis linear system would be $m \ddot x = f_v(\dot x) + f_p(x)$. For a mass-spring-damper system, it'd be $m \ddot x = b \dot x + k x$.

So you can easily express that as a 2nd-order state space equation where $\mathbf{x} = \begin{bmatrix}v, x\end{bmatrix}^T$ and $$A = \begin{bmatrix} * & * \\ 1 & 0\end{bmatrix}$$

Getting more complicated than that, as @Gab says, you'll need to have a model of the system.

If you do have a model of the system as a continuous-time state-space linear system, and you can model how the system is driven then you can do this. This is sensible if, for instance, you're trying to find the transfer function of a plant in response to drive outputs from a controller, and those drive outputs have a known form.

In the case of a system that's driven by normal DACs, or otherwise by drive that can be modeled accurately by zero-order holds, then $A_d = e^{A T_s}$, $B_d = A^{-1}(e^{A T_s} - I)$, and $C_d = C$. This gets into obvious numerical difficulties when $A$ is singular -- there's ways around this, but I suggest a dive into a book on state-space control.

I usually detest just referring to Matlab function calls without proof, but -- Matlab's 'c2d' (Scilab's 'dscr', or scipy's 'scipy.signal.cont2discrete') function will do the above, even when $A$ is singular.

Source Link
TimWescott
  • 14.5k
  • 1
  • 14
  • 29

First, typically when you're exerting a force on something and getting a position, the acceleration varies instantaneously with force. A more or less universal equation of motion for a single-axis linear system would be $m \ddot x = f_v(\dot x) + f_p(x)$. For a mass-spring-damper system, it'd be $m \ddot x = b \dot x + k x$.

So you can easily express that as a 2nd-order state space equation where $\mathbf{x} = \begin{bmatrix}v, x\end{bmatrix}^T$ and $$A = \begin{bmatrix} * & * \\ 1 & 0\end{bmatrix}$$

Getting more complicated than that, as @Gab says, you'll need to have a model of the system.

If you do have a model of the system as a continuous-time state-space linear system, and you can model how the system is driven then you can do this. This is sensible if, for instance, you're trying to find the transfer function of a plant in response to drive outputs from a controller, and those drive outputs have a known form.

In the case of a system that's driven by normal DACs, or otherwise by drive that can be modeled accurately by zero-order holds, then $A_d = e^{A T_s}$, $B_d = A^{-1}(e^{A T_s} - I)$, and $C_d = C$. This gets into obvious numerical difficulties when $A$ is singular -- there's ways around this, but I suggest a dive into a book on state-space control.

I usually detest just referring to Matlab function calls without proof, but -- Matlab's 'dscr' function will do the above, even when $A$ is singular.