The background to my problem can be found here: Iteratively solving a sparse, ill-conditioned system
I have a function that now works well. When I give it test data, I recover the expected result. However, when I give it real data, lsqr converges to a totally valid solution that is not the one I want.
Briefly: the solution should be the DFT of two bin-centered sinusoids in the presence of white noise. However, the solution I'm getting is one of the two sinusoids, white noise, but also multiple harmonics of those sinusoids, which are undesired.
lsqr function allows me to supply a function handle to perform the
A*x multiplication. Now I need to generate some kind of function that performs the matrix multiplication, but somehow pushes the algorithm away for test solutions with multiple tones.
How can I do this effectively? My first thought was to return a bogus result when the shape of the guess is not appropriate, but that seems like it might break the algorithm...