Effacer les filtres
Effacer les filtres

Fitting one line to another

2 vues (au cours des 30 derniers jours)
Glenn
Glenn le 23 Août 2012
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.

Réponses (0)

Catégories

En savoir plus sur Physics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by