NonLinear Line Fitting - forced/constrained
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
Hi
I am really stuck on this. So I have two vectors
x=0:10; y=y+rand(1,11)*2;
Now I want to fit a variety of curves to this, specifically - linear,exponential,logarithmic,logistic and power.
My problem is what ever model i use I want to force the curve to go through {0,0} i.e constrain this point
I have been trying my hardest to figure out how to use fmincon but have had no luck. I have tried to use lsqlin (after linearising the models).
Can someone please give me a short example code using fmincon fitting a simple exponential model ae^{bx}? I think once I know how to fit one I can figure out all the rest :)
Thanks for any help
-----------------------------
I have figured out so far that to do this i need to use Aeq and beq. But I have been able to define a function in fmincon which can take two arguments
i.e
function f = myfun(p,x)
f = p(1).*exp(p(2).*x)
how do i pass my x vector into fmincon
댓글 수: 0
답변 (1개)
Fangjun Jiang
2011년 8월 9일
0 개 추천
Does this post http://www.mathworks.com/matlabcentral/answers/13255-least-squares-linear-fit-to-be-forced-to-pass-through-a-specified-point give you any clue?
댓글 수: 1
Sam
2011년 8월 9일
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!