フィルターのクリア

simulink input signal from function

5 ビュー (過去 30 日間)
Antonio Tricarico
Antonio Tricarico 2024 年 1 月 8 日
回答済み: Fangjun Jiang 2024 年 1 月 8 日
Hello everybody,
I have developed a Simulink model for an electric powertrain: at first, I wrote a script to calculate vehicle power request and saved it as a .mat to import it into a signal editor block in the Simulink model. Though, my teacher wants me to insert the script for power calculation directly through a function block in the model...now the problem is that the block output should be a 960" long signal but it is not considered as a temporal signal (each calculated value associated to each second in the simulation) but as a 1x960 vector...how can I transform the function output from a vector to a signal to be given in input for the simulation?
Thanks for any help.

採用された回答

Fangjun Jiang
Fangjun Jiang 2024 年 1 月 8 日
You can use your script in a "MARLAB Function Block" but need to do some adjustments. Understand this. Your current script does the offline calculation once and calculated all the signal values for each of the 960 seconds. The "MATLAB Function Block" is executed at every simulation step. So ideally, you make the function calculate one signal value for every second, and make it sync with the simulation clock.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrepare Model Inputs and Outputs についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by