필터 지우기
필터 지우기

Two functions optimization and curve fitting

조회 수: 1 (최근 30일)
BHZ
BHZ 2023년 12월 18일
편집: Matt J 2023년 12월 18일
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

답변 (1개)

Matt J
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).

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by