damp — Return natural frequencies, damping ratios, and poles for control models.
damp(sys) analyzes supported control models by deriving natural frequencies and damping ratios from their poles.
Syntax
wn = damp(sys)
[wn, zeta] = damp(sys)
[wn, zeta, p] = damp(sys)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
sys | Any | Yes | — | SISO tf model or ss state-space model. |
Returns
| Name | Type | Description |
|---|---|---|
wn | NumericArray | Natural frequencies as an N-by-1 column vector. |
zeta | NumericArray | Damping ratios as an N-by-1 column vector. |
p | Any | Model poles as an N-by-1 real or complex column vector. |
Returned values from damp depend on how many outputs the caller requests.
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:damp:InvalidModel | Input system is malformed or missing model metadata. | damp: invalid model |
RunMat:damp:UnsupportedModel | Model class is unsupported. | damp: unsupported model |
RunMat:damp:OutputCount | More than three outputs are requested. | damp: too many output arguments |
RunMat:damp:Internal | Pole extraction or output construction failed. | damp: internal error |
How damp works
- Supports SISO
tfobjects andssstate-space objects. - Returns
wnandzetaasN x 1real column vectors. - Returns poles as an
N x 1real vector when all poles are real, or anN x 1complex vector when any pole has a nonzero imaginary part. - For continuous-time models,
wn = abs(p)andzeta = -real(p) / wn. - For discrete-time models, damping metrics use the equivalent continuous pole
log(p) / Ts, while thepoutput preserves the original discrete pole. - Static-gain transfer functions return empty column vectors.
GPU memory and residency
damp returns host-resident vectors.
Example
Second-order transfer function
G = tf(1, [100 50 400]);
[wn, zeta, p] = damp(G)Expected output:
wn contains values near 2, zeta contains values near 0.125, and p contains the complex pole pair.How RunMat validates damp
damp validates model metadata, extracts poles from transfer-function denominators or state-space state matrices, and materializes MATLAB-style column outputs. Tests cover continuous and discrete transfer functions, state-space models, output counts, and descriptor metadata.
- Implementation: `crates/runmat-runtime/src/builtins/control/damp.rs`
See Correctness & Trust for the full methodology and coverage table.
Using damp with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how damp changes the result.
Run a small damp example, explain the result, then change one input and compare the output.
FAQ
Does damp cancel pole-zero pairs?⌄
No. For tf objects it analyzes the stored denominator polynomial.
Does damp support discrete-time systems?⌄
Yes. Natural frequency and damping ratio are computed from log(p) / Ts; the returned poles remain in the discrete domain.
Related Control functions
db · dcgain · feedback · impulse · isstable · nyquist · pole · rlocus · ss · step · stepinfo · tf · zero
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how damp is executed, line by line, in Rust.
- View the source for damp in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.