MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 小白问个很简单的问题 (https://www.labfans.com/bbs/showthread.php?t=20707)

hylifexinrui 2014-12-01 15:24

小白问个很简单的问题
 
function F = myfunntest(beta,x)



F=beta(1)+beta(2)*x(:,1)+beta(3)*x(:,2)0+beta(4)*x(:,1).^2+beta(5)*x(:,1)*x(:,2)+beta(6)*x(:,2).^2+beta(7)*x(:,1).^3+beta(8)*x(:,1).^2*x(:,2)+beta(9)*x(:,1)*x(:,2).^2+beta(10)*x(:,2).^3+beta(11)*x(:,1)*x(:,2).^3+beta(12)*x(:,1).^2*x(:,2).^2+beta(13)*x(:,1).^3*x(:,2)+beta(14)*x(:,1).^2*x(:,2).^3+beta(15)*x(:,1).^3*x(:,2).^2+beta(16)*x(:,1).^3*x(:,2).^3;

end

function FF = xxxx(x,z)

beta= nlinfit(x,z,@myfunntest,[2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2])

end
这是我的FUNCTION , x=[1.15,1.15,1.15,1.15,1.15,1.45,1.45,1.45,1.45,1.45,1.75,1.75,1.75,1.75,1.75,2.05,2.05,2.05,2.05,2.05,2.35,2.35,2.35,2.35,2.35,2.65,2.65,2.65,2.65,2.65,2.95,2.95,2.95,2.95,3.25,3.25,3.25,3.25,3.25,3.55,3.55,3.55,3.55,3.55,3.85,3.85,3.85,3.85,3.85]';
y=[2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000,2.000000]';
z=[0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000,0.960000]';
x=[x y];xxxx(x,z);
调用出错 报错Inner matrix dimensions must agree.应该怎样写 才对

hylifexinrui 2014-12-01 15:25

回复: 小白问个很简单的问题
 
或者说 如果相求插值多项式的系数(如上求16个系数) 怎么写


所有时间均为北京时间。现在的时间是 17:24

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