"Unrecognized function or variable" error due to unrecognized function, which is indeed defined.
Show older comments
I got the following error message:
Unrecognized function or variable 'Afunc'.
Error in update_xf>@(x)Afunc(x,CGparams) (line 80)
Afunc = @(x)Afunc(x, CGparams);
Error in CG (line 4)
r = rhs - Afunc(x);
Error in update_xf (line 82)
[xf{i}, noit_cg]=CG(xf{i}, Afunc, (1/sigma2^2)*rhs{i}, CG_MAX_ITER, CG_TOL);
But the function Afunc is defined at the end of file update_xf:
function Ax = Afunc(x, params)
Ax = (1/params.sigma2^2)*conv2(conv2(x,params.k,'same').*params.mask, flip(params.k),'same');
Ax = Ax + params.weights.*x;
end
The call to CG is done in update_xf as:
Afunc = @(x)Afunc(x, CGparams);
[xf{i}, noit_cg]=CG(xf{i}, Afunc, (1/sigma2^2)*rhs{i}, CG_MAX_ITER, CG_TOL );
And in CG to Afunc as:
function [x_new,it]=CG(x, Afunc, rhs, CG_MAX_ITER, CG_TOL)
r = rhs - Afunc(x);
This error happens to me in version 2019b but it is working OK in 2010b
Answers (0)
Categories
Find more on Get Started with MATLAB 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!