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

matlab-simulink-modeling

MATLAB and Simulink workflow for creating, inspecting, modifying, simulating, validating, and exporting .slx models. Use for Simulink, Stateflow, Simscape, model-based design, parameter sweeps, signal logging, requirements, and simulation automation. On this machine, Simulink tasks should be visual-first: open the model in a visible Simulink window before doing substantial automated modeling or simulation so the user can watch the process.

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

설치 방법 보기

포함된 파일(3)

  • SKILL.md7.1 KB
  • scripts/mas_model_check.m2.8 KB
  • tests/test_model_check.m1.0 KB

SKILL.md(원문)

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

MATLAB Simulink Modeling

Use this skill for model-based design and simulation workflows.

First Checks

  1. Confirm the product with the precheck, not by guessing a license string:

    r = mas_precheck('toolbox', 'Simulink Coder');   % installed + licensed, with reason
    

    license('test', X) takes a FEATURE name, and passing the display name returns 0 even when the product is licensed (Deep_Learning_Toolbox → 0 while Neural_Network_Toolbox → 1 on R2026a). The verified map lives in ../matlab-runner/references/toolbox-feature-map.md. An earlier revision of this file pointed at masacc.availability, which does not exist anywhere — removed.

  2. Prefer an official MATLAB MCP auto session tied to a visible MATLAB/Simulink desktop before substantial edits. Use load_system, open_system, and set_param(modelName,"ZoomFactor","FitSystem") so the user can see the model.

  3. Audit topology before editing: blocks, lines, solver config, sample times, logged signals.

  4. Prefer existing model architecture and naming.

  5. Save a copy before destructive edits to user models.

Visible Workflow Requirement

The user specifically wants to watch Simulink modeling and simulation, not only receive final artifacts. Default to this sequence unless the user explicitly asks for headless-only execution:

  1. Bring up a visible MATLAB/Simulink window first.
  2. For an existing model, run:
    load_system(modelPath)
    open_system(modelName)
    set_param(modelName,"ZoomFactor","FitSystem")
    
  3. For a new model, call new_system, save it under artifacts/models/ or the project model folder, then immediately open_system before adding the rest of the blocks.
  4. During automated construction, save and refresh the model at meaningful milestones so the user can see progress: plant, controller, feedback path, logging/scopes, and final layout.
  5. During simulation and tuning, open Scope blocks or MATLAB figures and update/plot each run so the user can see response changes.
  6. If the model window does not appear, do not assume success. Verify the visible window title if possible and retry by focusing MATLAB's command window and executing open_system there.
  7. Still export .slx, data, figures, logs, and validation reports for reproducibility after the visible demonstration.

MCP Requirement

For this repository and machine:

  1. Use official MATLAB MCP auto-mode control for model creation, block editing, simulation, and tuning by default.
  2. Let MCP reuse an existing shared session when present, otherwise allow it to start visible MATLAB automatically.
  3. Do not replace visible MCP-driven Simulink work with silent batch execution unless the user explicitly asks for headless execution.
  4. In reports, clearly state that the modeling path was MCP-driven and note any exact blocker if a required MCP action could not be completed.

Build and Modify

Use Simulink APIs rather than manual UI steps:

  • new_system, open_system, load_system, save_system
  • add_block, delete_block, add_line, delete_line
  • get_param, set_param, find_system
  • Simulink.SimulationInput for parameter sweeps
  • signal logging or To Workspace blocks for measurable outputs

If SimuBridge MCP tools are available, prefer them for topology audit, library search, block editing, workspace variables, and waveform analysis.

Simulation Acceptance

A model task passes only when:

  • The model diagram updates/compiles after editing, for example with set_param(modelName,"SimulationCommand","update") or an equivalent compile/update check.
  • The model loads without errors.
  • Solver and stop time are explicit.
  • Simulation completes to the requested stop time.
  • Required signals are logged and nonempty.
  • Generated .slx, .mat, .png, or report artifacts are saved.

Post-Edit Self Check

After writing or modifying a Simulink model, run a self-check before reporting completion:

  1. Save the model.
  2. Update/compile the diagram with set_param(modelName,"SimulationCommand","update").
  3. Fix unconnected ports, solver/sample-time errors, algebraic loops, missing variables, and block parameter errors found by the update step.
  4. Run the requested simulation or a smoke simulation to the target stop time.
  5. Verify logged signals are nonempty and finite.
  6. If code generation is in scope, continue into Simulink Coder / Embedded Coder after simulation passes, then verify generated files exist and are nonempty.
  7. If any compile, simulation, or code generation step cannot pass because a toolbox, support package, compiler, or hardware target is missing, state the exact blocker and save the current runnable model/artifacts for the next attempt.

External Tool Hang Triage

When a Simulink build waits on external tools, diagnose the boundary instead of repeatedly rerunning slbuild:

  • If the model simulates but build hangs, inspect generated build logs, STM32CubeMX.log, temporary script files, and active java.exe, compiler, or CubeMX processes.
  • For STM32 builds, verify the .ioc is bound through STM32CubeMX.ProjectFile; a CubeMX installation alone is not enough.
  • Check whether the project path contains non-ASCII characters, spaces, or very long segments. Copy to a short ASCII scratch path such as C:\codex_build\project_name for one isolation run.
  • Distinguish direct tool availability from MATLAB registration. MATLAB may fail even when a desktop shortcut launches the tool.
  • Record the exact phase that passed: diagram update, simulation, code generation, CubeMX generation, compiler build, or binary creation.

Risk Checklist

Watch for:

  • Algebraic loops.
  • Unit/sample-time mismatches.
  • Hidden Goto/From or Data Store dependencies.
  • Unconnected ports.
  • Solver stiffness and step-size drift.
  • Simscape initialization failures.
  • Stateflow unreachable states or missing default transitions.

Reporting

Always report model path, stop time, solver, changed blocks, logged signals, and validation artifacts.

Verify A Model By Level, Not By Hope

A saved .slx is not a working model. Phase 3B.2 generated a converter model that simulated happily while applying a zero duty for the first period, because a Unit Delay defaults to 0. Grade the model instead of asserting it works:

r = mas_model_check('matlab/boost/models/boost_avg.slx', struct('tStop',0.01));
r.level   % L0 missing | L1 loads | L2 updates | L3 simulates with finite signals

L3 is the first level that means anything numerically. Toolboxes are checked with mas_precheck('toolbox', ...), never by calling license with a product name. tests/test_model_check.m pins a real model at L3 and a missing file at L0.

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

MATLAB code generation and deployment workflow for MATLAB Coder, Simulink Coder, Embedded Coder, GPU Coder, HDL Coder, fixed-point conversion, MEX validation, and embedded deployment readiness. Use whenever the user asks to generate C/C++/CUDA/HDL/code, deploy algorithms, or validate generated code.

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

wzyn20051216/matlab-agent-skills262026년 10월 21일 업데이트

MATLAB workflow for control systems, system identification, robust control, MPC, Simulink Control Design, parameter tuning, constrained optimization, and numerical validation. Use whenever the user asks for controllers, transfer functions, state-space models, tuning, identification, optimal control, or solver-based engineering.

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

wzyn20051216/matlab-agent-skills262026년 10월 21일 업데이트

MATLAB data analysis workflow for tables, timetables, statistics, fitting, optimization-assisted analysis, visualization, report artifacts, and reproducible paper figures. Use whenever the user asks MATLAB to analyze data, plot results, fit models, process CSV/Excel/MAT files, or reproduce figures.

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

wzyn20051216/matlab-agent-skills262026년 10월 21일 업데이트

MATLAB agentic workflow router. Use this whenever the user asks for MATLAB, Simulink, .m/.mlx/.slx work, toolbox-driven engineering, paper reproduction, simulation, code generation, data analysis, control, robotics, signal/image/AI workflows, or wants an end-to-end automated MATLAB task with validation. For Simulink tasks on this machine, default to a visible workflow: open MATLAB/Simulink windows first so the user can watch modeling, simulation, tuning, and plotting progress.

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

wzyn20051216/matlab-agent-skills262026년 10월 21일 업데이트

MATLAB robotics and autonomy workflow for ROS Toolbox, Robotics System Toolbox, Navigation Toolbox, UAV Toolbox, sensor fusion, trajectory planning, simulation, and reproducible robot experiments. Use for ROS/ROS 2 bags, robot models, path planning, SLAM, state estimation, and autonomy prototyping.

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

wzyn20051216/matlab-agent-skills262026년 10월 21일 업데이트

Run MATLAB tasks from Codex with reliable MCP-based execution, logs, artifacts, toolbox inventory, smoke tests, and reproducible validation. Use whenever MATLAB code, .m/.mlx scripts, MATLAB tests, local toolbox probing, or command-line automation is needed.

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

wzyn20051216/matlab-agent-skills262026년 10월 21일 업데이트

wzyn20051216의 스킬 모두 보기

이 스킬의 문제 신고