MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB图像处理] 最小二乘法曲线拟合 函数使用报错 求助 O(∩_∩)O谢谢 (https://www.labfans.com/bbs/showthread.php?t=13342)

xieyun 2011-05-08 19:13

最小二乘法曲线拟合 函数使用报错 求助 O(∩_∩)O谢谢
 
想拟合一个函数的,用最小二乘曲线拟合,感觉代码木有错,但是编译报错,求解答,谢谢
报错如下:
??? Error: File: zuixiaoerchengfa.m Line: 34 Column: 1
Function definitions are not permitted in this context.
代码如下:
x=1:1:12;
y=[3.9 5.3 7.2 9.6 12.9 17.1 23.2 31.4 38.6 50.2 62.9 76.0];
function y=c8f3(a,x) %line 34 错误报告说这行错了
y=a(1).*exp(a(2)*x);
a=lsqcurvefit('c8f3',[1;2;2;3],x,y); a'
y1=c8f3(a,x); plot(x,y,x,y1,'o')
:):)好人一生平安


所有时间均为北京时间。现在的时间是 12:35

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.