Using optimization variable with wiener2

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?

 Risposta accettata

Walter Roberson
Walter Roberson il 12 Ago 2021
That cannot be done with Optimization Variables; you would need to switch to Solver-Based Optimization.

Più risposte (0)

Categorie

Prodotti

Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by