Skip to main content
added 22 characters in body
Source Link
jojeck
  • 11.2k
  • 6
  • 38
  • 75

If your the unknown signal $x(n)$ is modeled as: $$x(n)=A \sin(2 \pi f n+ \phi)+w(n)$$ and you want to estimate $A$,$f$,and $\phi$ accurately, you can use least square estimation. Unfortunately the cost function is nonlinear. You can use nonlinear least square in MATLAB to find the parameters as follows:

Make a cost function:

f=@(A,f,phi) x[n]-A sin(2pi f *n+ phi)

f=@(A,f,phi) x[n]-A sin(2*pi*  f *n+ phi)

and use

p0=[A0,f0,phi0];

p = lsqnonlin(f,p0);

p0=[A0,f0,phi0];

p = lsqnonlin(f,p0);  

to find the unknown parameters. Note that the optimizer will have a hard time finding $f$ as the problem is not convex. So it is best if you can give an initial estimate of frequency by using a method like fft.

If the frequency is known then the problem can be converted to a linear estimation as: $$x(n)=A \sin(2 \pi f n+ \phi)+w(n)$$ $$=A \sin(2 \pi f n) cos (\phi) +A \cos(2 \pi f n) sin (\phi)+w(n)$$$$=A \sin(2 \pi f n) \cos (\phi) +A \cos(2 \pi f n) \sin (\phi)+w(n)$$ $$=p_1 S[n] +p_2 C[n]+w(n),$$ where $p_1=A \cos(\phi)$ and $p_2=A \sin(\phi)$ are unknown parameters, and $S[n]$ and $C[n]$ are known.

If your the unknown signal $x(n)$ is modeled as: $$x(n)=A \sin(2 \pi f n+ \phi)+w(n)$$ and you want to estimate $A$,$f$,and $\phi$ accurately, you can use least square estimation. Unfortunately the cost function is nonlinear. You can use nonlinear least square in MATLAB to find the parameters as follows:

Make a cost function:

f=@(A,f,phi) x[n]-A sin(2pi f *n+ phi)

and use

p0=[A0,f0,phi0];

p = lsqnonlin(f,p0);

to find the unknown parameters. Note that the optimizer will have a hard time finding $f$ as the problem is not convex. So it is best if you can give an initial estimate of frequency by using a method like fft.

If the frequency is known then the problem can be converted to a linear estimation as: $$x(n)=A \sin(2 \pi f n+ \phi)+w(n)$$ $$=A \sin(2 \pi f n) cos (\phi) +A \cos(2 \pi f n) sin (\phi)+w(n)$$ $$=p_1 S[n] +p_2 C[n]+w(n),$$ where $p_1=A \cos(\phi)$ and $p_2=A \sin(\phi)$ are unknown parameters, and $S[n]$ and $C[n]$ are known.

If your the unknown signal $x(n)$ is modeled as: $$x(n)=A \sin(2 \pi f n+ \phi)+w(n)$$ and you want to estimate $A$,$f$,and $\phi$ accurately, you can use least square estimation. Unfortunately the cost function is nonlinear. You can use nonlinear least square in MATLAB to find the parameters as follows:

Make a cost function:

f=@(A,f,phi) x[n]-A sin(2*pi*  f *n+ phi)

and use

p0=[A0,f0,phi0];

p = lsqnonlin(f,p0);  

to find the unknown parameters. Note that the optimizer will have a hard time finding $f$ as the problem is not convex. So it is best if you can give an initial estimate of frequency by using a method like fft.

If the frequency is known then the problem can be converted to a linear estimation as: $$x(n)=A \sin(2 \pi f n+ \phi)+w(n)$$ $$=A \sin(2 \pi f n) \cos (\phi) +A \cos(2 \pi f n) \sin (\phi)+w(n)$$ $$=p_1 S[n] +p_2 C[n]+w(n),$$ where $p_1=A \cos(\phi)$ and $p_2=A \sin(\phi)$ are unknown parameters, and $S[n]$ and $C[n]$ are known.

Source Link
Hooman
  • 321
  • 1
  • 3

If your the unknown signal $x(n)$ is modeled as: $$x(n)=A \sin(2 \pi f n+ \phi)+w(n)$$ and you want to estimate $A$,$f$,and $\phi$ accurately, you can use least square estimation. Unfortunately the cost function is nonlinear. You can use nonlinear least square in MATLAB to find the parameters as follows:

Make a cost function:

f=@(A,f,phi) x[n]-A sin(2pi f *n+ phi)

and use

p0=[A0,f0,phi0];

p = lsqnonlin(f,p0);

to find the unknown parameters. Note that the optimizer will have a hard time finding $f$ as the problem is not convex. So it is best if you can give an initial estimate of frequency by using a method like fft.

If the frequency is known then the problem can be converted to a linear estimation as: $$x(n)=A \sin(2 \pi f n+ \phi)+w(n)$$ $$=A \sin(2 \pi f n) cos (\phi) +A \cos(2 \pi f n) sin (\phi)+w(n)$$ $$=p_1 S[n] +p_2 C[n]+w(n),$$ where $p_1=A \cos(\phi)$ and $p_2=A \sin(\phi)$ are unknown parameters, and $S[n]$ and $C[n]$ are known.