impulse — Compute or plot the impulse response of a SISO transfer function.
impulse(sys) computes the impulse response of a supported dynamic system. With output arguments it returns numeric samples; without outputs it plots the response when a plotting service is available.
Syntax
impulse(sys)
impulse(sys, tFinal)
impulse(sys, t)
y = impulse(sys)
y = impulse(sys, tFinal)
y = impulse(sys, t)All supported impulse forms
impulse(sys)
impulse(sys, tFinal)
impulse(sys, t)
y = impulse(sys)
y = impulse(sys, tFinal)
y = impulse(sys, t)
[y,t] = impulse(sys)
[y,t] = impulse(sys, tFinal)
[y,t] = impulse(sys, t)Inputs
sys- Type
Any- Required
- Yes
- Description
- SISO tf model.
time- Type
Any- Required
- No
- Description
- Final time scalar or explicit time vector.
Returns
y- Type
NumericArray- Description
- Impulse response samples (column vector).
t- Type
NumericArray- Description
- Time samples (column vector).
Returned values from impulse depend on how many outputs the caller requests.
Errors
RunMat:impulse:InvalidArgument- When
- Inputs do not match supported impulse invocation forms.
- Message
impulse: invalid argument
RunMat:impulse:InvalidModel- When
- Input system is not a supported tf object with valid required metadata.
- Message
impulse: invalid model
RunMat:impulse:InvalidTime- When
- Time argument is invalid for the model class or sampling mode.
- Message
impulse: invalid time input
Models and time
The current simulator accepts real, strictly proper SISO tf objects created by tf(num, den) or tf(num, den, Ts). It does not yet support MIMO, ss, zpk, frd, model arrays, identified-system families, complex coefficients, nonzero delays, static gains, or non-strictly-proper transfer functions. The last two forms include a direct impulse term that is not represented as a finite response vector.
With no time argument, RunMat chooses a deterministic time vector. A finite nonnegative scalar generates a grid from zero to the final time; a real finite nonnegative strictly increasing vector supplies exact time coordinates. Continuous-time responses use a controllable canonical realization. Discrete-time responses use a unit-area impulse of height 1/Ts; explicit times must be integer multiples of Ts.
The response and time outputs are N-by-1 double columns. Typed-integer, logical, single, and resident numeric roles are separately gated RunMat extensions, including numeric metadata consumed from a tf object. Typed integers must cross the floating simulation boundary exactly.
Execution and placement
Simulation runs on the host. Required resident model properties and time input gather through their owning provider after host-known input validation; unrelated object properties are not consumed. Output arrays are host resident and the operation ends fusion.
No-output calls may use the user-interface capability and plot continuous systems with plot or discrete systems with stem. Output-producing calls have no plotting effect. GPU kernels do not evaluate the response.
Examples
First-order impulse response
H = tf(20, [1 5]); [y,t] = impulse(H, [0 0.1 0.2]); fprintf('%d %d %d %d\n', size(y,1), size(y,2), size(t,1), size(t,2));Expected output:
3 1 3 1Scalar final time
H = tf(1, [1 3 2]); [y,t] = impulse(H, 2);Discrete-time impulse response
H = tf(1, [1 -0.5], 0.1); [y,t] = impulse(H, [0 0.1 0.2]);Plot an impulse response
H = tf(1, [1 3 2]); impulse(H); fprintf('ok\n');Expected output:
okUsing impulse with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how impulse changes the result.
Run a small impulse example, explain the result, then change one input and compare the output.
FAQ
Does impulse support MIMO systems?⌄
Not yet. The current simulator supports real SISO tf objects.
Why are non-strictly-proper transfer functions rejected?⌄
They include a direct impulse term that cannot be represented by this implementation's finite numeric response vector.
Can I use state-space or zero-pole-gain models?⌄
Not yet. ss, zpk, frd, model arrays, and identified-system families are outside the current implementation.
Related Control functions
Source you can read
Every RunMat function's source is public. Read exactly how impulse is executed, line by line, in Rust.
- View the source for impulse 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.