How to get a variable value in the gain block. This variable value is defined in a Matlab function block.

27 ビュー (過去 30 日間)
In simulink model, I have a gain block and I want the value of this gain block to be a variable with the name x. The value of x changes over time and the formula for this is defined in a Matlab Function block. But whe the simulation is run it says that x is an undefined function or variable.

回答 (2 件)

Les Beckham
Les Beckham 2020 年 3 月 22 日
To do this, I would use a Multiply block instead of a gain block. Make x an output from your Matlab function block. Connect that output signal (x) to one port of the Multiply block and connect the signal to which you want to apply the gain to the other port on the Multiply block.

Pruthviraj Mane
Pruthviraj Mane 2020 年 12 月 22 日
You first have to load the file declaring the variable into the workspace. You can just click on the error symbol and it will give suggestion to fix the error by loading the file into the workspace.

カテゴリ

Help Center および File ExchangeSignal Import and Export についてさらに検索

製品


リリース

R2014b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by