How to define the objective function to solve an optimization problem with Matlab?
Show older comments
Dear all,
I have an optimization problem, but I don’t know how to define the minimization function properly and which optimization algorithm available in Maltab is the most appropriate.
I had previously used fminsearch to curve fitting a fractional derivative model to experimental data and it was OK. However, now I don’t have an analytical equation and so I don’t know how to define the minimization function of even if it is possible to use the Matlab Optimization toolbox for that.
I have the experimental vibration spectrum of hundreds of machines and their division by a pattern spectrum, which I would call Failure spectrum from now on. The aim of the optimization is to define a limit function that will lead to X % of defective machines. The limit is not constant in frequency, it is the following function:
Ylim, 1=< x <= xini
Ylim/ratio, xini< x <= xini+wide
Ylim, xini+wide< x <= 500
where the variables to be optimized are Ylim, ratio, xini and wide.
The code I have written does the following:
- Initialize the variables and obtain the limit function.
- Compare the first failure spectrum with the limit function, if the failure spectrum is bigger than the limit at any frequency count 1 and continue with the next failure spectrum.
- Calculate the error between the define defective by the user and the defective obtain with the actual limit function. This error is the minimized function.
I have first tried with frmincon to restrict the value of the variables, but the value of the variables is all the time the same and nothing is optimized. I have then tried with fminsearch and patternsearch and the same happened. There is no a “Matlab error” but nothing is optimized. I know little about optimization and I am not sure if am defining in a wrong way the minimization function or this problem cannot be solved in this way. I would deeply appreciate any help or clarification.
This is part of the code where the error is calculate ( 2 and 3 steps of the code):
[r,c]=size(Failure_spec_matrix);
cont=cell(1,c);
for i=1:c
Filure=Failure_spec_matrix(:,i);
location=find(Filure>Limit_spec');
count(1,i)={location};
end
count_total=find(~cellfun(@isempty,cont));
error=(length(count_total)*100/c)-defective_defined;
Thank you very much in advance!!
Accepted Answer
More Answers (0)
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!