//Exponential Fit
#include
#include
#include
using namespace std;
int main()
{
int i,j,k,n;
cout<<"\nEnter the no. of data pairs to be entered:\n"; //To find the size of arrays
cin>>n;
double x[n],y[n],lny[n],a,b,c;
cout<<"\nEnter the x-axis values:\n"; //Input x-values(observed)
for (i=0;i>x[i];
cout<<"\nEnter the y-axis values:\n"; //Input y-values(observed)
for (i=0;i>y[i];
for (i=0;i

PhD researcher at Friedrich-Schiller University Jena, Germany. I'm a physicist specializing in theoretical, computational and experimental condensed matter physics. I like to develop Physics related apps and softwares from time to time. Can code in most of the popular languages. Like to share my knowledge in Physics and applications using this Blog and a YouTube channel.

### Like this:

Like Loading...

*Related*

[wpedon id="7041" align="center"]

Dear Manas Sharma,

thanks a lot for the code reported above, was really useful for me.

I’m writing you because I would ask if you have some code for the double exponential fitting.

Just to be clear, a code that fit the series of data [x,y] with the follow model:

y(x)=a*exp(b*x) + c*exp(d*x)

To perform that fitting in Matlab is realy easy using the function “fit(X,Y,’exp2′)”, but is really difficult to find that code in C++

I will appreciate very much your help

Thanks a lot

Marco

Hi Marco,

Well, I haven’t tried it yet.

But sure I could do some research and write a code for that.

I am pretty busy at the moment, so it may take me a 2-3 days for that.

Feel free to ask anything you want to know.

I am happy to help.

Thanks!

Hi Manas,

thanks a lot for your support!

Best Regards

Marco

Hi Manas,

Thanks for the clear explanation on Exponential Fitting code.

Do you have any 2nd order exponential fitting program?

This is very useful to me

Thanks!

Hi there,

Thanks for your comment.

I am not really sure what you mean by 2nd order exponential fitting program.

Could you please explain it to me.

Also you can maybe check out some books on Numerical Methods to learn how to go about finding the equation for the fit using the Least Square Approximation.

Hi Manas,

2nd order exponential fitting is similar to Marco’s question

“ust to be clear, a code that fit the series of data [x,y] with the follow model:

y(x)=a*exp(b*x) + c*exp(d*x)”

Thank you for your help

Best Regards