多元非线性拟合求参数过程中矩阵维度问题。

7 visualizaciones (últimos 30 días)
果博东方会员开户【558766.com】
写论文建立了个模型,这样一个式子
利用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'.
原因:
    错误使用  +
    矩阵维度必须一致。
求问大神哪里错了,万分感谢。

Respuesta aceptada

果博东方网站【558766.com】
果博东方网站【558766.com】 el 16 de Oct. de 2022
yy=(0.153./sqrt(n*x1)+0.66*m*x3).*exp(-26.71*(x2.^2)./(n*x1))
复制代码

Más respuestas (0)

Categorías

Más información sobre R Language en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!