Fitting one line to another

2 次查看(过去 30 天)
Glenn
Glenn 2012-8-23
I am attempting to do some basic noise cancelation by using a reference signal. I know there are more elegant solutions but this should work:
t = linspace(-2*pi,2*pi,200);
signal = sin(t)'; %original signal
sigma = 0.07; %noise standard deviation
noise = sigma*randn(size(signal)); %noise
rover = signal + noise;
base = noise;
hold off;
figure(1)
plot(rover,'color','red');
hold on;
plot(base,'color','blue');
E = [ones(size(base)) base ];
ls_solution = lsqr(E,rover ,1e-6,20)
fit = E*ls_solution;
solution = rover -fit;
plot(fit,'color','green');
plot(solution,'color','cyan');
Here is the output: lsqr converged at iteration 2 to a solution with relative residual 0.99.
ls_solution =
-0.0030
1.5903
While it seems to work conceptually the convergence is so bad that it doens't remove much of the noise. Why does this only go to iteration 2? The tolerance is set to 1-e6 and the max iterations are 20.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Physics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by