I am going to solve an inverse problem, AX=b
, using conjugate gradient method in MATLAB. I want to use pcg
function in MATLAB and as I know instead of matrix A
I can use a function.
I have a function for example afun
which has some entries. In the documents, I have seen that the afun
function is entered in pcg
function without entries, however, when I do the same, the error not enough input arguments
appears. I use a code like this:
b = afun(ent1,ent2);
x = pcg(@afun,b,tol,max_iter);
How should I use my function in pcg
?