Optimization for Simulink block parameter

Hello,

First of all appreciation for the development of such a nice toolbox…

Recently, I am facing issue while using this toolbox with Matlab/simulink. I want to utilize cvx toolbox in code and want to optimize a variable in simulink.

For this I created a function where I simulated the model and called/used this function
in minimize objective. The design variable was set as the parameter of the block.

Now I observed that the objective function was called once so do the simulation for design variable was run for only one time. And I assumed this was the reason for not accurate results.

Now my questions are:

  1. Would some one guide me how to optimize a variable in simulink while code is in matlab. ( at each step it runs the simulink and check for the results)
  2. And how my current approach is not appropriate or be improved.

Anxiously waiting for the reply.

Kind regards

I think CVX for Simulink has the current thinking regarding mixing CVX and Simulink.

Thank you Mark. I found a way around it.

That way around it is posted by @Sepideh_Kianbakht at CVX for Simulink

Thank you for the swift reply.