再问你个问题呗,在matlab中怎么建立y=b(1)*[x-b(2)]这个模型的M函数,代码怎么写啊?

问题描述:

再问你个问题呗,在matlab中怎么建立y=b(1)*[x-b(2)]这个模型的M函数,代码怎么写啊?
呵呵 那个我知道了 不过还有个问题想麻烦您。我编的这个程序
clear all;
x=1:0.5:4.5;
y=[3.3 5.2 8.4 13.5 22 35.9 58.6 96];
beta=ones(2,3,1,2,3);
beta = nlinfit(x,y,@sd,beta);
结果出来yhat =
Columns 1 through 8 40.171 288.96 3289.9 60040 1.7697e+006 8.4654e+007 6.5941e+009 8.3839e+011
……
Function 'norm' is not defined for values of class 'double' and attributes 'full nd real'.
Error in ==> nlinfit at 204
if norm(step) < betatol*(sqrteps+norm(beta))怎么回事呢
1个回答 分类:综合 2014-11-15

问题解答:

我来补答
函数写成
function y=testfun(x,b)
y=b(1)*(x-b(2));
就行了
你是要这个么
 
 
展开全文阅读
剩余:2000
上一页:关于ATP```````