Requires a vector second input argument.

9 次查看(过去 30 天)
hi. I run the code below and got the error " Requires a vector second input argument."
t=0:.1:pi;
y=sin(t);
modelfun = @(b,x)(b(1).*x.^3+b(2).*x.^2+b(3).*x+b(4));
b = [-.161;1;1;1];
y = modelfun(b,x) + normrnd(0,0.1,32,1);
beta0 = [2;2;2];
beta = @(predictor,response)nlinfit(predictor,response,modelfun,beta0)
ci = bootci(1000,beta,t,y)
  1 个评论
Matt J
Matt J 2021-10-29
That's not the error that I get:
t=0:.1:pi;
y=sin(t);
modelfun = @(b,x)(b(1).*x.^3+b(2).*x.^2+b(3).*x+b(4));
b = [-.161;1;1;1];
y = modelfun(b,x) + normrnd(0,0.1,32,1);
Unrecognized function or variable 'x'.
beta0 = [2;2;2];
beta = @(predictor,response)nlinfit(predictor,response,modelfun,beta0)
ci = bootci(1000,beta,t,y)

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by