求matlab编程高手指点最小二乘法程序,不知道错在哪啊

浏览:154960 回答:3

x=[61.04, 244.14, 549.32, 976.56, 1525.88, 2197.27, 2990.72, 3906.25, 4943.85, 6103.52, 7385.25, 8789.06];%initial value n=12;%n为x的数目 y=[ ];%存放 y序列 For i=1:n temp1=1+a*x(i) temp2=1+b*x(i).^2-c*x(i)+a*x(i) y(i)=temp1./temp2 next i Print y End =[1.1278, 1.1833, 1.1111, 1.0866, 1.0793, 1.7018, 1.0621, 0.8423, 1.4921, 1.3306, 1.1057, 1.1509] ;%initial value k=12;%k为的数目 z=[ ];%存放 z序列 P=0 For i=1:k Z(i)=[y(i)-].^2 t=p+z(i) Next i M=Min(t) Print a,b,c Plot(x,y) End为什么会出现Warning: Could not find an exact (case-sensitive) match for 'For'.C:\Program Files\MATLAB\R2008b\toolbox\matlab\lang\for.m is a case-insensitivematch and will be used instead.You can improve the performance of your code by using exactname matches and we therefore recommend that you update yourusage accordingly. Alternatively, you can disable this warning usingwarning('off','MATLAB : ispatcher:InexactCaseMatch').This warning will become an error in future releases. ??? Attempt to execute SCRIPT for as a function:C:\Program Files\MATLAB\R2008b\toolbox\matlab\lang\for.m


邀请回答 我来回答

全部回答

(3)
默认 最新
crowfoot
谢谢你的提醒
2012年6月6日
评论 点赞
向阳
检查一下你的冒号,是不是中文的,还有贴出的程序错的
2012年5月22日
评论 点赞
向阳

麻烦你把帖子编辑好,才容易看,现在这样子很乱
2012年5月22日
评论 点赞

没解决?试试专家一对一服务

换一批
    App下载
    技术邻APP
    工程师必备
    • 项目客服
    • 培训客服
    • 平台客服

    TOP