MCPInstall
matlab avatar

simulink-linearize

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

Installs
0
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/matlab/simulink-agentic-toolkit --skill simulink-linearize
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads simulink-linearize automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

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.

    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

    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):
    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:

% 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

sys = linearize(mdl, OPTIONAL_ARGS);

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

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:

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

Batch linearization for LPV:

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:

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.

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:

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

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

LPV Validation

For LPV models, simulate and compare against Simulink:

[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.


FAQ

What does the simulink-linearize skill do?

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

How do I install simulink-linearize?

Run npx skills add https://github.com/matlab/simulink-agentic-toolkit --skill simulink-linearize in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/simulink-linearize/ (personal) or .claude/skills/simulink-linearize/ (project).

Which AI agents can use simulink-linearize?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is simulink-linearize safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains simulink-linearize?

It is published by matlab in matlab/simulink-agentic-toolkit. It has 0 recorded installs.

More from matlab/simulink-agentic-toolkit

View all →
matlab avatar

building-simulink-models

matlab/simulink-agentic-toolkit

Builds and edits Simulink, System Composer, Stateflow, and Simscape models. Use when modifying model structure, parameters, ports, connections, or Stateflow chart internals.

AI & Agents185 installs
matlab avatar

simulating-simulink-models

matlab/simulink-agentic-toolkit

Configures Simulink simulations non-destructively using SimulationInput objects — parameter overrides without modifying the model, batch sweeps via parsim, custom input signals via Dataset, and simulation data retrieval via logsout. Use when running sim()/parsim() with setVariable, setBlockParameter, setExternalInput, or when performing parameter sweeps and multi-run analysis. Not needed for one-shot simulations without configuration.

Data & Databases156 installs
matlab avatar

testing-simulink-models

matlab/simulink-agentic-toolkit

Tests Simulink models using either ephemeral Gherkin-based tests (modeltest) for quick validation or persistent tests (Simulink Test API) authored from requirements or behavioral specs. Requires Simulink Test.

Testing & QA124 installs
matlab avatar

specifying-plant-models

matlab/simulink-agentic-toolkit

Specify plant models for closed-loop simulation: system specs, architecture, build plans, validation plans. Use when creating, updating, or reviewing plant model specifications, planning plant model architecture, or planning plant model validation.

matlab avatar

specifying-mbd-algorithms

matlab/simulink-agentic-toolkit

Specify algorithms for Model-Based Design: system specs, architecture specs, implementation plans, test plans. Use when creating specifications for controllers, signal processing, diagnostics, estimators, or other algorithms authored in Simulink, Stateflow, System Composer, or MATLAB Function blocks.

AI & Agents90 installs
matlab avatar

generate-requirement-drafts

matlab/simulink-agentic-toolkit

Generates draft requirements from Simulink models. Use when drafting or updating requirement artifacts from a model. Prefers Requirements Toolbox (.slreqx) when available; falls back to structured YAML.

AI & Agents80 installs

Popular productivity & automation skills

View category →
vercel-labs avatar

agent-browser

vercel-labs/agent-browser

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

OfficialProductivity & Automation1.6M installs
open.feishu.cn avatar

lark-doc

open.feishu.cn

飞书云文档(Docx / Wiki)内容操作:读取、创建、编辑文档,插入或下载图片附件,以及操作思维笔记。用户提供文档 URL/token(包括 doubao.com 的 /docx/、/wiki/)时使用;按 URL 路径/token 而非域名路由;/page/ 是妙搭应用,非飞书云文档。文档内嵌资源按读取参考中的统一规则分流。独立评论操作走 lark-drive;随正文读取评论使用 docs +fetch。表格或 Base 内部数据操作不在本 skill。

open.feishu.cn avatar

lark-shared

open.feishu.cn

Use for lark-cli setup/auth tasks: auth login/status/logout, user vs bot identity, business-domain permissions (--domain, including all/docs/drive), missing scopes, revoking authorization, or handling notice JSON.

open.feishu.cn avatar

lark-drive

open.feishu.cn

飞书云空间(云盘/云存储):管理 Drive 文件和文件夹,包含上传/下载、创建文件夹、复制/移动/删除、查看元数据、查询权限设置、评论/权限/订阅、标题、版本、飞书文档密级标签(secure labels)和本地文件导入。用户需要整理云盘目录、处理云空间资源 URL/token、判断链接类型/真实 token/标题,或导入 Word/Markdown/Excel/CSV/PPTX/.base 为 docx/sheet/bitable/slides 时使用;doubao.com 云空间 URL/token 也按资源路径和 token 路由,不回退 WebFetch。不负责:文档内容编辑(走 lark-doc)、表格/Base 表内数据操作(走 lark-sheets/lark-base)、知识空间节点/成员管理(走 lark-wiki)、原生 Markdown 文件读写/patch/diff(走 lark-markdown)。

open.feishu.cn avatar

lark-base

open.feishu.cn

飞书多维表格(Base)操作:建表、字段、记录、视图、统计、公式/lookup、表单、仪表盘、应用模式(BaseApp/AppMode 页面与组件)、Workspace 目录、workflow、角色权限、模板中心(多维表格模板分类/列表/搜索);遇到 Base/多维表格/bitable、BaseApp/AppMode、/base/ 或 /app/ 链接时使用。BaseApp 不走 lark-apps;文件导入/导出转 lark-drive,认证/授权转 lark-shared。

open.feishu.cn avatar

lark-im

open.feishu.cn

飞书即时通讯:收发消息和管理群聊。发送和回复消息、搜索聊天记录、管理群聊成员、上传下载图片和文件、管理表情回复、发送应用内/短信/电话加急、发送和处理交互卡片(Interactive Card)、监听卡片按钮回调(card.action.trigger)。当用户需要发消息、查看或搜索聊天记录、下载聊天中的文件、查看群成员、搜索群、创建群聊或话题群、管理标记数据、管理 Feed 置顶(添加/移除/查询置顶会话)、管理标签数据、处理卡片回调时使用。