Two functions optimization and curve fitting
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I have these two functions:
sigma_11_fun = @(a, lambda) (-1/lambda(2)^2) * (2*a(1) + 4*a(2)*(lambda(1)^2 + lambda(2)^2 + (1/(lambda(1)^2 * lambda(2)^2))-3)) + 2*a(1)*lambda(1)^2 + 4*a(2)*lambda(1)^2*(lambda(1)^2 + lambda(2)^2 + (1/(lambda(1)^2 * lambda(2)^2))-3) + 2*lambda(1)^2*a(3)*(lambda(1)^2-1)*exp(a(4)*(lambda(1)^2-1));
sigma_22_fun = @(a, lambda) (-1/lambda(1)^2) * (2*a(1) + 4*a(2)*(lambda(1)^2 + lambda(2)^2 + (1/(lambda(1)^2 * lambda(2)^2))-3)) + 2*a(1)*lambda(2)^2 + 4*a(2)*lambda(2)^2*(lambda(1)^2 + lambda(2)^2 + (1/(lambda(1)^2 * lambda(2)^2))-3);
As you can see, sigma_11_fun is a functions of lambda_1, lambda_2, a(1), a(2), a(3) and a(4) while sigma_22_fun is a function of lambda_1, lambda_2, a(1) and a(2).
I have the data for sigma_11, sigma_22, lambda_1 and lambda_2. Now using this data and functions above, I want to do a curve-fitting to obtain a(1), a(2), a(3) and a(4) constant parameters and of course, a(1) and a(2) which are mutual in both functions should have one value which is similar for both functions.
I defined this error function for the optimization process:
err_fun = @(a, lambda) (sigma_11 - sigma_11_fun(a, lambda)).^2 + (sigma_22 - sigma_22_fun(a, lambda)).^2;
I tried both fmincon and ga functions to do the optimization using the defined error function and initial guess of "a0 = [1, 1, 1, 1]" but results are completly wrong and not even close. I tried to increase maximum generation etc, but nothing helped.
Can someone please help with this?
Thanks in advance.
Diagram of data
0 件のコメント
回答 (1 件)
Matt J
2023 年 12 月 18 日
編集済み: Matt J
2023 年 12 月 18 日
Either you have a bad initial guess, or a bad model. If the latter is true, we cannot help you. If the former is true, it may help to use fminspleas, downloadable from,
Your prediction function appears to be linear in all of the unknowns except a(4). Therefore, fminspleas would only require an initial guess for a(4).
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Genetic Algorithm についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!