🧰 MATLAB / Simulink:導入と活用ガイド
🧰 MATLAB / Simulink: Getting Started Guide
本資料は EduController教材 において、
Simulinkを用いた制御ブロックの可視化・設計・Cコード生成 を行うための導入ガイドです。
This guide introduces visualization, design, and C code generation of control blocks using Simulink
within the EduController educational materials.
目的は、制御理論の学習に加えて、モデルベース設計(Model-Based Design) の視点を養うことです。
In addition to learning control theory, the goal is to cultivate the perspective of Model-Based Design (MBD).
✅ 本教材におけるSimulinkの役割 / Role of Simulink in This Material
用途 / Use Case | 対象章 / Target Chapters | 目的 / Purpose |
---|---|---|
PID設計と可視化 / PID Design & Visualization | Part01, Part05 | ブロック図で制御構造と応答を直感的に理解 / Intuitively understand control structures and responses |
状態空間モデル構成 / State-Space Modeling | Part02 | 行列ベース制御設計(A,B,C,D)を視覚化 / Visualize matrix-based control design (A,B,C,D) |
Cコード生成 / C Code Generation | Part05 | Simulink Coder による HDL 前段階のコード出力 / Generate C code for HDL preparation via Simulink Coder |
FSMモデリング / FSM Modeling | Part09 | Stateflow 連携による FSM 設計(応用) / FSM design using Stateflow (advanced) |
🛠️ 環境準備 / Environment Setup
📦 必要ソフトウェア / Required Software
- MATLAB(推奨:R2021以降 / Recommended: R2021 or later)
- Simulink(必須 / Required)
- Simulink Coder(Cコード生成に必要 / Needed for C code generation)
- オプション / Optional: Stateflow, Embedded Coder
🎓 教育版・学生版ライセンス / Educational & Student Licenses
MATLAB は教育機関を通じて 学生版ライセンス や オンキャンパスライセンス が提供されています。
MATLAB provides Student Version and Campus-Wide Licenses through educational institutions.
詳細は 📘 MathWorks公式:学術利用 / MathWorks Academic Licensing を参照してください。
📂 同梱モデル一覧 / Included Models
ファイル名 / Filename | 内容 / Description |
---|---|
pid_simulink_example.slx |
比例積分制御モデル(応答確認付き) / PID control model with response observation |
state_space_example.slx |
状態空間モデル(A,B,C,D構成)+ステップ応答 / State-space model (A,B,C,D) + step response |
model_to_code.md |
Simulink Coder によるCコード生成手順 / Procedure for generating C code with Simulink Coder |
📘 操作手順:PID制御モデル例
📘 Example Procedure: PID Control Model
pid_simulink_example.slx
を開く / Open the model- ブロック図上で
Kp
やKi
を調整 / AdjustKp
andKi
in the block diagram - Scope ブロックでステップ応答を観察 / Observe the step response in the Scope block
- 必要に応じて「シミュレーション → コード生成」(要 Simulink Coder) / Generate C code via Simulation → Code Generation (requires Simulink Coder)
🔄 HDL連携構想(参考) / HDL Integration Concept (Reference)
Simulink Coder により生成した Cコードは、
SoC_DesignKit_by_ChatGPT/c_to_hdl/
に渡して
ChatGPTによる C→Verilog 変換 に活用可能です。
C code generated by Simulink Coder can be passed to
SoC_DesignKit_by_ChatGPT/c_to_hdl/
for C→Verilog conversion using ChatGPT.
💡 例 / Example: conversion_prompt.md
に貼り付けて HDL化を依頼 / Paste into conversion_prompt.md
and request HDL conversion.
📖 参考リンク / References
📄 ライセンス / License
教材・コード・図表の性質に応じたハイブリッドライセンスを採用
Hybrid licensing based on the nature of materials, code, and diagrams.
項目 / Item | ライセンス / License | 説明 / Description |
---|---|---|
コード / Code | MIT License | 自由に使用・改変・再配布可 / Free to use, modify, and redistribute |
教材テキスト / Text Materials | CC BY 4.0 | 著者表示必須 / Attribution required |
図表・イラスト / Figures & Diagrams | CC BY-NC 4.0 | 非商用利用のみ可 / Non-commercial use only |
外部引用 / External References | 元ライセンスに従う / Follow the original license | 引用元を明記 / Cite the original source |
MIT & Hybrid License © 2025 Shinichi Samizo