How can I get numerical output from 'fit' and 'int' functions?

Dear all,
I used the function 'fit' for fitting experimental data. Afterwards, I integrated this fit, and now I need to know at which x-value the fit reaches a certain y-value.
I can plot the integration and use the data cursor but would like to automate this. How can I get a matrix with the integration data in the workspace, or is there another way to accomplish this?
Thanks in advance!

Answers (1)

If the fitting function is "fun", apply fzero as
x_value = fzero(@(x)integral(fun,xmin,x)-y_value,[xmin xmax])
Best wishes
Torsten.

3 Comments

Thank you Torsten, I think it works. But it leaves me with the same problem: how do I extract this number in an automated way? Now, 'x_value' is not present in the workplace, I can export it by xlswrite but it is hard to automate this. I need to perform this calculation several (say n) times (programmed with a 'for' loop) and the respective results should be in a matlab (n x 1) matrix.
Why not making x_value an Array of Dimension (nx1) ?
Best wishes
Torsten.
Beginners mistake, I forgot to specify x_value as an output of the function I created for fitting & integrating. Thanks for the help!

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 13 Jul 2015

Commented:

on 14 Jul 2015

Community Treasure Hunt

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

Start Hunting!