본문으로 건너뛰기
cccskills
무료GitHub에 공개

simulink-linearize

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

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md9.9 KB
  • manifest.yaml491 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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.


리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Author or upgrade Model Advisor checks for Simulink and System Composer models. Covers the full lifecycle: guideline authoring, check specification, Model Advisor check implementation, and qualification testing. Use when creating new checks (edit-time, standard batch, config-parameter, auto-fix), converting legacy StyleOne/StyleTwo/StyleThree checks to modern DetailStyle, creating a guideline for modeling, enforcing a modeling rule, or testing/qualifying a check. Triggers on any modeling constraint (e.g., "blocks shall...", "signals must match...", "parameters shall be set to...").

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matlab/simulink-agentic-toolkit1.2천2026년 10월 15일 업데이트

Synthesize new waveforms from scratch for Simulink inports using createInputDataset. Use ONLY when the user asks to generate, create, or synthesize signals (step, ramp, sine, chirp, pulse, noise) to populate a Dataset for External Inputs or Signal Editor. Covers timeseries and timetable formats with correct data type, interpolation, units, and dimensions. Also covers function-call and trigger inport timing setup. Do NOT use when the user wants to load, import, or read existing data from files (MAT, CSV, spreadsheet) — even if that data will be used as model input. Do NOT use for running simulations or plotting outputs.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matlab/simulink-agentic-toolkit1.2천2026년 10월 15일 업데이트

Common steps for building multi-layer system architecture models using System Composer. Use when implementing architecture models or when interacting with interface dictionaries, allocation sets, stereotypes, and requirements for architecture components.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matlab/simulink-agentic-toolkit1.2천2026년 10월 15일 업데이트

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

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matlab/simulink-agentic-toolkit1.2천2026년 10월 15일 업데이트

Use this skill when the user asks to check Simulink model compliance against a standard (MISRA, MAB, JMAAB, ISO, DO, IEC, EN, CERT C/CWE, AUTOSAR, Simulink Code Inspector (SLCI)), wants to run Model Advisor checks, or needs a compliance report with fix suggestions. For JMAAB/MAB, supplement deterministic checks with agentic review of uncheckable guidelines.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matlab/simulink-agentic-toolkit1.2천2026년 10월 15일 업데이트

Guide users through creating and managing .satk/block-policy.json for controlling which blocks the agent can use, which are excluded, and which block parameters the agent should not modify. Use when setting up block usage policy for a project.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matlab/simulink-agentic-toolkit1.2천2026년 10월 15일 업데이트

matlab의 스킬 모두 보기

이 스킬의 문제 신고