Simscape - changing resistance values according to computed in matlab loops "for" arrays

조회 수: 6 (최근 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.
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.

답변 (1개)

Cristian Garcia Milan
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.
  댓글 수: 1
Bogdan Miroschnitschenko
Bogdan Miroschnitschenko 2020년 5월 25일
Thanks a lot, it works, but I have at the end this table, so these are results for the last resistance value.
How could I save results for the whole loop?
The code is now
for m =1:length(moving)
set_param('Schaltung/R_t13_t21','R','R_t13_t21(m)')
simOut = sim('Schaltung')
end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Magnetic Elements에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by