Can I link optimization code with Simulink file?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I want to link my m.file with simulink file to cut the complex equations and codes.
I just want to know, Can I define my specific parameter as variables and link the file with smulink?
cost =zeros(size(popmatrix,1),1);
for ii= 1:size(popmatrix)
P=popmatrix(ii,2);
I=popmatrix(ii,1);
LowerBand = [-400 -400];
UpperBand = [400 400];
Xls=.19;
Rs=.003;
Xd=1.8;
Rfd=.000929;
..
sim('PMSM')
0 comentarios
Respuestas (2)
Fangjun Jiang
el 11 de Mayo de 2023
In the most common case, you run the code above, all the variables will be created in the base workspace. If your Simulink model PMSM uses any of these variables in its block diagram, then, Yes, the Simulink model will use the updated variable value for its simulation. In your word, they are "linked".
12 comentarios
Morteza Moslehi
el 18 de Mayo de 2023
Movida: Fangjun Jiang
el 19 de Mayo de 2023
@Fangjun Jiang thank you so much to give your time to fix my code.
But, my problem was in the simulink, I had to put Fobj for controlling. Thank you so much for your kind again.
Morteza Moslehi
el 12 de Mayo de 2023
2 comentarios
Fangjun Jiang
el 19 de Mayo de 2023
"descibe a block as objective function", "make a circle in the simulink"
I am sorry I couldn't understand these. Now I think I didn't understand your question at all.
Ver también
Categorías
Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!