lsqcurvefit of a summation function where the parameter to evaluate is the last index of the summation (so an integer)
Mostrar comentarios más antiguos
Hi, I'm doing the fit of a function substantially similar to this one: f(x)= sum ( exp(1i * x * jz * c) ) , where: - sum represent the summation over the index jz - x is the variable, - jz = 1,2,...,nz where nz is a parameter to find using the fit, - c is another parameter. The complete function is the product of several series of this type.
In the curve fitting tool I can't enter a summation neither using symsum nor using an iteration. Moreover I can't use nz as a parameter.
Any idea?
Many thanks, Gianluca
Respuesta aceptada
Más respuestas (4)
Walter Roberson
el 27 de Mayo de 2011
f = @(x) sum(exp(1i.*c.*x.*(1:nz)))
1 comentario
gianluca messina
el 27 de Mayo de 2011
Arnaud Miege
el 27 de Mayo de 2011
0 votos
I'm not sure this is something that can be done with the Curve Fitting Toolbox. I think a better approach would be to use the Optimization Toolbox with one of the Least Squares (Curve Fitting) functions, such as lsqcurvefit.
HTH,
Arnaud
1 comentario
Oleg Komarov
el 30 de Mayo de 2011
Your x is nz.
@(nz,xdata) ...
gianluca messina
el 30 de Mayo de 2011
0 votos
1 comentario
Oleg Komarov
el 30 de Mayo de 2011
Please post the code snippet you're using (preferably editing this question) and the whole error message. Additional info about the size of your inputs would be beneficial.
Categorías
Más información sobre Solver Outputs and Iterative Display en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!