[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Curve fit
From: |
Liam Groener |
Subject: |
Re: Curve fit |
Date: |
Sat, 20 Nov 2010 03:59:11 -0800 |
On Nov 19, 2010, at 11:43 PM, cunninghands wrote:
> need help curve fitting my data, I do not know how since I am very new to
> Octave.
>
> The xdata = A
> the ydata = Binding Energy per nucleon
I decided to try Andy's method and I thought you might be interested in the
details. Here are my commands (after I copied and pasted your data to a file
and read it into vectors x and y):
>> [c,fval,info,output]=fsolve(@(c)((c(1)-c(2).*x).*(1-exp(c(3).*x))-y),[10;.001;-.2]);
>> c
c =
9.6074481
0.0071473
-0.1153971
>> y2 = (c(1)-c(2).*x).*(1-exp(c(3).*x));
>> plot(x,y2,'linewidth',2,'r',x,y,'+','markersize',3,'linewidth',2)
I picked the function form because it seemed like it would give about the right
plot shape. It was also easy to guess rough values from the coefficients to use
for the initial value of the c vector. I've attached the resulting graph. As
can be seen the functional form I chose is a little off at the knee of the
curve.
PastedGraphic-2.pdf
Description: Adobe PDF document
Liam G.