Info
この質問は閉じられています。 編集または回答するには再度開いてください。
optimisation of simple equation
1 回表示 (過去 30 日間)
古いコメントを表示
let say a=1:1:10 b=1:1:20 c:1:1:15 and the equation is:
k= (a/b)*cos(c)
and i need to get the value of a b and c when k is min or max, how do you do it?
thx
0 件のコメント
回答 (1 件)
Andrei Bobrov
2011 年 10 月 14 日
% determination of all combinations of values of the vectors a,b,c -> [a(:) b(:) c(:)]
[a b c] = meshgrid(1:10,1:20,1:15 );
% definition of all possible values of 'k'
k = a(:)./b(:).*cos(c(:));
% min and max values of 'k', [i1,i2] - indexes of the min and max values
[v1,i1] = max(k);
[v2,i2] = min(k);
% first row of the 'out' values of the 'a','b' and 'c' when 'k' -max, second - 'k' - min
out = [a(i1) b(i1) c(i1);a(i2) b(i2) c(i2)]
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!