dcgain — Evaluate steady-state gain of SISO transfer-function models.
dcgain(sys) evaluates a SISO transfer function at s = 0 for continuous-time models or z = 1 for discrete-time models.
Syntax
gain = dcgain(sys)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
sys | Any | Yes | — | SISO tf model. |
Returns
| Name | Type | Description |
|---|---|---|
gain | Any | Steady-state gain evaluated at s=0 for continuous-time or z=1 for discrete-time. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:dcgain:InvalidArgument | Input does not match supported invocation forms. | dcgain: invalid argument |
RunMat:dcgain:InvalidModel | Input system is not a valid SISO tf object. | dcgain: invalid model |
RunMat:dcgain:UnsupportedModel | Model form is not supported by the current implementation. | dcgain: unsupported model |
RunMat:dcgain:Internal | Gain evaluation failed internally. | dcgain: internal error |
How dcgain works
- Supports SISO
tfobjects. - Returns a real scalar for real-valued gains and a complex scalar for complex-valued gains.
- Continuous-time models are evaluated at zero frequency.
- Discrete-time models are evaluated at
z = 1.
GPU memory and residency
dcgain returns a host scalar.
Example
Continuous-time DC gain
H = tf(2, [1 3]);
dcgain(H)Expected output:
ans = 0.6667How RunMat validates dcgain
dcgain validates the input model and evaluates numerator and denominator polynomials at the steady-state point. Tests cover real continuous-time gains and VM integration.
- Implementation: `crates/runmat-runtime/src/builtins/control/dcgain.rs`
See Correctness & Trust for the full methodology and coverage table.
Using dcgain with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how dcgain changes the result.
Run a small dcgain example, explain the result, then change one input and compare the output.
FAQ
Does dcgain simulate a step response?⌄
No. It evaluates the transfer-function polynomials directly at the steady-state point.
Related Control functions
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how dcgain is executed, line by line, in Rust.
- View the source for dcgain 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.