fft, ifft vs curve fitting toolbox

5 views (last 30 days)
Antonis
Antonis on 24 Apr 2017
Commented: Antonis on 26 Apr 2017
Hi guys, the short form of my question:
How does the sinusoidal curve fitting tool work? Is it employing an FFT to figure out the frequency and then a residuals minimisation algorithm to figure out the best fit to the data?
Using an FFT and an IFFT to manually estimate the best sinusoidal fit alone to my data does not produce good phase estimation results.
Now the long form: I am producing a periodic sinusoidal electrical signal with a power supply and then I record it experimentally after it undergoes some processes that will not change its frequency.
I need the signal's phase at the point where the recording takes place hence so far I have been using the fft and the iftt functions of matlab to extract and reconstruct the signal from the recorded data. The phase of the signal is quite important for my current study.
Unfortunately, when I plot the recomposed signal, this will not match the raw data at some points but it will match the data for most of the sample (there is some phase offset error which is most pronounced at the ends of my recording – start/finish). These errors at the ends of the recording happen quite randomly (some datasets are okay but some others have large offsets at the ends).
I gave a go estimating the sinusoidal signal through the curve fitting toolbox of matlab instead. The frequency of the signal as collected matches quite well the one I got from the FFT and the one set at the supply (under 0.1% difference) however; when the signal is reconstructed it is matched much better than what I get from the ifft function (no phase offsets at the ends).
I tried searching a lot how the curve fitting toolbox works and from the limited info I found it appears that it is using a fft function to estimate whatever it is plotting. I was wondering if you can advise how come the estimation through the tool is better than what the fft and ifft provides. Will the toolbox do a minimisation of the errors on the phase offset and find the most ideal fit apart from the fft process?
My experimental data has some hysteresis effects on the lower branch of the sinusoid (for example if you visualise a sin(x) graph the region described from 180-360 degrees) which corrects its self at every cycle by speeding a bit up the 0-180 section. This can understandably maybe cause difficulties in the fft calculating the correct phase but I need to find a conclusive answer to why this is not the case with the curve fitting tool (it will be good to know so as to be able to explain this!). Thank you in advance!
  2 Comments
Steven Lord
Steven Lord on 24 Apr 2017
Your message is a very dense wall of text. Please take a deep breath, hold it for a couple seconds, then exhale. Inhale, hold for a couple seconds, exhale.
Now, please edit your message and break it into paragraphs so it's easier to read. If you can include SMALL code examples that illustrate the problem you're experiencing, that would help us understand as well. Doing this will make it more likely someone will be able to read and offer suggestions to help you.
Antonis
Antonis on 26 Apr 2017
You are perfectly right. Amended this accordingly. Thanks for the heads up.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!