多元非线性拟合求参数过程中矩阵维度问题。
7 views (last 30 days)
Show older comments
果博东方会员开户【558766.com】
on 16 Oct 2022
Answered: 果博东方网站【558766.com】
on 16 Oct 2022
写论文建立了个模型,这样一个式子

利用nlinfit来求参,编写函数代码如下
function yy=myfun(beta,x)
n=beta(1)
m=beta(2)
x1=x(:,1);
x2=x(:,2);
x3=x(:,3);
yy=(0.153/sqrt(n*x1)+0.66*m*x3)*exp(-26.71*(x2.^2)/(n*x1));
x变量矩阵和y列向量均取自excel表格
,前三列分别为x1,x2,x3;第四列为y;
主程序如下
>> beta0=[15 0.01]';
>> [beta,r,j]=nlinfit(x,y,@myfun,beta0)
运行结果为
n =
15
m =
0.0100
错误使用 nlinfit (line 205)
Error evaluating model function 'myfun'.
原因:
错误使用 +
矩阵维度必须一致。
求问大神哪里错了,万分感谢。
0 Comments
Accepted Answer
果博东方网站【558766.com】
on 16 Oct 2022
yy=(0.153./sqrt(n*x1)+0.66*m*x3).*exp(-26.71*(x2.^2)./(n*x1))
复制代码
0 Comments
More Answers (0)
See Also
Categories
Find more on R Language in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!