Fitting a function to data (fminsearch) with limits
이전 댓글 표시
Hey!
I try to fit a model to measured data. I already got a real close with the fminsearch option. However, I know the model will never fit completly to the measured data. I know the range wherein the unknown factors should be, how can I include this in the function.
This is a part of my code;
p= [0.31;114;3.5];
y2=fitfunc(TempZone1day,TempZone2day,TempZone3day,TempZone4day,TempZone5day,buitenTempday,FlowZone1day,FlowZone2day,FlowZone3day,FlowZone4day,KNMIwindday,SMA,p);
figure(1)
plot(tijd,WarmteCvday,'+',tijd,y2,'-')
a0=p;
aBest = fminsearch(@(a) SumErrfun1(a,TempZone1day,TempZone2day,TempZone3day,TempZone4day,TempZone5day,buitenTempday,FlowZone1day,FlowZone2day,FlowZone3day,FlowZone4day,KNMIwindday,SMA,WarmteCvday,tijd),a0);
disp(aBest)
For example, I know that p(1) should be within 0.1-0.5, p(2) within 100-200 and p(3) within 2-6. Because now aBest (the best combination) is [-0.0328; 61.8202; 0.4375], which is not even a possible option. How can I include these ranges?
채택된 답변
추가 답변 (3개)
Jie Jian
2020년 1월 9일
0 개 추천
Or you can use the function 'mapping_parameters.m' to transfer unbounded parameters to bounded ones
kursat cihan
2020년 8월 30일
0 개 추천
John D'Errico....much love from Germany, helped me a lot!!!
Bachelor Thesis in Material Modelling, used it for a parameter optimization in bringing simulations together with experimental data...PEACE
댓글 수: 1
Delme
2021년 1월 18일
Haha, i'm doing exactly the same in my thesis!
Stefan Schuberth
2022년 11월 8일
0 개 추천
you can use q=f1*atan(p)+f2 to construct a limited parameter q from an unlimited parameter p :)
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!