Double exponential Curve fitting

Sam Murali Sumanth.Murali at aurecongroup.com
Mon Jan 30 01:35:57 CET 2012


Hello

I am trying to use lsqrsolve to curve fir data in txt document, but no matter what I do the curve fitting is not matching the data points. It never reaches the peak or ripple section of the waveform. I have list my code and attached the data that I am trying to curvefit.

Code:

clear
clc
B=read_csv('c:\users\sumanth.murali\desktop\LI-A6.txt')
P=evstr(B)

function z=fun(p)
B=read_csv('c:\users\sumanth.murali\desktop\LI-A6.txt')
DAT= evstr(B)
z=DAT(:,2) - p(1)*(exp(-(DAT(:,1)-p(2))/p(3))-exp(-(DAT(:,1)-p(2))/p(4)))
endfunction

p0=[1000000 0.000001 0.00003 0.000004]

function z=fct(p, m)
z=fun(p)
endfunction

[p,v]=lsqrsolve(p0,fct,259);

t=linspace(0,0.1,100000)
//et=p(1)*( exp(-(t-p(2))/p(3)) - exp(-(t-p(2))/p(4)))
et=p(1)*(exp(-(t-p(2))/p(3)) - exp(-(t-p(2))/p(4)))
plot2d(P(:,1),P(:,2))
plot2d(t,et,rect=[[0,0,0.0030,100000]])


Regards,
Sumanth Murali

________________________________________________________________________________

Sumanth (Sam) Murali [BEng Elec]
Electrical Engineer, Energy Services, Aurecon
T +61 2 4941 5607 F +61 2 4941 5489 M +61 408 296 128
E sumanth.murali at aurecongroup.com
The University of Newcastle Union PO BOX 19, Callaghan | NSW 2308 | Australia
aurecongroup.com<http://www.aurecongroup.com/>
________________________________________________________________________________

Please consider your environment before printing this e-mail.
[Description: cid:image001.jpg at 01CCD756.358A30F0]<http://www.facebook.com/aurecon>    [Description: cid:image002.png at 01CCD756.358A30F0] <http://www.linkedin.com/company/aurecon>     [Description: cid:image003.png at 01CCD756.358A30F0] <http://www.aurecongroup.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20120130/76f3f940/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 1605 bytes
Desc: image001.jpg
URL: <https://lists.scilab.org/pipermail/users/attachments/20120130/76f3f940/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 2164 bytes
Desc: image002.png
URL: <https://lists.scilab.org/pipermail/users/attachments/20120130/76f3f940/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 4107 bytes
Desc: image003.png
URL: <https://lists.scilab.org/pipermail/users/attachments/20120130/76f3f940/attachment-0001.png>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: LI-A6.txt
URL: <https://lists.scilab.org/pipermail/users/attachments/20120130/76f3f940/attachment.txt>


More information about the users mailing list