MATLAB: Finding values from Cubicinterp fit

cubicinterpCurve Fitting Toolboxfit

If I have performed a cubic interp to some data,
x = linspace(1,maxFwhm+1,maxFwhm+1)'
f=fit(x,y,'cubicinterp')
hold on
plot(f,'k--')
coeffvalues(f)
How can I now calculate the x value that corresponds with the y value of 0.5?
Thanks Jason

Best Answer

Use fzero to solve f(x) = 0.5. Keep in mind you can evaluate the fit by passing it a value.
load census
populationFit = fit(cdate, pop, 'poly2');
populationIn1925 = populationFit(1925)
You can check that it evaluated the fit correctly.
plot(cdate, pop)
hold on
plot(populationFit)
plot(repmat(1925, 1, 2), ylim)
plot(xlim, repmat(populationIn1925, 1, 2))
plot(1925, populationIn1925, 'o')
Related Question