Simscape - changing resistance values according to computed in matlab loops "for" arrays
4 次查看(过去 30 天)
显示 更早的评论
Hi all, i have builded in Simulink a magnetic equivalent circuit for some device. Some resistances here are constant but some are variable. All resistances I have computed in Matlab, the variable values with using of "for" loops. Now I need to link the computed values with according resistances in the Simulink model. I want to do it automatically, it means I want to compute hundreds of possible resistance values depending on some geometrical parameters and then to solve the equivalent circuit for each step of "for" loops.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/293864/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/293865/image.jpeg)
Due to the nonlinearity of steel permeance it will be good also to include an itterative computation of resistances and currents. But first I need at least to solve this question for a computed resistances without itteration.
If somebody know how to do it - it will help me a lot and I will be very gratefull to you.
0 个评论
回答(1 个)
Cristian Garcia Milan
2020-5-22
Inside your for loop you can use
set_param('YOUR MODEL/R_t13_t21','R',your_values(i))
and in order to run your model you can use either
or you can use
set_param('YOUR MODEL','SimulationCommand','start')
If you take the first option, you can use
simOut = sim('YOUR MODEL')
and the output is collected as a variable inside the for loop.
Hope it helps.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Magnetic Elements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!