fitting bi-linear equation using fmincon

조회 수: 6 (최근 30일)
Benjamin
Benjamin 2019년 12월 17일
댓글: Benjamin 2020년 11월 6일
Hello dear all
I am trying to fit a bi-linear equation on a dataset using fmincon command in MATLAB. My objective is to minimize the error in the whole bi-linear curve. My curve looks like the picture bellow:
curve.jpg
and I want to fit a bi-linear model on it having two slopes and the x0 as the the unknown parameters. The whole bi-linear fitted line should give the minimum error ( sum(y-y^)^2 = min ).
bilinear.PNG
in which d1 (or X0 in picture bellow) can have an upper and lower bond of for example [0.01 0.02].
So the final bi-linear fit would be like this:
f.JPG
I found the fmincon command in MATLAB the best way to achieve this goal, but unfortunately I don't know how practically program this.
What I provided in this question was a very simplified version of my actual task wich is tri-linear curve, so if I be able to fit a bi-linear, I will be able to implement it on more complex problems. I also attached my datapoints file.
I do appreciate you kind helps on this. Thank you very much.
  댓글 수: 4
Matt J
Matt J 2020년 10월 15일
Mattia Pucci's comment moved here:
Hello Benjamin
For my thesis I should do a code as similar as your.
I am attaching the "pushover" curve that I plotted in Matlab. I would like to built a bi-linear curve with the same area of first curve
I know the final poin ant the area.
How could I do?
I appreciate your help.
Benjamin
Benjamin 2020년 11월 6일
Hello, sorry for my late reponse.
Here I modified the files again to be easier for others to read, understand, and use.
Note that the main file is "FitCurve.m" file. This file will read data, and make some modifications to the raw data (to make the rows of X and Y equal, also to make the number of data points for in order to balance the weigth for each bilinear section) to the X and Y datapoints, then assign necessary boundary conditions to make it ready for the fmincon function. then the fmincon will be taken care of in the efun.m file.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by