Fitting a model of a membrane with fminsearch
1 view (last 30 days)
Show older comments
shadan Kazempour Sabahi
on 1 Jul 2021
Commented: shadan Kazempour Sabahi
on 4 Jul 2021
Hello guys,
I need to fit a model of a membrane with experimental datas and for that I am using fminsearch to calculate least squares. I have 15 inputs to fit.
The problem is I get this error:
my code for fitting is:
% Startwert
Lp = 10.9e-7;
%a=[7/60 -2227/50.400 4.0180 -3.9788 -1.9215 4.392 5.006];
a1=7/60;
a2=-2227/50.400;
a3=4.0180;
a4=-3.9788;
a5=-1.9215;
a6=4.392;
a7=5.006;
%n_a=numel(a)
%b=[29/20 97.453/50.400 -62.2680 -18.509 -12.156 9.15 43.17];
b1=29/20;
b2=97.453/50.400;
b3=-62.2680;
b4=-18.509;
b5=-12.156;
b6=9.15;
b7=43.17;
%n_b=numel(b)
%a_fit=zeros(1,n_a);
%b_fit=zeros(1,n_b);
initial=[a1 a2 a3 a4 a5 a6 a7 b1 b2 b3 b4 b5 b6 b7 Lp];
%Lp_fit=fminsearch(@error_function,Lp)
%fun=@(a,b,Lp)error_function(a,b,Lp);
a_fit=fminsearch(@error_function,initial)
%b_fit=fminsearch(@error_function,b)
and the error is:
Not enough input arguments.
Error in error_function (line 47)
Kt=(9/4)*(pi^2)*sqrt(2)*((1-lambda)^(-5/2))*(1 + ((a1)*(1-lambda)) - ((a2)*((1-lambda)^2))) + a3 - a4*lambda - (a5*(lambda)^2) +
(a6*(lambda)^3) + (a7*(lambda)^4);
Error in fminsearch (line 200)
fv(:,1) = funfcn(x,varargin{:});
Error in test (line 27)
a_fit=fminsearch(@error_function,initial)
>>
can someone guide me?
0 Comments
Accepted Answer
Matt J
on 1 Jul 2021
We can't see your "error_function", but you need to check its syntax and make sure it only expects a single input argument.
4 Comments
More Answers (0)
See Also
Categories
Find more on Boundary Conditions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!