Is there a way to maximize an objective function to find the unknowns in the function?

조회 수: 1 (최근 30일)
I need to find the unknowns, n and m by maximizing r using the equation at the bottom. I have a set of data containing the values of ?, d?/dt, and T but I am not sure how to sum up the y values into ?y as they contain n and m. Is there a way for matlab to solve it? Can someone kindly suggest a solution? Thank you!!

채택된 답변

Walter Roberson
Walter Roberson 2017년 8월 20일
function f = obj(nm, a, da, T)
n = nm(1);
m = nm(2);
x = 1./T;
y = ln(da ./ ((1-a).^n .* a.^m) );
xy = x .* y;
sum_x = sum(x);
sum_y = sum(y);
and so on.
Then you would be optimizing with
a = ... appropriate alpha values
da = ... appropriate values for dalpha/dt
T = .... appropriate values for T
nm0 = randn(1, 2); %starting point for search
best_nm = fminsearch( @(nm) obj(nm, a, da, T), nm0 );
However, I suspect you might want to put some constraints on n and m; if so then you would be more likely to use fmincon()

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by