RunMat
GitHub

feedback — Form SISO feedback interconnections for transfer-function models.

feedback(sys1, sys2) returns the closed-loop SISO transfer function for negative feedback. sys2 may be another compatible tf object or a scalar gain.

Syntax

sys = feedback(sys1)
sys = feedback(sys1, sys2)
sys = feedback(sys1, sys2, sign)

Inputs

NameTypeRequiredDefaultDescription
sys1AnyYesForward-path SISO transfer-function model.
sys2AnyNo1Feedback-path SISO transfer function or scalar gain.
signNumericScalarNo-1-1 for negative feedback or +1 for positive feedback.

Returns

NameTypeDescription
sysAnyClosed-loop SISO transfer-function object.

Errors

IdentifierWhenMessage
RunMat:feedback:InvalidArgumentInputs do not match supported feedback invocation forms.feedback: invalid argument
RunMat:feedback:InvalidModelInput systems are not supported SISO transfer-function models.feedback: invalid model
RunMat:feedback:InvalidSignFeedback sign is not -1 or +1.feedback: sign must be -1 or +1

How feedback works

  • Supports real or complex SISO tf objects represented by numerator and denominator coefficient vectors.
  • feedback(sys1) uses unity negative feedback.
  • feedback(sys1, sys2) computes sys1/(1 + sys1*sys2).
  • feedback(sys1, sys2, +1) computes positive feedback as sys1/(1 - sys1*sys2).
  • Scalar gains are promoted to constant transfer functions using the other operand's variable and sample time.
  • Input systems must have compatible sample times.
  • Nonzero input or output delays are rejected with a clear unsupported-model diagnostic.

GPU memory and residency

feedback returns a host-side tf object. It does not preserve gpuArray residency.

Examples

Unity negative feedback

s = tf('s');
G = 2/(s + 3);
T = feedback(G, 1);
T.Denominator

Expected output:

ans = [1 5]

Positive feedback

G = tf(2, [1 3]);
T = feedback(G, 1, +1);
T.Denominator

Expected output:

ans = [1 1]

How RunMat validates feedback

feedback validates argument count, feedback sign, sample-time compatibility, zero-delay support, and transfer-function model shape. Tests cover unity negative feedback, positive feedback, scalar gains, and VM workflows using tf('s').

See Correctness & Trust for the full methodology and coverage table.

Using feedback with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how feedback changes the result.

Run a small feedback example, explain the result, then change one input and compare the output.

FAQ

Does feedback support MIMO systems?

Not yet. This implementation supports SISO transfer-function objects and scalar gains.

Does it support state-space models?

Not yet. The current model-family support is SISO tf.

db · dcgain · impulse · isstable · nyquist · pole · ss · step · stepinfo · tf

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how feedback is executed, line by line, in Rust.

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.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.