Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Non-Linear curve fit with an equation

Subject: Non-Linear curve fit with an equation

From: A S M Raufur Chowdhury

Date: 11 Oct, 2012 00:07:08

Message: 1 of 3

Hello! I am Raufur. I am trying to fit a model with the a nonlinear curve. I got a data which is kind of exponentially decaying. But I need to fit it with a specific model that like
y=(24/x)*(1+A*x^B)+(C/(1+D/x)).

I am getting the data for x and y from resources and I need to fit the data in this equation. I think I need to use Gauss-newton algorithm to do so I need to use Jacobian matrix in the process. I found lsqcurvefitin matlab syntax. I just don't know how to use it.
I used [x,resnorm] = lsqcurvefit(...); for the y=24*(1+A*x^B) it gave me value for A and B but when I am dividing it by 'x' matlab is giving me an error that "martix dimension must agree". The one I used that is a very primary one for the curve fitting. I think I need to use this one. [x,resnorm,residual,exitflag,output,lambda,jacobian] = lsqcurvefit(...).

This is what I am thinking. I am not sure if I am right or not. Can anyone help me with this?

Thank you.

RAUFUR

Subject: Non-Linear curve fit with an equation

From: Sadik

Date: 11 Oct, 2012 11:18:08

Message: 2 of 3

Hi Raufur,

I have not yet tried your eqn but you may want to replace / by ./ so that it will be an element-by-element division.

Best.

Subject: Non-Linear curve fit with an equation

From: Sadik

Date: 11 Oct, 2012 12:02:07

Message: 3 of 3

By the way, you should also replace * by .*
Best.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us