主题:求助曲线拟合问题
小弟最近在搞曲线拟合
clc
st=load('strag.txt');
x=st(:,1);
y=st(:,2);
f=@(p,x)(1-p(1)*x^p(2)*50^p(3))*(p(4)*x+p(5)*p(7)*50*(1-exp(-x/(50*p(7))))...
+p(6)*p(8)*50*(1-exp(-x/(50*p(8)))));
p=nlinfit(x,y,f,[1 1 1]);
plot(x,y,'ro');
hold on
ezplot(@(x)f(p,x));
这个错误不知道怎么改,错误提示如下:
---------------------------------------------------------------
Error using ==> nlinfit at 120
Error evaluating model function
'@(p,x)(1-p(1)*x^p(2)*50^p(3))*(p(4)*x+p(5)*p(7)*50*(1-exp(-x/(50*p(7))))+p(6)*p(8)*50*(1-exp(-x/(50*p(8)))))'.
Error in ==> Untitled2 at 8
p=nlinfit(x,y,f,[1 1 1]);
Caused by:
Error using ==> mpower
Matrix must be square.
----------------------------------------------------------------
求高人解答
clc
st=load('strag.txt');
x=st(:,1);
y=st(:,2);
f=@(p,x)(1-p(1)*x^p(2)*50^p(3))*(p(4)*x+p(5)*p(7)*50*(1-exp(-x/(50*p(7))))...
+p(6)*p(8)*50*(1-exp(-x/(50*p(8)))));
p=nlinfit(x,y,f,[1 1 1]);
plot(x,y,'ro');
hold on
ezplot(@(x)f(p,x));
这个错误不知道怎么改,错误提示如下:
---------------------------------------------------------------
Error using ==> nlinfit at 120
Error evaluating model function
'@(p,x)(1-p(1)*x^p(2)*50^p(3))*(p(4)*x+p(5)*p(7)*50*(1-exp(-x/(50*p(7))))+p(6)*p(8)*50*(1-exp(-x/(50*p(8)))))'.
Error in ==> Untitled2 at 8
p=nlinfit(x,y,f,[1 1 1]);
Caused by:
Error using ==> mpower
Matrix must be square.
----------------------------------------------------------------
求高人解答