I have a problem, listed below, where x is the optimization variable. It essentially corresponds to the filter window in wiener2 (where m=n). The function calculateExtractionSharpness has the wiener2 filter called within.
x0 = 10;
xl = 1;
xu = 100;
nvar = 1;
x = optimvar('x',1,'LowerBound',xl,'UpperBound',xu);
prob = optimproblem;
optimFunc = @(filterWind) calculateExtractionSharpness(chart,filterWind,1);
prob.Objective = optimFunc(x);
options = optimoptions('intlinprog',"Display","iter");
sol = solve(prob,x0,'Options',options)
However, I get an error that states that:
Error using ones
Size inputs must be numeric.
Error in wiener2 (line 48)
localMean = filter2(ones(nhood), g) / prod(nhood);
Error in untitled>extractDisplacementCurve (line 40)
chart = wiener2(chart,[filterWind filterWind]);
Error in untitled>calculateExtractionSharpness (line 86)
curve = extractDisplacementCurve(chart,filterWind,filterOptions);
Error in untitled (line 32)
optimFunc = @(filterWind) calculateExtractionSharpness(chart,filterWind,1);
Is there a way to solve this issue or is optimization not possible with this type of solver?

 채택된 답변

Walter Roberson
Walter Roberson 2021년 8월 12일

0 개 추천

That cannot be done with Optimization Variables; you would need to switch to Solver-Based Optimization.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

제품

릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by