Error using lsqncommon Lower and upper bounds not supported with complex-valued initial function or Jacobian evaluation.
22 次查看(过去 30 天)
显示 更早的评论
Hi All
I'm attempting to use lsqcurvefit and as the subject suggests I'm using a complex-valued initial function. After troubleshooting, I understand why this is occuring but I need to work with these complex values. I've looked over MATLAB's site regarding the use of nonlinear solvers to handle complex data (Complex Numbers in Optimization Toolbox Solvers - MATLAB & Simulink (mathworks.com)). I've attempted the suggestions here but other issues occur as a result. I'm exploring alternative options that can handle complex values. Does anyone know of other methods/techniques/solvers that I could use to solve my problem?
Below is sample complex data I'm working with:
-1.82875685467236e-05 - 5.57673335889352e-05i
3.19797913453464e-05 - 8.38049994895477e-05i
8.84510068394548e-05 - 9.49369357476830e-05i
3.40982361372879e-05 + 5.99511245193968e-05i
0.000113645107797032 + 0.000144668977309694i
0.000381430157418632 + 0.000355606573840422i
0.00139432619208296 + 0.000913022966273320i
0.00643682783318257 + 0.00260766847239058i
As a note, I've tried splitting my complex data into real and imaginary but the final results are quite off. Furthermore, I've tried taking the log of these values and this works but for only 1 situation (the last 5 complex data where the imag/real values aren't negative and thus not creating a complex number again when taking the log). I've also tried taking the magnitude and phase of each complex measurement, transforming the data so that they are on the same scale, and some of the results don't align with the physics.
0 个评论
采纳的回答
Torsten
2024-4-10
编辑:Torsten
2024-4-10
If you use "fmincon" and (f(x,xdata)-ydata)' * (f(x,xdata)-ydata) as objective function, complex numbers don't matter because the result is real.
4 个评论
Torsten
2024-4-10
编辑:Torsten
2024-4-11
I just read in the title that you want to define bounds on the parameters. This is only possible if you split the parameters into real and imaginary parts and optimize with the number of parameters doubled.
If you don't need to define bounds on the paramters:
For the numerical solution method of lsqnonlin or lsqcurvefit, it is essential that the residuals are defined for each equation separately, not in a sum of squared differences. Thus
fun = @(x, xdata) (f(x)-ydata)' * (f(x)-ydata)
is not possible for these solvers.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!