Fourier series expansion using the Curve Fitting Tool
Show older comments
I have some very perplexing results I obtained using the Curve Fitting Tool which I am having difficulty interpreting and reconciling the results. This is the 1st time I used this tool so I hope someone with some experience can assist me with the results I obtained. I am using MATLAB 2012b.
I used the code below to generate a pressure profile vs time. The time vector & the P results I have attached in the Pdata.mat file.
A=1; p=A*(1-time/0.01).*exp(-time/0.01);
I used the code generation wizard within the Curve Fitting Tool to generate the m-file that is attached. Within that m-file the following initial guess at the Fourier series coefficients:
opts.StartPoint = [7.1054e-15 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12.5664];
I then executed the FIT operation & the results for Fourier series coefficients are in the .txt file. I then copied those results & pasted them into MATLABcurvefit.m to check the results. I got nothing that resembled what is in Pdata.mat. Despite this discrepancy the Curve Fitting Tool generated fitted curve depicted in curve fit results.jpg. The fit depicted here is EXCELLENT!
So I am completely BAFFLED. How does the Curve Fitting Tool show excellent results, yet when I used the results from the .txt file in MATLABcurvefit.m the results are dreadful?
Really would appreciate an explanation.
Accepted Answer
More Answers (0)
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!