MATLAB Answers

Best guess/optimization solution needed

2 ビュー (過去 30 日間)
Oliver Higbee
Oliver Higbee 2021 年 4 月 30 日
コメント済み: Bjorn Gustavsson 2021 年 5 月 13 日
Hi there,
I have a series of equations which derive the maximium current of a wire, many of these terms have temperature dependance.
I'd like to reverse engineer this and find the temperature that results in a specific current. Given there are many temperature dependant terms (not all of which are linear), rearranging to make temperature the subject is not possible. (or extremely difficult).
As a human, I could use best guesses and keep changing the temperature until I arrive at the current I was looking for. What method in Matlab can I use to acheieve this? (I think it's some kind of optimisation problem but not sure on the specifics of which method to use)
Kind regards,
  1 件のコメント
DGM 2021 年 4 月 30 日
Can you not use fzero() for this?



Bjorn Gustavsson
Bjorn Gustavsson 2021 年 4 月 30 日
From the information you've given this sounds like a "reasonably" straightforward optimization-problem. You could try something like this:
function I = your_current_function(T,other_parameters)
I = f1(T,other_paramters(1:7)) + f2(T,other_parameters(3:5:13)); % you know what to do
Then you can try to find the exact current with fzero:
I_target = 123;
T_0 = fzero(@(T) your_current_function(T,other_parameters)-I_target,280);
Or find the temperature that gets you closest to you target current using fminsearch:
I_target = 123;
T0 = 280;
T_best = fminsearch(@(T) (I_target - your_current_function(T,other_parameters)).^2,T0);
  2 件のコメント
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 5 月 13 日
No, fminsearch handles multidimensional searches. It only operates on one input-argument, but that input argument can be an array with all your parameters. For example if you have a temperature and a length as optimization-paramters your model-function might be modified to simething like this:
function I = your_current_function(TnL,other_parameters)
T = TnL(1); % For readability I find it neat to explicitly
L = TnL(2); % extract the different parameters from the parameter-array
I = L*f1(T,other_paramters(1:7)) + (L-1)*L*f2(T,other_parameters(3:5:13)); % you know what to do
Then you have to make a 2-element start-guess and call fminsearch with that and hopefully it will converge to a good solution:
I_target = 123;
T0 = 280;
L0 = 1;
T0nL0 = [T0,L0];
% Then for a 2-D function to be equal to one single value will not
% necessarily give you a single unique point for the problem you described
% - for the case where you have a nice smoothly varying output-variable you
% most likely get at least one contour with that satisfy the
% "target-current". But if you have multiple outputs (current and power for
% example) you might get a unique solution. Or if your target-function surface has
% a minima it might be found:
T_best = fminsearch(@(TL) your_current_function(TL,other_parameters)).^2,T0nL0);


その他の回答 (0 件)



Community Treasure Hunt

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

Start Hunting!

Translated by