Simulink Frequency Responseのロゴ

Simulink Frequency Response

組織人気
matlab
simulink-frequency-response

frestimateを使用して、Simulinkモデルから周波数応答を推定します。モデルの線形化ではなくシミュレーションから周波数応答を取得する場合に使用します。

Add to TypingMind

概要

公開者matlab
リポジトリsimulink-agentic-toolkit
スキル名simulink-frequency-response
スター
1.2K
フォーク
112
同梱ファイル
1
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 1個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    matlabがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Simulink Frequency Response」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/matlab/simulink-agentic-toolkit/tree/main/skills-catalog/control-systems/simulink-frequency-response
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/matlab/simulink-agentic-toolkit.git /tmp/simulink-agentic-toolkit
mkdir -p .claude/skills
cp -r /tmp/simulink-agentic-toolkit/skills-catalog/control-systems/simulink-frequency-response .claude/skills/simulink-frequency-response
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでSimulink Frequency Responseを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にSimulink Frequency Responseを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Simulink Frequency Responseは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Simulink Frequency Response Estimation

Obtain frequency response data from Simulink models using simulation-based estimation (frestimate) when analytical linearization is not viable or as a validation tool.

When to Use

  • Model contains hard discontinuities (PWM, switching, relay, quantizer) that linearize to zero or NaN
  • Validating a linear model against a simulation based linearization of a Simulink model
  • Estimating frequency response directly from simulation data

When NOT to Use

  • Model linearizes cleanly with linearize — use simulink-linearize instead
  • Working with measured data only (no Simulink model) — use System Identification Toolbox

Workflow

1. Define I/O  →  2. Choose Signal  →  3. Configure  →  4. Estimate  →  5. Fit (optional)
   (linio)          (PRBS/Sinestream)    (constraints)    (frestimate)     (tfest)

Stage 1: Define I/O Points

Determine I/O points for the estimation 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.

    matlab
    io = [linio(sprintf("%s/InputBlock", mdl), 1, "input"); ...
          linio(sprintf("%s/OutputBlock", mdl), 1, "output")];
  2. Root-level Inport/Outport blocks exist → use model_read at root scope (depth "0") to identify root-level Inport/Outport blocks, then define linio at those blocks (trace Outport blocks upstream to their source for the output linio point).

Case B — Cannot determine IO points:

If none of the above apply → do not guess. Ask the user which signals to use as estimation input and output. Present the available blocks/signals from the model to help them decide.

Pre-flight checks (before choosing a signal):

  1. Verify I/O points are NOT at blocks without output ports (Outport, Terminator, Scope)
  2. Check sample times at I/O points — both must match the perturbation signal rate, or both must be continuous
  3. Consider whether the model has time-varying source blocks (Step, Ramp, Signal Generator, etc.) that could drive the system away from its steady-state operating point during estimation. If so, see Disabling Time-Varying Sources below.

Stage 2: Choose Perturbation Signal

Decision (follow in order):

  1. Is broadband estimation sufficient (most cases)? → Use frest.PRBS (DEFAULT)
  2. Is the model discrete? → Use frest.PRBS with Ts matching the I/O sample time, or frest.createFixedTsSinestream if per-frequency data needed
  3. Do you need precise magnitude/phase at specific frequencies? → Use frest.Sinestream (continuous) or frest.createFixedTsSinestream (discrete)

Prefer frest.PRBS — it estimates the full frequency range in a single simulation. Sinestream simulates each frequency sequentially and is significantly slower for broadband estimation.

Stage 3: Configure the Signal

PRBS (default):

matlab
in = frest.PRBS(Ts=Ts, Amplitude=0.01, Order=10, NumPeriods=2);

If the I/O signal is discrete, set Ts to match the signal sample time. If continuous, set Ts to a value that provides sufficient temporal resolution. Choose Amplitude small enough to stay in the linear regime of saturations/nonlinearities.

Why PRBS first? A single PRBS simulation estimates the full frequency range at once. Sinestream simulates each frequency sequentially — for 30 frequencies with 8 periods each, this can take 10-100x longer. Use Sinestream only when you need precise per-frequency data (e.g., gain/phase margin at specific crossover frequencies).

Sinestream (continuous models):

matlab
in = frest.Sinestream(Frequency=logspace(-1, 2, 30), Amplitude=0.01);
in.NumPeriods = 8;
in.SettlingPeriods = 3;

The filtering constraint: NumPeriods - SettlingPeriods >= 3 when ApplyFilteringInFRESTIMATE = "on" (default). Violating this throws an error at estimation time.

Fixed-Ts Sinestream (discrete models):

matlab
Ts = 0.01;
in = frest.createFixedTsSinestream(Ts, {wmin, wmax});
in.Amplitude = 0.01;
in.NumPeriods = 8;
in.SettlingPeriods = 3;

Use the cell syntax {wmin, wmax} for the frequency range — this auto-selects frequencies that are valid integer divisors of the sampling frequency. Do NOT pass an explicit frequency vector:

matlab
% CORRECT — cell syntax auto-selects valid frequencies
in = frest.createFixedTsSinestream(Ts, {wmin, wmax});

% WRONG — explicit vector (most frequencies violate integer-multiple constraint)
in = frest.createFixedTsSinestream(Ts, logspace(-1, 2, 30));  % Error

When to use Sinestream instead of PRBS:

  • PRBS results are too noisy (high variance at individual frequencies)
  • Need precise magnitude/phase at specific frequencies
  • Very nonlinear system where broadband excitation causes intermodulation

Check simulation time: Always verify that the signal duration is practical before launching the estimation:

matlab
tFinal = getSimulationTime(in);
fprintf("Estimated simulation time: %.1f seconds\n", tFinal);

If tFinal is too big compared to Ts, use larger lower frequency bounds for estimation.

Stage 4: Estimate

Determine where to start the experiment. Choose one:

SituationApproach
Model ICsSkip — frestimate uses model initial conditions
Steady-state trimoperspec → configure → findop
Need snapshot from simulationfindop(mdl, tSnapshot)
Operating point knownoperpoint object → configure
matlab
sysest = frestimate(mdl, op, io, in, opts);

op and opts are optional arguments. If op is not provided, the experiment will start at model initial conditions.

opts is a frestimateOptions object. Pass it when time-varying sources need to be disabled (see below).

The result is an frd (frequency response data) object.

Stage 5: Fit Parametric Model (Optional)

Only perform this step if a parametric model (transfer function, state-space, zpk) is required. If the goal is frequency response data only (e.g., Bode plot, gain/phase margins from frd), stop after Stage 4.

Convert the non-parametric frd to a parametric model:

matlab
sysFit = tfest(sysest, np, nz);
fprintf("Fit: %.1f%%\n", sysFit.Report.Fit.FitPercent);

Disabling Time-Varying Sources

Time-varying source blocks (Step, Ramp, Signal Generator, etc.) can drive the model away from its steady-state operating point during estimation. When this happens, the system does not remain near the operating point and the estimated response is unreliable — gain estimates can be off by orders of magnitude while executing without error.

When to disable sources:

  • The model contains source blocks (other than the perturbation input) that change value during the estimation simulation
  • Estimation results are implausible or don't match an expected linearization
  • The time-domain response does not reach steady state at individual frequencies

How to identify and disable them:

Use frest.findSources to identify time-varying source blocks in the estimation path, then set BlocksToHoldConstant so they are held at their initial value during estimation:

matlab
srcblks = frest.findSources(mdl, io);
opts = frestimateOptions;
opts.BlocksToHoldConstant = srcblks;
sysest = frestimate(mdl, io, in, opts);

Note: frest.findSources requires model compilation. The perturbation input is not affected by BlocksToHoldConstant.

The Fallback Pattern

When linearize returns zero, follow this sequence:

matlab
% 1. Try linearize
sys = linearize(mdl, io);
if dcgain(sys) == 0
    % 2. Disable time-varying sources if present
    srcblks = frest.findSources(mdl, io);
    opts = frestimateOptions;
    opts.BlocksToHoldConstant = srcblks;
    % 3. Fall back to frestimate with PRBS
    in = frest.PRBS(Ts=Ts, Amplitude=0.01, Order=10, NumPeriods=2);
    sysest = frestimate(mdl, io, in, opts);
    % 4. Fit parametric model
    sysFit = tfest(sysest, 2);
end

Do NOT use manual block substitution (replace_block) as a workaround for zero linearization. The frestimate approach is generalizable to any discontinuous model without requiring domain knowledge of each block's averaged equivalent.

Key Functions

FunctionPurposeAvailable From
frestimateEstimate frequency response from SimulinkR2009b
frest.findSourcesIdentify time-varying source blocks to hold constantR2010b
frestimateOptionsOptions including BlocksToHoldConstantR2010a
frest.PRBSPseudorandom binary sequence signalR2020a
frest.SinestreamMulti-sine perturbation signalR2009b
frest.createFixedTsSinestreamFixed sample time sinestreamR2009b
getSimulationTimeCheck signal duration before runningR2012a
tfestFit transfer function to frequency dataR2012a
ssestFit state-space model to frequency dataR2012a

Common Mistakes

MistakeWhy It FailsCorrect Approach
Not disabling time-varying sourcesSource blocks drive the model away from its steady-state operating point, producing unreliable estimates without errorUse frest.findSources to identify sources, set opts.BlocksToHoldConstant to disable them
Using replace_block to work around zero linearizationRequires domain knowledge of averaged equivalents; doesn't generalizeUse frestimate with PRBS — works for any discontinuous model
Setting NumPeriods=5, SettlingPeriods=3 with filtering onViolates NumPeriods - SettlingPeriods >= 3 constraintUse NumPeriods=8, SettlingPeriods=3 or disable filtering
Output linio at different rate than input signalfrestimate rejects multi-rate I/O configurationsPlace both I/O points at blocks matching the signal's sample time
Only using frest.Sinestream (ignoring PRBS)Sinestream is much slower — simulates each frequency sequentiallyStart with frest.PRBS for broadband estimation; use Sinestream only when frequency-by-frequency precision is needed
Large perturbation amplitude near saturationsDrives system into nonlinear regime, corrupting estimationChoose amplitude small relative to saturation limits (e.g., 1-5% of range)

Conventions

  • Always: Consider whether time-varying sources could drive the model from its operating point — use frest.findSources and BlocksToHoldConstant to disable them
  • Prefer: frest.PRBS for broadband estimation — faster than Sinestream for most workflows
  • Always: Use cell syntax {wmin, wmax} with frest.createFixedTsSinestream
  • Always: Ensure NumPeriods - SettlingPeriods >= 3 when filtering is enabled
  • Always: Place I/O points at rate-compatible blocks for multi-rate models
  • Always: Call getSimulationTime — Validate signal duration before running. Long simulations relative to max solver step size should prompt redesign.
  • Prefer: frestimate over manual block substitution for discontinuous models
  • Prefer: tfest or ssest for fitting parametric models to frd results
  • Prefer: Small amplitude — Keep perturbation small enough to stay in the locally linear regime (typically 1-5% of operating range).
  • Never: Use replace_block as a general linearization workaround

Copyright 2026 The MathWorks, Inc.


同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Simulink Frequency Response」では何ができますか?

frestimateを使用して、Simulinkモデルから周波数応答を推定します。モデルの線形化ではなくシミュレーションから周波数応答を取得する場合に使用します。

TypingMindでSimulink Frequency Responseを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Simulink Frequency Responseはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにSimulink Frequency Responseをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/matlab/simulink-agentic-toolkit/tree/main/skills-catalog/control-systems/simulink-frequency-responseを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Simulink Frequency Responseを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Simulink Frequency Responseで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSimulink Frequency Responseを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Simulink Frequency Response」は無料ですか?

matlabがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇