## How do I fit a function to data using LSQNONLIN or LSQCURVEFIT?

Pedro Paulo Mingote Martins

### Pedro Paulo Mingote Martins (view profile)

さんによって質問されました 2019 年 6 月 15 日

### Torsten (view profile)

さんによって 編集されました 2019 年 6 月 26 日
I would like to fit the following function to data I have using LSQNONLIN or LSQCURVEFIT.
My function is described in the code.
However, it always gives error.
a = 0.800;
b = 0.150;
c = 0.200;
x0 = 0.300;
x = 0.500;
y0 = 0.150;
y = 0.150;
z0 = 0.100;
z = 0.100;
0.0000790000
0.0000825000
0.0000860000
0.0000895000
0.0000930000
0.0000965000
0.0001000000
0.0001035000
0.0001070000
0.0001105000
0.0001140000
0.0001175000
0.0001210000
0.0001245000];
-2.047288671
-1.423256844
-0.555726195
0.877699417
2.200575773
3.082059591
3.558854247
3.711599564
3.666770625
3.676198031
3.880316305
4.303658902
4.80742401
5.157829146];
GA = 0;
for n = 1:1:500
GA = GA + ga;
end
GB = 0;
for n = 1:1:500
GB = GB + gb;
end
GC = 0;
for n = 1:1:500
GC = GC + gc;
end
];
e0 = [1,1,1];

Vaclav ?ímal

### Vaclav ?ímal (view profile)

2019 年 6 月 26 日
What error it actually produces?

サインイン to comment.

2019 年 6 月 26 日

2019 年 6 月 26 日

function main
0.0000790000
0.0000825000
0.0000860000
0.0000895000
0.0000930000
0.0000965000
0.0001000000
0.0001035000
0.0001070000
0.0001105000
0.0001140000
0.0001175000
0.0001210000
0.0001245000];
-2.047288671
-1.423256844
-0.555726195
0.877699417
2.200575773
3.082059591
3.558854247
3.711599564
3.666770625
3.676198031
3.880316305
4.303658902
4.80742401
5.157829146];
e0 = [1,1,1];
end
a = 0.800;
b = 0.150;
c = 0.200;
x0 = 0.300;
x = 0.500;
y0 = 0.150;
y = 0.150;
z0 = 0.100;
z = 0.100;
GA = 0;
for n = 1:1:500
GA = GA + ga;
end
GB = 0;
for n = 1:1:500
GB = GB + gb;
end
GC = 0;
for n = 1:1:500