ICore Blocks / Features / ICoreMath

The maths in one place.
Measured against MATLAB.

One module holds every number the product computes: the types, the control-systems tooling, the solvers' linear algebra, and the evaluator the console runs on. It is built to give MATLAB's answers, including the ones people don't expect, and those answers were measured against MATLAB rather than assumed.

Matrix Complex Polynomial tf · ss · zpk Time series Symbolic Function handle
Command Window ICoreMath answering
  1. >>> -2^2-4 # Integer

    ^ binds tighter than unary minus. The precedence table is MATLAB's.

  2. >>> ~1 + 11 # Integer

    ~ is a unary operator, so this reads as (~1) + 1.

  3. >>> numel(0:0.1:1)11 # Integer

    Eleven, not ten. The colon count follows MATLAB's floating-point rule, and the range ends on 1 exactly.

  4. >>> round(1.005, 2)1.01 # Double

    It rounds the decimal you typed, not the double just below it.

  5. >>> sind(180)0 # Integer

    An exact zero, where sin(pi) gives 1.22465e-16. No multiple of 90° ever reaches the radian routine.

  6. >>> (-8)^(1/3)1 + 1.73205i # Complex

    The principal root. The answer leaves the real line where MATLAB's does.

  7. >>> sqrtm([1 1; 0 1])[[1, 0.5], [0, 1]] # Matrix of Double

    Schur-based, so it is exact on a defective matrix, where an eigenvector-based root would return noise.

  8. >>> inv([1 2; 2 4])[[Inf, Inf], [Inf, Inf]] # Matrix of Double

    A singular matrix gives MATLAB's answer, not a plausible-looking number.

  9. >>> a = 2; f = @(x) a*x; a = 5; f(3)6 # Integer

    A handle captures by value at the moment it is made, the way MATLAB's does.

  10. >>> syms x; expand((x+1)^3)3*x + 3*x^2 + x^3 + 1 # Sym

    Exact symbolic algebra, printed in MATLAB's order as well.

Lines10
Answers as MATLAB gives them10
Core-MATLAB parity cases1,075 / 1,075

Every line above is a real headless run, ICoreBlocks --console "<line>", copied from its output with the kind tag the console prints. Each is a case where the obvious implementation gives a different number from MATLAB. These rules were measured against MATLAB R2026a and written down, not guessed.

Matrix functions
990
in the console's core MATLAB, with help and completion for each
Core-MATLAB parity
1,075/ 1,075
cases whose answers agree with MATLAB's in the last full run
MATLAB toolboxes
8
control, signal, statistics, symbolic, optimization and more
Places Eigen is used
1
this module, and nowhere else
01 · The types

Every value knows what it is.

The console prints the kind of every answer, and each kind is a real type in this module, not a display format applied to a matrix. A transfer function stays a transfer function through every operation.

# Matrix of Double

Matrix

The workhorse: arithmetic, decompositions, reductions over all entries or along an axis, and the linear-algebra solvers.

>>> [4 -2; 1 3] \ [1; 2]
[[0.5], [0.5]]
# Complex

Complex

For the places where the answer is not real. Square roots, logs and fractional powers promote to complex exactly where MATLAB's do.

>>> (-8)^(1/3)
1 + 1.73205i
# Polynomial

Polynomial and spline

Roots and fitting. A spline's degree is lowered automatically when there are too few points to support it.

>>> polynomial([1 2 3])
x^2 + 2x + 3
# Time Series

Time series

A signal with its own time base. This is what a run, or a step, hands back.

>>> y = step(tf([1],[1 1]), 5, 6)
Time Series (6 samples, t = 0 .. 5)
# Transfer Function · State Space

tf and ss

Built with MATLAB's constructors and displayed the way MATLAB displays them, including tf('s'), which is an improper model.

>>> s = tf('s');
>>> G = 1/(s+1)
G = 
    1
  -----
  s + 1
# Zero Pole Gain

zpk

The zeros, poles and gain are kept as themselves. The fraction is worked out only when asked for, so the factored model and the fraction always give the same numbers.

>>> zpk([], [-1 -2], 1)
       1
  -----------
  (s+1) (s+2)
# Sym

Symbolic

The console's own computer-algebra engine: an expression tree with exact rational arithmetic. There is no third-party CAS underneath.

>>> syms x; int(x^2)
x^3/3
# Function Handle

Function handle

The same text in MATLAB and in the console, so it crosses the MATLAB bridge as it stands.

>>> f = @(x) x.^2
f = @(x) x.^2
02 · The control-systems tooling

From plant to plot.

The same objects a block holds are the ones you type. Block reduction, the solver and the analysis tools all call into this module.

  • Discretizec2d, d2c and d2d with zoh, foh, tustin and impulse. d2c inverts a zero-order hold with a matrix logarithm, so a plant with a pole at the origin comes back as it was.
  • ConvertState space to transfer function and back, and to and from zpk.
  • Respondstep, impulse, initial and lsim, with samples spaced by MATLAB's own time-grid rule.
  • Analysebode, margin, rlocus, pole, dcgain. Design with place, lqr and pidtune.
  • MergeSeries, parallel and feedback. This is what block reduction is built on.
>>> G = tf([1],[1 2 1]); c2d(G, 0.1)
  0.004679 z + 0.004377
  ---------------------
  z^2 - 1.81 z + 0.8187
Sample time: 0.1 seconds
Discrete-time transfer function.
A double pole at s = −1, held at 0.1 s. Zero-order hold is the default, as it is in MATLAB.
>>> feedback(tf([1],[1 1]), 1)
    1
  -----
  s + 2
Continuous-time transfer function.
Unity negative feedback around 1/(s+1). The closed-loop pole moves from −1 to −2.
Bode · G = 1/(s+1)²
A Bode magnitude and phase plot of a double-pole transfer function A Bode magnitude and phase plot of a double-pole transfer function
G = tf([1],[1 2 1]) declared in the console, then read straight out of the variables space by the analysis tool - magnitude falling at 40 dB per decade and phase settling at −π, as a double pole at s = −1 should.
03 · And the rest

Toolbox-sized, in one module.

Calculus, optimization, signal processing, statistics, curve fitting and aerospace sit beside the core. Many of them are transcribed from the MATLAB routine they answer for, rather than approximated by a general-purpose one.

Calculus

Quadrature and ODEs

integral(@(x) x.^2, 0, 1) gives 0.333333, with MATLAB's adaptive Gauss–Kronrod rule behind it.

integralode45trapzexpm
Symbolic

Exact answers

int(1/(x^2 + 3*x + 2)) gives log(x + 1) - log(x + 2). The partial fractions are exact, so the answer isn't a numerical fit.

diffintfactorlaplace
Signal processing

Filters and spectra

FFTs, digital filter design, zero-phase filtering and spectral estimates. The FFT backend is bundled, so there is no external dependency.

fftbutterfiltfiltpwelch
Statistics

Tests and distributions

Hypothesis tests that keep MATLAB's distinctions, such as ttest(x, y) being paired and ttest2 being unpaired, so the p-value is the one you meant.

ttestttest2anova1histcounts
Optimization

Solvers

Linear and quadratic programmes, and fminsearch, which rounds each step where MATLAB rounds so the two stay together to the last digit.

linprogquadprogfminsearch
Fitting

Curves and interpolation

Polynomial fits, spline and pchip sharing one evaluator, and MATLAB's linear interp1 as the default.

polyfitinterp1splinepchip
04 · One place, deliberately

Everything that needs a number asks the same module.

These are not scattered helpers collected under one heading. The console, the solver, the block library and the code generators all compute through ICoreMath. That is why they agree about what a matrix is and what an operation means, and why an expression you can type into the console is one the SDK can evaluate.

Command windowthe expression evaluator Block library806 blocks Analysis toolsBode, root locus Simulationstate space, discretization Code generatorsten targets MATLAB bridgeone dictionary ICoreMath types · control · numerics Eigen stays inside
Honest edges

Where it says no.

When the right answer isn't available, the console refuses and gives the reason, rather than returning a number that looks right and isn't.

  • Matched pole-zeroc2d(sys, Ts, "matched") is refused, because the routine under that name was a zero-order hold, and returning one under MATLAB's name would be wrong in a way nothing on screen shows. Use zoh, foh, tustin or impulse.
  • Cells and string arraysThere are no cell arrays, and text is a single char row, so {1, 2} and strsplit are refused by name.
  • Random streamsrng(seed) makes a run repeatable, but its stream is not MATLAB's, so the same seed draws different numbers from MATLAB.
  • Decomposition signsQR, SVD, LU and eigenvectors are conventions, not unique answers. Where MATLAB and Eigen choose differently, as in schur's eigenvalue order, the difference is recorded rather than hidden.
  • Symbolic print orderA few expressions print their terms in a different order from MATLAB, such as the output of collect. The value is the same; only the order of the terms differs.

The details are in the manual: the core MATLAB catalog  ·  control systems  ·  symbolic math  ·  what the solver will and will not do

See also: Eigen, wrapped  ·  Python and MATLAB, both  ·  MATLAB and Simulink, both ways

Get started

See it run on your own model.

Download the application from the customer portal, or read the documentation first - the manual, a page for every block, and the full command reference are public.