Error using lsqncommon Lower and upper bounds not supported with complex-valued initial function or Jacobian evaluation.
조회 수: 7 (최근 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!