필터 지우기
필터 지우기

How to optimise a variable to maintain the result of a function at a set value as another variable is increased?

조회 수: 1 (최근 30일)
I have a function: eta_m=R*k*sinc(m*pi*rho*(cos(phi)-sin(phi)*cot((alpha+beta)/2))).^2 where R, m and beta are constants and rho and k are functions dependent on various combinations of the cosine of alpha, phi and beta. As alpha is increased in some range 0 to alpha_max i would like to find the value of phi that maintains eta_m as close to 1/2 as possible. I've looked at the optamisation toolbox but don't really know where to start, any suggestions on how to go about the problem would be appreciated.
Thanks
  댓글 수: 2
dpb
dpb 2021년 1월 29일
" find the value of phi that maintains eta_m as close to 1/2 as possible"
I don't have time to try to mess around with it at the moment, but if there is a solution, you could try
fsolve()
where the function is
fneta_m=fn(r,k) R*k*sinc(m*pi*rho*(cos(phi)-sin(phi)*cot((alpha+beta)/2))).^2 - 0.5;
The above isn't the actual functional you'll need and you may need to write an m-file so you can incorporate the other functional dependencies to get rho and k that are the functionals of alpha, phi, and beta, but the idea is you try to solve for a zero where at 0.5 by subtracting the target value from the function value.

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

채택된 답변

Shubham Khatri
Shubham Khatri 2021년 2월 3일
편집: Shubham Khatri 2021년 2월 3일
Hello,
To my understanding you want to keep the value of the function contant. You can use fsolve for this. fsolve tries to find the value where the function equals to zero. To modify it to your case we can add a component of subtracting 0.5 from the funtion.
Please take a look at the modified code below
fsolve(R*k*sinc(m*pi*rho*(cos(phi)-sin(phi)*cot((alpha+beta)/2))).^2 - 0.5);
For more information , please visit the documentation of fsolve here
Hope it helps

추가 답변 (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