The problem of initial parameters in Lsqcurvefit

3 次查看(过去 30 天)
I have a problem in Lsqcurvefit.
I am optimizing Boucwen Model with lsqcurvefit.
But when it runs with the initial parameters of below, it says
"Matrix dimensions must agree. Error in lsqcurvefit/objective (line 265)
F = F - YDATA; "
a = [1,1,1,1,1,1];
But if i use this initial parametes of below by looking for manually, it works well .
a = [12,5966,29,147,538,245];
Since I have 300 datas, I can't find each initial parameters.
So I read two ways of below such as exitflag, output and optimooptions.
I dont understand well which things are good for mine, So could you give me the recommendations for solving this problem?
Thank you so much.

采纳的回答

Matt J
Matt J 2018-11-25
编辑:Matt J 2018-11-25
So could you give me the recommendations for solving this problem?
Check the output of predicted(). Make sure it has the same dimensions as ydata2.
  3 个评论
Matt J
Matt J 2018-11-26
force predicted is interpolated. But ydata is not interpolated.
Isn't it? What is this line doing in your code?
ydata2 = interp1(time, ydata,t,'spline');
CHOI HYUNDUK
CHOI HYUNDUK 2018-11-26
编辑:CHOI HYUNDUK 2018-11-26
When it is optimized
lsqcurvefit(predicted,a,t,ydata2);
here, predicted funtion gives output interpolated by random time span.
So, it needs to fit same vector between predicted output and ydata.
I made 't function' additionaly for getting 't' number for interpoltating ydata to ydata2.
But I think now, t function just is get 'initial parameter' just one time.
therefore, ydata2 has always same vector.
However, predicted output vector is changed depends on 'parameters optimizing in real time'.
I wonder how can i fix this error.
The more initial parameters are close at parameters that i want, it works well without problem coincidently.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by