Requires a vector second input argument.

8 views (last 30 days)
Ashkan Rigi
Ashkan Rigi on 29 Oct 2021
Commented: Matt J on 29 Oct 2021
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 Comment
Matt J
Matt J on 29 Oct 2021
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)

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!