24小时热门版块排行榜    

CyRhmU.jpeg
查看: 635  |  回复: 0

njfu3110246

木虫 (小有名气)

[求助] Matlab非线性回归问题

各位虫友,麦菜一枚,请教二元非线性回归问题。
方程程序如下:
function y = fu(beta,x)
%UNTITLED3 Summary of this function goes here
%   Detailed explanation goes here
a=beta(1);
b=beta(2);
c=beta(3);
y=a*x(:,1)^b*x(:,2)^c;
end
数据如下:
x1=[6 6 8 8 8 8 8 8 10 10 12 12];
x2=[20 20 20 20 15 15 10 10 15 15 10 10];
x=[x1 x2];
y=[254.4 228 233.1 258.6 189.8 230.5 218.7 215.7 247.4 219.9 218.1 233.1];
beta=[1 1 1];
[beta,r,j]=nlinfit(x,y,@fu,beta);
结果一直出错:
One common reason for a size
mismatch is using matrix operators
(*, /, ^) in your function instead
of the corresponding elementwise
operators (.*, ./, .^).
请教各位长老是什么问题?谢谢。
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 njfu3110246 的主题更新
信息提示
请填处理意见