Simulink Linearize logo

Simulink Linearize

OrganizationPopular
matlab
simulink-linearize

Linearize Simulink models. Use when obtaining linear time invariant or linear parameter varying models from Simulink models.

Overview

Publishermatlab
Repositorysimulink-agentic-toolkit
Skill namesimulink-linearize
Stars
1.2K
Forks
112
Bundled files
1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by matlab on GitHub. Read the source before you install it.

Installation

Install the Simulink Linearize AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/matlab/simulink-agentic-toolkit/tree/main/skills-catalog/control-systems/simulink-linearize
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/matlab/simulink-agentic-toolkit.git /tmp/simulink-agentic-toolkit
mkdir -p .claude/skills
cp -r /tmp/simulink-agentic-toolkit/skills-catalog/control-systems/simulink-linearize .claude/skills/simulink-linearize
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Simulink Linearize in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Simulink Linearize on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Simulink Linearize is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Simulink Linearization

Extract linear time invariant (LTI) or linear parameter varying (LPV) models from Simulink using linearize and related APIs from Simulink Control Design.

When to Use

  • Obtaining a linear model (tf, ss, zpk) from a Simulink model
  • Batch linearization across operating points and parameter variations
  • Building LPV models with ssInterpolant
  • Debugging linearization results (zero gain, unexpected dynamics)
  • Extracting multiple LTI systems with a single model compile

When NOT to Use

  • Frequency response estimation from simulation — use simulink-frequency-response for frestimate-based fallback
  • No Simulink model is involved

Workflow

The linearization pipeline has four stages. Not every task requires all stages.

1. Define I/O Points 2. Operating Point  →  3. Linearize  →  4. Debug  
    (root level/linio)   (findop/operspec)     (linearize)     (advisor) 

Stage 1: Define Linearization I/O Points

Determine I/O points using this decision sequence. Use the first case that applies:

Case A — IO points can be inferred from prompt or model context:

Use the first sub-case that matches:

  1. User specifies explicit I/O signals or blocks (e.g., "from r to y") → define linio points. All linio points must reference a block's output port. If a candidate block has no output ports (Outport, Terminator, Scope) → trace upstream to find the source block and port with model_read.

    matlab
    io = [linio(sprintf("%s/InputBlock", mdl), 1, "input"); ...
          linio(sprintf("%s/OutputBlock", mdl), 1, "output")];
  2. User targets a specific block or subsystem (e.g., "linearize the Controller") → Use the block path as the io argument signaling linearize to perform open-loop linearization of the block

    matlab
    io = sprintf("%s/Controller", mdl);
  3. Model has existing linearization points → io = getlinio(mdl); — use if non-empty.

  4. Root-level Inport/Outport blocks exist → omit linio. The linearize command will linearize about the model's root-level I/Os. Use model_read at root scope (depth "0") to confirm root-level Inport/Outport blocks exist.

Case B — Cannot determine IO points:

If none of the above apply → do not guess. Ask the user which signals to use as linearization inputs and outputs. Present the available blocks/signals from the model to help them decide.

Block path rules:

  • Use sprintf for block names containing special characters (newlines, commas):
    matlab
    blkPath = sprintf("%s/Integrator,\nSecond-Order", mdl);
    io = linio(blkPath, 1, "output");
    
    sub.Name = sprintf("%s/My\nBlock",mdl);
    sub.Value = replacement_lti;
    
    sys = linearize(mdl, io, sub);  

Stage 2: Operating Point

Determine where to linearize. Choose one:

SituationApproach
Model ICsSkip — linearize uses model initial conditions
Steady-state trimoperspec → configure → findop(mdl, opSpec, findopOptions(DisplayReport="off"))
Need snapshot from simulationlinearize(mdl, tSnapshot)
Batch over parameter gridArray of operspec objects → findop(mdl, specArray, params)
Operating points knownArray of operpoint objects → configure

For batch workflows, use copy to create the operating point array:

matlab
% assign varied variable to workspace
myvar = 0;
% create base spec
opBase = operspec(mdl);
opBase.States(1).Known = true;
% define param to vary
nPts = 5;
params.Name = "myvar";
params.Value = linspace(-pi, pi, nPts);
for i = nPts:-1:1
    opArray(i) = copy(opBase);
    opArray(i).States(1).x = params.Value(i);
end
ops = findop(mdl, opArray, params, findopOptions());

Stage 3: Linearize

matlab
sys = linearize(mdl, OPTIONAL_ARGS);

Each input argument to linearize is optional (beside mdl).

matlab
sys = linearize(mdl, io, op, params, blocksub, opts);
ArgumentRequiredBehavior if ProvidedBehavior if Omitted
mdlYModel to linearizeNA
ioNlinearize at I/O pointsLinearize at root level I/Os
opNOperating points OR times to linearizeLinearize at model IC
paramsNVary parameters for each linearizationNo variation
blocksubNUser specified block linearizationsBlocks have Simulink linearization
optsNUser specified linearizeOptionsDefault options

Multi-rate models default to the LCM sample time. Use the SampleTime option to specify linear model sample time:

matlab
opts = linearizeOptions(SampleTime=0);
sys = linearize(mdl, io, opts);

Batch linearization for LPV:

matlab
opts = linearizeOptions(BatchConsistency="on", StoreOffsets="system");
sysArray = linearize(mdl, io, ops, params, opts);
lpvSys = ssInterpolant(sysArray);

When StoreOffsets="system", offsets are embedded in each model of the array. Call ssInterpolant(sysArray) with no offset argument.

Define SamplingGrid if one is not generated from linearize (params argument is omitted).

Multiple transfer functions (single compile) with slLinearizer:

matlab
sllin = slLinearizer(mdl);
addPoint(sllin, ["r", "y", "e", "u"]);
T = getIOTransfer(sllin, "r", "y");
S = getSensitivity(sllin, "e");
L = getLoopTransfer(sllin, "u", sign);

Stage 4: Debug (Linearization Advisor)

Use when linearization returns zero gain or unexpected results.

matlab
opts = linearizeOptions(StoreAdvisor=true);
[sys, ~, info] = linearize(mdl, io, opts);
advisorResult = advise(info.Advisor);

Always capture the output of advise — calling without an output argument launches the UI.

Inspect problematic blocks:

matlab
problematic = find(advisorResult, linqueryHasDiagnostics());
for i = 1:numel(problematic.BlockDiagnostics)
    diag = problematic.BlockDiagnostics(i);
    fprintf('%s: %s\n', diag.BlockPath, join(string(diag.DiagnosticMessages), newline));
end

Common advisor findings and resolutions:

  • "linearization has zero input/output pair" → Change operating point, or use block substitution if reasonable to do so
  • Block with hard discontinuity (PWM, relay, dead zone, non-floating point signals) → Analytical linearization will be zero. Fall back to frequency response estimation
  • Reference diagnostic message for other potential fixes

Convert if needed

matlab
tfSys = tf(sys);      % Transfer function
zpkSys = zpk(sys);    % Zero-pole-gain

LPV Validation

For LPV models, simulate and compare against Simulink:

matlab
[y, t] = lsim(lpvSys, u, tVec, x0, paramTrajectory);

Key Functions

FunctionPurposeAvailable From
linearizeLinearize Simulink modelR2006a
linearizeOptionsConfigure linearization algorithmR2006a
linioDefine linearization I/O pointsR2006a
getlinioGet I/O points defined in modelR2006a
operpointCreate operating point with manual state valuesR2006a
operspecCreate operating point specificationR2006a
findopTrim or snapshot operating pointR2006a
slLinearizerBatch/multi-transfer-function interfaceR2013b
getIOTransferClosed-loop transfer function from slLinearizerR2013b
getSensitivitySensitivity function from slLinearizerR2013b
getCompSensitivityComplementary sensitivity from slLinearizerR2013b
getLoopTransferOpen-loop transfer from slLinearizerR2013b
adviseRun linearization advisorR2017b
ssInterpolantBuild gridded LPV/LTV modelR2023a

Common Mistakes

MistakeWhy It's WrongCorrect Approach
Using linmod, linmod2, linmodv5 or dlinmodLegacy API, limited featuresUse linearize or slLinearizer
Not using advise when result is zeroLeads to trial-and-errorEnable StoreAdvisor="on", call result = advise(info.Advisor)
Using Outport/Terminator/Scope as linio pointBlocks without output ports cannot be specified as linearization I/O — errorsTrace upstream to find the source block that feeds it
opSpec(i) = opSpecBase in a loopoperspec is a handle class — this aliases, not copiesUse opArray(i) = copy(opBase)
Omitting BatchConsistency in batchState ordering may vary across operating pointsAlways set BatchConsistency="on"
Calling ssInterpolant without offsetsLPV model requires offsetsUse StoreOffsets="system"
Calling advise without output argLaunches Model Linearizer UI (hangs in non-interactive sessions)Always use result = advise(advisor)
Repeated linearize calls for different I/OsRecompiles model each timeUse slLinearizer for single compile
Manual trial-and-error for zero resultsWastes time, may not find root causeUse advisor diagnostics — identify the problematic blocks

Conventions

  • Always: Capture the output of advise() to prevent UI launch
  • Always: Use copy(opSpec) for batch operating point arrays, not assignment
  • Always: Set BatchConsistency="on" for batch linearization destined for LPV
  • Always: Set StoreOffsets="system" when building LPV models with ssInterpolant
  • Prefer: slLinearizer when extracting multiple transfer functions from one model
  • Never: Place linio on blocks without output ports (Outport, Terminator, Scope) — trace upstream to find the source block
  • Never: Use linmod, linmod2, linmodv5 or dlinmod — these are legacy

Copyright 2026 The MathWorks, Inc.


Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Simulink Linearize AI skill do?

Linearize Simulink models. Use when obtaining linear time invariant or linear parameter varying models from Simulink models.

Why use Simulink Linearize on TypingMind?

Because you install it once and use it with any model. Simulink Linearize is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Simulink Linearize in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/matlab/simulink-agentic-toolkit/tree/main/skills-catalog/control-systems/simulink-linearize. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Simulink Linearize?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Simulink Linearize?

As many as you like. As long as a model supports skills, you can use Simulink Linearize with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Simulink Linearize AI skill free?

It is published on GitHub by matlab. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇