lsqcurvefit of a summation function where the parameter to evaluate is the last index of the summation (so an integer)
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponse acceptée
Oleg Komarov
le 30 Mai 2011
lsqcurvefit is already MIN oof the SUM of euclidean distances of x from y. So, you don't have to use inlcude a sum in your handle and 1:x(2) but:
fh = @(x,xdata) exp(1i.*x(1).*xdata.*x(2)) .* conj(exp(1i.*x(1).*xdata.*x(2)));
4 commentaires
Oleg Komarov
le 31 Mai 2011
I am not sure that you are supplying your problem in the required form, i.e. in lsqcurvefit you can supply a zero ydata and you'll end up with the min wrt nz of SUM{f(.)^2} where the fcn handle is cast in the form I supplied in the body.
Plus de réponses (4)
Arnaud Miege
le 27 Mai 2011
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 commentaire
gianluca messina
le 30 Mai 2011
1 commentaire
Oleg Komarov
le 30 Mai 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.
Voir également
Catégories
En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!