Update M-script parameter value Continuously based on Workspace Data fed by a Simulink Model
이전 댓글 표시
I am simulating a Simulink model for n seconds run from a Matlab script. In the Simulink model, I have a parameter that is being saved in the workspace. Now, based on the workspace data, I want to continuously update a parameter in m-file and feed the updated value in the Simulink model. After having an if else statement in the m-file, I see my target parameter is not being updated in the Simulink model.
For example, in my Simulink model, I have a DC bus current, Idc is being generated. I have the Idc stored in the workspace using the “To Workspace” block. Now, based on the magnitude of Idc, which is saved in the workspace, I want to update the switching frequency, fsw in m-script CONTINUOUSLY. Then, I want the the Simulink model, which is being simulated, should get the updated value of fsw continuously from the m-script.
For example, I tried this way but it does not help!
if Idc < 100
fsw = 100e3;
else
fsw = 200e3;
end
This code does not update the value of fsw continuously in the Simulink model. Any help would be appreciated!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 General Applications에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!