impulse — Compute or plot the impulse response of supported dynamic system models.
impulse(sys) computes the impulse response for real, strictly proper, scalar-input scalar-output tf objects. With output arguments it returns numeric response data; when called in a no-output context and plotting is available, it plots the response.
Syntax
impulse(sys)
y = impulse(sys)
[y, t] = impulse(sys)
[y, t] = impulse(sys, tFinal)
[y, t] = impulse(sys, t)sysmust currently be a real, strictly proper SISOtfobject.tFinalmust be a finite non-negative scalar.tmust be a real vector of finite non-negative strictly increasing times. For discrete systems, values must be integer multiples ofsys.Ts.
How impulse works
- Supports real SISO
tfobjects created bytf(num, den)ortf(num, den, Ts). impulse(sys)uses a deterministic default time vector.impulse(sys, tFinal)generates a deterministic time vector from zero totFinal.impulse(sys, t)respects an explicit real, finite, non-negative, strictly increasing time vector.[y, t] = impulse(...)returnsyandtasN x 1column vectors for supported SISO systems.- Continuous-time responses are evaluated from a controllable canonical state-space realization.
- Discrete-time responses respect MATLAB's unit-area impulse convention: the input pulse has height
1/Ts, and time vectors must use integer multiples ofTs. - Unsupported model classes, delays, complex coefficients, static gains, and non-strictly-proper transfer functions raise clear diagnostics.
GPU memory and residency
impulse returns host-resident response vectors. It does not preserve gpuArray residency.
Examples
Compute a first-order impulse response
H = tf(20, [1 5]);
t = 0:0.1:1;
[y, tout] = impulse(H, t);Expected output:
y and tout are column vectors.Plot an impulse response
H = tf(1, [1 3 2]);
impulse(H);Discrete-time impulse response
H = tf(1, [1 -0.5], 0.1);
[y, t] = impulse(H, 0:0.1:0.5);How RunMat validates impulse
impulse validates the model class, coefficient type and shape, delay properties, strict properness, sample time, and time vector before simulation. Tests cover SISO continuous response values, discrete response values, explicit time input, multi-output shapes, and representative diagnostics.
- Implementation: `crates/runmat-runtime/src/builtins/control/impulse.rs`
See Correctness & Trust for the full methodology and coverage table.
FAQ
Does impulse support MIMO systems?⌄
Not yet. The current implementation supports real SISO tf objects. Broader model-family and MIMO support is tracked separately.
Why are non-strictly-proper transfer functions rejected?⌄
Those systems include a direct impulse term that is not represented as a finite numeric response vector in the current runtime model.
Can I use state-space or zero-pole-gain models?⌄
Not yet. ss, zpk, frd, model arrays, and identified-system families are outside this first implementation.
Related Control functions
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how impulse works, line by line, in Rust.
- View impulse.rs on GitHub
- Learn how the 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 — faster, on any GPU, with no license required.
- Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
- Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
- A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.