optimization of simulink parameters using genetic algorithm in the optimization toolbox

3 views (last 30 days)
i am trying to optimise two parameters (x and k) in a simulink model using ga(genetic algorithm) solver in the optimization toolbox.my objective function is minimising the squared error between the output from simulink and observed value.Following is the objective function ; function F =tracklsqga(v,input) x=v(1) k=v(2) opt=simset('solver','ode5','SrcWorkspace','Current') sim('model',[0 240],opt) F=(observed-outflow2.signals.values).^2
But it shows error message as "Invalid matrix-format variable specified as workspace input in 'model/From Workspace'. The matrix must have two dimensions and at least two columns. Complex signals of any data type and non-double real signals must be in structure format. The first column must contain time values and the remaining columns the data values" i have tried the 'input'(an input to simulink model to be given from workspace) in array format and structure format.but the same error message is coming.can anybody help me?

Answers (0)

Community Treasure Hunt

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

Start Hunting!