필터 지우기
필터 지우기

Brute force for finding optimal value

조회 수: 5 (최근 30일)
Chetan Fadnis
Chetan Fadnis 2022년 3월 28일
댓글: Walter Roberson 2022년 3월 28일
I have a function Say, f(x)=(1-0.5)*[(sin(x-0.25))/2]+0.5.
and x lie in range [-pi,pi], which need to be optimized such that the f(x) will be maximum. The final result f(x), after applying brute force, will be of order 1*10. How to incorporate it, using brute force?
Regards and thanks in anticipation.
  댓글 수: 2
Torsten
Torsten 2022년 3월 28일
Your function does not depend on x.
Chetan Fadnis
Chetan Fadnis 2022년 3월 28일
Sorry, I have updated.
I need 10 different values of x, so that finally I can get a vector of 1*10.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2022년 3월 28일
Brute force is defined as trying all possible values. You have about 8*10^18 representable values in that range, so if you need to use brute force then the best you can hope for is roughly 3 months of computation (unless a gpu could be used)
  댓글 수: 1
Walter Roberson
Walter Roberson 2022년 3월 28일
There might be reason to divide a range into segment, and run fmincon() of the function confined to that segment, and the gather all of the results together. But that would not be considered brute force.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Torsten
Torsten 2022년 3월 28일
편집: Torsten 2022년 3월 28일
I don't understand. Your function has a single maximum at x=0.25+pi/2. Why are you talking about 10 x-values ?
Do you perhaps mean
f = @(x)(1-0.5)*sin(x-0.25)/2 + 0.5;
x = linspace(-pi,pi,10); % Choose 10 equidistant x-values
[imax,fmax] = max(f(x)); % find maximum and position under the 10 x-values
xmax = x(imax) % print out x position of maximum

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by