NonLinear Line Fitting - forced/constrained
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
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
Respuestas (1)
Fangjun Jiang
el 9 de Ag. de 2011
0 votos
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 comentario
Sam
el 9 de Ag. de 2011
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!