NonLinear Line Fitting - forced/constrained
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
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
Antworten (1)
Fangjun Jiang
am 9 Aug. 2011
0 Stimmen
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 Kommentar
Sam
am 9 Aug. 2011
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!