How to write function for SIMULINK model and it's variables

Hi;
I have an electrical model in SIMULINK (consist of resistances and capacitances) and I want to write a function for it in MATLAB and extract the output signal data when I call different values for the model variables (resistances and capacitances). Variables were defined in model workspace (model explorer) as a MATLAB variables with initial value but I don’t know how to define output of my function that extract signal data during change my variables value.
Thanks for guiding me.

回答 (1 件)

Sam Chak
Sam Chak 2022 年 5 月 12 日

0 投票

Hi Azin
For example only. Explore it.
function [V, tau] = stats(R, C)
% Calculates the voltage and the time constant or the values in resistor and capacitor.
V = formula1(R, C);
tau = formula2(R, C);

カテゴリ

ヘルプ センター および File ExchangeModeling についてさらに検索

質問済み:

2022 年 5 月 12 日

回答済み:

2022 年 5 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by