Fitting a model of a membrane with fminsearch

조회 수: 1 (최근 30일)
shadan Kazempour Sabahi
shadan Kazempour Sabahi 2021년 7월 1일
댓글: shadan Kazempour Sabahi 2021년 7월 4일
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?

채택된 답변

Matt J
Matt J 2021년 7월 1일
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
shadan Kazempour Sabahi
shadan Kazempour Sabahi 2021년 7월 4일
thank you for the answer.
shadan Kazempour Sabahi
shadan Kazempour Sabahi 2021년 7월 4일
Now a new problem apeared. fminsearch always gives me the same start value. not the optimized one, exactly the same value that I give as the start value. What could be the reason for that?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Boundary Conditions에 대해 자세히 알아보기

태그

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by