damp — Return natural frequencies, damping ratios, and poles for control models.
damp(sys) derives natural frequencies and damping ratios from the poles of a local tf or ss model. It returns up to three host-resident column vectors: natural frequency wn, damping ratio zeta, and poles p.
Syntax
wn = damp(sys)
[wn, zeta] = damp(sys)
[wn, zeta, p] = damp(sys)Inputs
sys- Type
Any- Required
- Yes
- Description
- SISO tf model or ss state-space model.
Returns
wn- Type
NumericArray- Description
- Natural frequencies as an N-by-1 real double column vector.
zeta- Type
NumericArray- Description
- Damping ratios as an N-by-1 real double column vector.
p- Type
Any- Description
- Model poles as an N-by-1 real or complex double column vector.
Returned values from damp depend on how many outputs the caller requests.
Errors
RunMat:damp:InvalidModel- When
- Input system is malformed or missing model metadata.
- Message
damp: invalid model
RunMat:damp:UnsupportedModel- When
- Model class is unsupported.
- Message
damp: unsupported model
RunMat:damp:OutputCount- When
- More than three outputs are requested.
- Message
damp: too many output arguments
RunMat:damp:Internal- When
- Pole extraction or output construction failed.
- Message
damp: internal error
Models and outputs
The supported inputs are SISO tf objects and ss state-space objects. For transfer functions, damp analyzes the stored denominator polynomial without canceling pole-zero pairs. For state-space models, it analyzes the state matrix eigenvalues. Static-gain transfer functions produce empty N-by-1 columns with N equal to zero.
wn and zeta are real double N-by-1 columns. Pole output p is a real double column when every pole's imaginary magnitude is at most the control-model tolerance (1e-12); otherwise it is a complex double column. One, two, or three requested outputs return the corresponding prefix; requesting more than three raises an output-count error before model analysis. A discarded-output call still analyzes the model, while a statement call does not yet render a diagnostic table.
Continuous and discrete damping
For a continuous-time pole p, wn = abs(p) and zeta = -real(p)/wn. For a discrete-time model with sample time Ts, the damping metrics use the equivalent continuous pole log(p)/Ts; the returned p remains in the discrete domain. Modes are sorted by natural frequency, then damping ratio and pole components.
Special poles use defined current behavior: a continuous zero or infinity has damping ratio -1; a discrete zero has infinite natural frequency and damping ratio +1; a discrete one or infinity has damping ratio -1. At a continuous zero and discrete one, natural frequency is zero. Numerical behavior for singular and nearly singular poles remains part of the current control-model implementation.
Placement and current limits
damp reads model metadata and runs pole analysis on the CPU. A direct numeric gpuArray input is not a model object and fails before provider access; if a valid tf or ss object has resident numeric properties used by the analysis, only those properties are gathered. Raw integer, logical, and complex arrays are likewise not model objects. Typed-integer tf coefficients or Ts, logical tf coefficients, and typed-integer consumed ss matrices or Ts assigned after construction are checked when damp admits the model; they do not turn a numeric array into a model.
This call can suspend while gathering consumed resident model properties. It does not invoke callbacks, access workspace or environment state, or require filesystem, network, time, randomness, or a user interface. It can throw for malformed models or failed pole extraction. Distributed model objects and transfer to remote workers are not supported.
Generalized, uncertain, zpk, sparss, and mechss models are not yet supported. Sparse-model Focus, MaxNumber, Shift, Tolerance, and Display options are not implemented. Statement-form damp(sys) does not yet show MATLAB's diagnostic table; request one to three outputs to use the result.
Examples
Damping of a second-order transfer function
G = tf(1, [100 50 400]); [wn, zeta, p] = damp(G); fprintf('%.3f %.3f\n', wn(1), zeta(1));Expected output:
2.000 0.125Discrete-time damping and original pole
D = tf(1, [1 -0.5], 0.1); [wn, zeta, p] = damp(D);Analyze state-space modes
S = ss([0 1; -4 -0.5], [0; 1], [1 0], 0); [wn, zeta] = damp(S);Static gain has no dynamic modes
[wn, zeta, p] = damp(tf(2, 1));A numeric array is not a control model
damp(1)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. Frequency and damping ratio use log(p)/Ts while the returned pole remains in the discrete domain.
Related Control functions
Source you can read
Every RunMat function's source is public. 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 a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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.