Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Not enough input arguments.
1 回表示 (過去 30 日間)
古いコメントを表示
Hello, somebody correct for me this code please, am getting 'Not enough input arguments' error.
main script
x=rand(1,100).*10;
noise=randn(1,100);
y=2.^x+5+noise;
figure
plot(x,y,'go')
grid on
% A=1;B=0;
constant=lsqcurvefit(fanct,[0,0],x,y);
A=constant(1);
B=constant(2);
xfit=(0:0.1:100);
yfit=funct(constant,xfit);
figure
plot(x,y,'bo',xfit,yfit,'r-')
grid on
function
function E=fanct(x0,~,~)
A=x0(1);B=x0(2);
E=(A^x)+(B);
end
1 件のコメント
KALYAN ACHARJYA
2018 年 6 月 17 日
Have you used some customized function here, a function defined is not permitted here
function function E=fanct(x0,~,~) A=x0(1);B=x0(2); E=(A^x)+(B); end
回答 (1 件)
Ameer Hamza
2018 年 6 月 17 日
x=rand(1,100).*10;
noise=randn(1,100);
y=2.^x+5+noise;
figure
plot(x,y,'go')
grid on
% A=1;B=0;
% constant=lsqcurvefit(@fanct,[0,0],x,y);
constant=lsqcurvefit(@funct,[0,0],x,y)
A=constant(1);
B=constant(2);
xfit=(0:0.1:100);
yfit=funct(constant,xfit);
figure
plot(x,y,'bo',xfit,yfit,'r-')
grid on
function E=funct(x0, x)
A=x0(1);B=x0(2);
E=(A.^x)+(B);
end
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!