How can I export my Simulink electrical circuit into a Matlab function?
5 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simscape Electrical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!