Bfd matlab mcd

From Sonder4/STM32-BFD-Kit · View interactive version

Bfd matlab mcd is an AI agent skill from the GitHub repository Sonder4/STM32-BFD-Kit. Use when building a closed STM32-to-Matlab workflow for J-Link HSS data capture, system identification, PID/LQR/MPC tuning, Kalman parameter estimation, or Matlab/Simulink code-generation feedback loops.

How to use this skill

Skill file

BFD Matlab MCD Workflow

Self-Improvement Loop (Required)

Purpose

Use this skill for the full loop:

  1. capture synchronized MCU scalar variables with J-Link HSS;
  2. store the run as an experiment dataset with manifest and compact summaries;
  3. run Matlab analysis without sending full CSV files into the AI context;
  4. use Matlab results for system identification, PID/LQR/MPC candidates, Kalman noise parameters, or MCD codegen checks;
  5. feed hardware evidence back into the next Matlab or firmware iteration.

Precheck

python3 ./.codex/skills/bfd-project-init/scripts/bootstrap.py --project-root . --mode check
/home/xuan/matlab/bin/matlab -batch "disp(version)"

If Matlab is installed elsewhere, pass --matlab-bin <path> or set MATLAB_BIN.

Capture A Dataset

python3 BFD-Kit/scripts/bfd_experiment.py capture-hss \
  --elf "${STM32_ELF}" \
  --symbol motor_cmd \
  --symbol motor_speed \
  --duration 2.0 \
  --period-us 1000 \
  --output-dir logs/experiments \
  --experiment-name motor_step_001 \
  --stimulus "step command"

The command writes capture.csv, capture.csv.meta.json, manifest.json, summary.json, summary.md, and Matlab templates under matlab/. Terminal output is compact by default.

Summarize Existing Data

python3 BFD-Kit/scripts/bfd_experiment.py summarize \
  --dataset-dir logs/experiments/motor_step_001

Use summaries for AI review. Do not paste full CSV files unless the task explicitly requires raw samples.

Run Matlab Analysis

python3 BFD-Kit/scripts/bfd_experiment.py matlab-run \
  --dataset-dir logs/experiments/motor_step_001 \
  --analysis system-id \
  --matlab-bin /home/xuan/matlab/bin/matlab

matlab-run defaults to --matlab-backend auto. In auto mode, BFD-Kit first tries the official MathWorks matlab-mcp-core-server; if the MCP server is unavailable or fails before a Matlab script runs, it records the MCP error under matlab_out/matlab_mcp_error.log and falls back to matlab -batch.

Use explicit MCP mode when validating an agentic Matlab/Simulink session:

python3 BFD-Kit/scripts/bfd_experiment.py matlab-run \
  --dataset-dir logs/experiments/motor_step_001 \
  --analysis mcd-check \
  --matlab-backend mcp \
  --mcp-server /path/to/matlab-mcp-core-server \
  --mcp-matlab-root /home/xuan/matlab \
  --satk-root /path/to/simulink-agentic-toolkit

The MCP path uses detect_matlab_toolboxes, check_matlab_code, and run_matlab_file when exposed by the server. If --satk-root is provided, it also runs satk_initialize through evaluate_matlab_code before the dataset analysis file, enabling Simulink Agentic Toolkit model-query and MBD workflows in the same session.

Supported --analysis values:

Hard Rules

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.