필터 지우기
필터 지우기

how can we solve the iterative functions based on fzero and fsolve simultaneously?

조회 수: 1 (최근 30일)
Hi, I have a function which has some input parameters which are constant. However, there is one parameter as teta (teta must be calculated from another iterative procedure using fzero, the equations are as follows:
Input parameters:
D=0.030; A=7.0685*10^-4; Jo=0.763; Jw=0.778090833; ro_o=910; ro_w=1000; mu_w=0.001; mu_o=0.92;
The equation is as follows and my task is to calculate Hw, in fact one equation and one unknown Hw, but interesting point is that in my equation there is 'teta' which is a function of Hw as well, I tried to iteratively calculate teta but there is an error, how can I solve it, I wrote:
[Hw, fValue] = fsolve(@(Hw) (((8*ro_o*((D-(2*sqrt(Hw*A/pi)))*(Jo/(1-Hw))*ro_o/mu_o)^-1.0)*(((Jo/(1-Hw))-(Jw/Hw))*((Jo/(1-Hw))-(Jw/Hw))))*(pi*D/2*(2*sin(teta/2)+2*pi-teta)*(1/(1-Hw))))-((0.023*(((Jw*D*ro_w)/mu_w)^-.2)*ro_w*(Jw/Hw)^2*(pi*D))), 0.9);
fun=@(x,Hw) 2*pi*(Hw-1)+x-sin(x); teta=fzero(@(x) fun(x,Hw),[0 2*pi]);
  댓글 수: 2
Parham Babakhani Dehkordi
Parham Babakhani Dehkordi 2015년 4월 9일
If I want to do this in one call, I would have one equation with two unknowns meaning Hw and teta, how is it possible?
John D'Errico
John D'Errico 2015년 4월 9일
Pass fsolve a vector of length 2 for the argument vector.
Have the first element be Hw, and the second element be teta.
Then return a vector of length 2 from your objective function.

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

답변 (1개)

John D'Errico
John D'Errico 2015년 4월 9일
This is silly.
Why not solve for ALL of the parameters (that are unknowns) in ONE call to fsolve? To try to interleave the two is giving you problems, and me a headache, for something that is far simpler to do in one call.

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by