search minimum of a parameter function with the constrain that one parameter must be integer
显示 更早的评论
Hi,
I'm looking for the minimum of sum((f(x)-data(x))^2), where f(x)= (sum(exp(1i .* x .* jz))).^2 where jz = 1,2,...nz and nz is my integer parameter and data(x). So f is function of x while (sum(f(x)-data(x)))^2 is function of nz.
I think I have to use fmincon, but I don't find the syntax to tell MatLab that the constrain is nz = integer.
I'm using this approach beacuse I wasn't able to use lsqcurvefit because when I run the summation to evaluate f(x) matlab doesn't understand tha f is function of x and gives an indexes error.
Many thanks
Gianluca
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Linear Least Squares 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!