Derivative
IconDerivative
Outputs an approximate derivative of the input. The transfer function of this block is
k k ks
─ - ─────── = ──────
T sT² + T sT + 1
and a state-space realization is given by ss(-1/T, 1/T, -k/T, k/T)
where T
is the time constant of the filter. A smaller T
leads to a more ideal approximation of the derivative.
This component extends from SISO
Usage
Derivative(x0=0, T, k=1.0)
Parameters:
Name | Description | Units | Default value |
---|---|---|---|
x0 | Initial value of the derivative-filter state | – | 0 |
T | Time constant | – | |
k | Gain | – | 1 |
Connectors
u
- This connector represents a real signal as an input to a component (RealInput
)y
- This connector represents a real signal as an output from a component (RealOutput
)
Variables
Name | Description | Units |
---|---|---|
x | Derivative-filter state | – |
Behavior
\[ \begin{align} \frac{\mathrm{d} x\left( t \right)}{\mathrm{d}t} &= \frac{u\left( t \right) - x\left( t \right)}{T} \\ y\left( t \right) &= \frac{k \left( u\left( t \right) - x\left( t \right) \right)}{T} \end{align} \]
Source
# Outputs an approximate derivative of the input. The transfer function of this block is
#
# ```
# k k ks
# ─ - ─────── = ──────
# T sT² + T sT + 1
# ```
#
# and a state-space realization is given by `ss(-1/T, 1/T, -k/T, k/T)`
# where `T` is the time constant of the filter.
# A smaller `T` leads to a more ideal approximation of the derivative.
component Derivative
extends SISO
# Derivative-filter state
variable x::Real
# Initial value of the derivative-filter state
parameter x0::Real = 0
# Time constant
parameter T::Real
# Gain
parameter k::Real = 1.0
relations
initial x = x0
der(x) = (u-x)/T
y = (k/T)*(u-x)
metadata {"JuliaSim": {"icons": {"default": "jsml://BlockComponents/Derivative.svg"}}}
end
Flattened Source
# Outputs an approximate derivative of the input. The transfer function of this block is # # ``` # k k ks # ─ - ─────── = ────── # T sT² + T sT + 1 # ``` # # and a state-space realization is given by `ss(-1/T, 1/T, -k/T, k/T)` # where `T` is the time constant of the filter. # A smaller `T` leads to a more ideal approximation of the derivative. component Derivative u = RealInput() [{ "JuliaSim": { "placement": {"icon": {"iconName": "input", "x1": -50, "y1": 450, "x2": 50, "y2": 550}} } }] y = RealOutput() [{ "JuliaSim": { "placement": {"icon": {"iconName": "output", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}} } }] # Derivative-filter state variable x::Real # Initial value of the derivative-filter state parameter x0::Real = 0 # Time constant parameter T::Real # Gain parameter k::Real = 1.0 relations initial x = x0 der(x) = (u-x)/T y = (k/T)*(u-x) metadata {"JuliaSim": {"icons": {"default": "jsml://BlockComponents/Derivative.svg"}}} end
Test Cases
Related
- Examples
- Experiments
- Analyses