Skip to content
Back to skills

Simscape Diagnose Simulation Error

ASecurity

Triage Simscape simulation errors and solver warnings and dispatch to the appropriate diagnostic surface. Covers transient/runtime failures — min step size violations (stiffness, parasitics, event-time), transient initialization failures, and index reduction (\"Cannot solve for one or more variables\"), including errors that appear only with run-time parameters. Use whenever a Simscape model fails to simulate or warns while simulating, even if the user doesn't quote the message and it only sh...

  • 1,443 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 20, 2026
ai-agentsapi

Works with

  • api

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add matlab/simulink-agentic-toolkit --skill simscape-diagnose-simulation-error --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Simscape Diagnose Simulation Error?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Simscape Diagnose Simulation Error
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/matlab-simscape-diagnose-simulation-error/badge)](https://www.skillsdirectory.com/skills/matlab-simscape-diagnose-simulation-error)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: simscape-diagnose-simulation-error
description: "Triage Simscape simulation errors and solver warnings and dispatch to the appropriate diagnostic surface. Covers transient/runtime failures — min step size violations (stiffness, parasitics, event-time), transient initialization failures, and index reduction (\"Cannot solve for one or more variables\"), including errors that appear only with run-time parameters. Use whenever a Simscape model fails to simulate or warns while simulating, even if the user doesn't quote the message and it only shows up after you run the model or read a warnings log; load it before attempting a fix."
license: https://www.mathworks.com/content/dam/mathworks/license/pmrl/license.md
metadata:
  author: MathWorks
  version: "0.3.1"
---

Diagnose the simulation error for a Simscape model. In the code below,
`modelName` is the name of that model.

In your answer, quote the tool results your diagnosis rests on (e.g. the
compiled sample times, or the stiffest row with its time, λ and coefficient).
Don't re-run fixes the user says they already tried.

## When to Use

When a Simscape model hits "min step size" violations (stiffness, parasitics, event-time), "transient initialization failed to converge", "Cannot solve for one or more variables, including dynamic variable derivatives", or "stepsize control for transient solve".

## When NOT to Use

- Errors in custom .ssc source (parse, unit, equation count, validation): use `simscape-write-language-code`.
- Building or editing a model that has no simulation error: use `simulink-build-model`.

## Setup

The diagnostic API is bundled with this skill as MATLAB packages under
`scripts/+simscape/+agentic`. Use `evaluate_matlab_code` with `project_path`
set to this skill's `scripts/` folder so MATLAB resolves the
package-qualified calls (e.g. `simscape.agentic.statistics_viewer_run(...)`).
Don't `addpath` `scripts/`. Because `project_path` also makes `scripts/` the
current folder, a model that uses `.ssc` files from its own folder fails to
compile (`Unrecognized function or variable`): `addpath` the model's folder first.

Keep warnings on when you check a fix (use `evalc` to shorten the output
instead): after `warning('off','all')`, Simulink records no warnings, so a fix
that didn't work looks like it did. If the script errors, they stay off for the
rest of the session.

Don't run tight-tolerance "reference" sims to check accuracy: on stiff models
they can take many minutes.

## Triage: Which path to follow?

Messages on large models can run to thousands of characters, with the key phrase buried after long lists of variables or components. Don't read them end-to-end: scan for the keywords below and stop at the first match. Then open the file for that path and follow its steps in order:

- If it mentions **"Event iteration failed to converge within the iteration limit"** → the cause is mode chattering, not a discontinuity or index problem. This skill does not apply. Report to the user that the failing component's mode transition logic is entering an infinite loop and needs review.
- If it mentions **"min step size"** at an event time (Step block firing, mode change), OR **"transient initialization failed to converge"** mid-simulation (not at t=0) → start with the **Discontinuous Inputs** path: [references/discontinuous_inputs_path.md](references/discontinuous_inputs_path.md)
- If it mentions **"high stiffness"**, **"min step size"**, or **"step size control"** and is NOT clearly tied to an event → start with the **Stiffness** path: [references/stiffness_path.md](references/stiffness_path.md)
- If it mentions **"transient initialization failed to converge"** at **t=0**, **"cannot solve for one or more variables"**, or **"problems possible for transient initialization"** → start with the **Index Reduction** path: [references/index_reduction_path.md](references/index_reduction_path.md)
- If none of these match (e.g. an undefined variable or a dimension mismatch) → no path applies. Report the error to the user and fix it directly, without starting a path.

----

Copyright 2026 The MathWorks, Inc.

----

Files in this skill

  • SKILL.md20.9 KB
  • manifest.yaml1.9 KB
  • references/initialization_analyzer.md6.5 KB
  • references/nominal_values.md4.3 KB
  • references/sps_input_jumps.md2.2 KB
  • references/statistics_viewer.md7.2 KB
  • references/stiffness_analyzer.md3.5 KB
  • references/variable_scaling_analyzer.md6.4 KB
  • references/variable_viewer.md8.6 KB
  • scripts/+simscape/+agentic/InitializationAnalysis.p17.3 KB
  • scripts/+simscape/+agentic/ModelStatistics.p16.7 KB
  • scripts/+simscape/+agentic/VariableScaling.p11.2 KB
  • scripts/+simscape/+agentic/initialization_analyzer_run.p12.1 KB
  • scripts/+simscape/+agentic/nominal_values_get_nominal_values.p2.5 KB
  • scripts/+simscape/+agentic/nominal_values_is_nominal_enabled.p1.8 KB
  • scripts/+simscape/+agentic/nominal_values_set_nominal_enabled.p1.8 KB
  • scripts/+simscape/+agentic/nominal_values_set_nominal_values.p2.8 KB
  • scripts/+simscape/+agentic/parasiticParameters.p4.4 KB
  • scripts/+simscape/+agentic/private/simscape_debug_progress.p2.6 KB
  • scripts/+simscape/+agentic/private/simscape_debug_simplify_unit.p2.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.