Using optimization variable with wiener2
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with Optimization Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!