I have a Simulink model and my aim is to minimize the following
cost_function = rms(Signal_A) + 0.5 rms(Signal_B)
In order to do so I created the following function ( and stored in the current folder with the name my_rms.m)
function objective = my_rms(Signal_A,Signal_B)
objective = rms(Signal_A)+0.5*rms(Signal_B);
Therefore I start the Simulink Design Optimization.
Step1. I create a parameters set where model parameters, max and min are specified.
Step2. I create 2 new "Requirement Source": one for Signal_A and one for Signal_B.
Step3. I create a new Time Domain Custom Requirement (using the followings)
- Name: Minimize_Response
- Specify Function "Type": Minimize the fucntion output
- Specify Function "Function": @my_rms
- Select Signals and System to Bound: I tick the 2 signals I have previously specified (Signal_A and Signal_B)
At this point I start the optimization and the following error messages come up (see attached picture). The description
Error1 : The function handle passed to the optimize command encountered an error when evaluated with a parameter vector.
Error2: Evaluating the custom requirement 'Minimize_Response' threw an error. The error stack contains a more detailed description of the cause.
Error3: Undefined function 'conj' for input arguments of type 'struct'.
I am almost sure that step 1 and 2 are right as I followed a webseminar on the Mathworks website in doing them, so very likely something in the step 3 is wrong
Can anyone help me with that?
Thanks in advance