Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Sine fitting
Replies: 4   Last Post: Jun 16, 2012 12:18 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Greg Heath

Posts: 214
Registered: 12/13/04
Re: Sine fitting
Posted: Jun 16, 2012 12:18 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Jun 15, 12:00 pm, "Star Strider" <skystriderDELETET...@ieee.net>
wrote:
> > but the amplitude is still off.  I don't know if I'm still doing something wrong, or if the signal I'm looking for is weaker than I'm expecting.  I also still don't know how to get to the phase shift from here.
>
> ------------------------------------------------------
>
> I suggest you consider the (sin, cos) pairs for each your two frequencies (pi/3, pi/6) as phasors.  Generically:
>
> A*cos(w*t + phi)  =  X*cos(w*t) - Y*sin(w*t)
> A  =  sqrt(X^2 + Y^2)
> phi  =  atan(Y/X)
>
> If you haven't already (and if I understand your notation), plot Y*Q and HT to see how they compare.  It looks as though you did everything correctly, so Y*Q should be a reasonably good fit to HT.


you may want to use

phi = atan2(Y,X)

Hope this helps.

Greg



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.