The main problem is that I have no idea what I am doing. But second to that I am attempting to fit a curve to some data using the equation(adsbygoogle = window.adsbygoogle || []).push({});

y = ((1/A(x-B)^(C+1))+D)^-1

if that makes sense

I need to get the values for A,B,C and D and so have been looking into lsqnonlin but I am having problems. I may also be making life hard for myself as I am also trying to incorporate it into a GUI. Here is an example of what I have been trying

this is my function

this is how I attempt to use lsqnonlinCode (Text):function F = myfun(x,Vg,Gd)

A = x(1);

B = x(2);

C = x(3);

D = x(4);

F = (((1/(A.*(x-B)^(C+1)))+D)^-1)-Gd;

end

can anyone give me a hand in either starting again or making this work?Code (Text):cla reset;

Vg = A.data(:,1);

Id = A.data(:,6);

Vd = A.data(:,5);

Gd = (Id./Vd);

x=lsqnonlin(@myfun,[1*10^9 -1 1 3*10^5],[],[],[],Vg,Gd);

%Gd_new = (((1/(x(1).*(x-x(2))^(x(3)+1)))+x(4))^-1);

%semilogy(Vg,Gd,'o',Vg,Gd_new);

thanks

**Physics Forums - The Fusion of Science and Community**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Leas squares curve fit problem

Loading...

Similar Threads - Leas squares curve | Date |
---|---|

Matlab Parameter fitting with a numerical solution | Feb 9, 2018 |

Mathematica Chi square minimisation wrt variables in an integral? | Nov 15, 2017 |

Is there a software that finds an equation of a function? | Oct 29, 2015 |

[Matlab] Which is the good solution My vs. School - curve fitting? | Nov 3, 2014 |

**Physics Forums - The Fusion of Science and Community**