Clear Filters
Clear Filters

I want to fit some data x and y to a specific equation f(x) and then estimate this fitted data as g(x)=1/f(x) ?

1 view (last 30 days)
x=[0,0.5,1,1.5,2,2.5];
y=[1,0.8,0.6,0.4,0.2,0];
F(x)= exp[(a*x^2)+(b*x)+c], where a,b,c are not known to me
after fitting this data to this equation i want to get g(x)=1/f(x). The picture attached below demonstrates what we are trying to do. Figure A shows x and y fitted to f(x) and figure B shows estimated g(x)=1/f(x).

Accepted Answer

Ameer Hamza
Ameer Hamza on 30 Apr 2018
Using Curve Fitting toolbox , it is quite easy to fit the curve.
fitFunction = fittype('exp(a*x.^2+b*x+c)');
coff = fit(x', y', fitFunction);
a = coff.a;
b = coff.b;
c = coff.c;
  18 Comments

Sign in to comment.

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!