Is there a way to find the exact roots of a fitted function?
6 views (last 30 days)
Show older comments
James Hegarty O'Dowd
on 12 Mar 2019
Answered: Star Strider
on 12 Mar 2019
I used the following code to produce a fit function for some data:
f = fittype(@(a, b, c, d, x) a + b.*abs(sin(c.*x + d)));
guess = [1,1, 7, 2];
[fitobject] = fit(freq, amp, f, 'StartPoint', guess);
Its quite a messy function with 4 parameters but the shape looks correct when plotting:
Is there a way in which I can solve for the zero points of the model function which is contained in [fitobject]?
I know how to use fzero on a function if you type it out, but is there any easy way I can find the zero points? Ideally I would also like to find the uncertainty in the roots as well but I could do that manually.
Thanks
0 Comments
Accepted Answer
Star Strider
on 12 Mar 2019
It would appear to be relatively straightforward.
Since the function is 0 at:
c*x + d = 0
and ‘a’ appears to be 0 or close to it, solving for ‘x’ at 0:
x = -d/c
Since it appears that the function is periodic such that x is 0 every 0.4 units, and since the sine function crosses 0 every π radians, it would appear to be periodic at radians. You could expect or observe zeros at: 0.175, 0.575, 0.975, 1.375, 1.7750, ...
At least that’s how I analyse it, seeing only the plot image.
0 Comments
More Answers (0)
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!