How can I export my Simulink electrical circuit into a Matlab function?

5 ビュー (過去 30 日間)
Juan
Juan 2023 年 9 月 13 日
編集済み: Joel Van Sickel 2023 年 9 月 18 日
I've drawn the following electrical circuit and it's working really well. The thing is that I need to test multiple discrete values of some of the parameters like Load, Ground Resistance, and Length of conductors.
Ideally, I wish to define a function in MATLAB which as input it takes something like Rg, P1, Q1, L and as output it would give me the values of voltages and currents. It would be a [V1, V2, I1, I2] = my_circuit(Rg, P1, P2, Q1, Q2]
Ignore the shortcircuit block.
I don't even know if it possible. Can anyone point me on the right direction?
Thanks in advance

回答 (1 件)

Joel Van Sickel
Joel Van Sickel 2023 年 9 月 18 日
編集済み: Joel Van Sickel 2023 年 9 月 18 日
The easiest approach to this would be to utilize the sim() command. This lets you set parameters, run a simulation and then get results. You can then take it to the next step and do things like generating code from the model but the sim() command is the quickest easierst way to do it and doesn't require any of the coder or compiler products.

カテゴリ

Help Center および File ExchangeSimscape Electrical についてさらに検索

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by