Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Parham Babakhani Dehkordi
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 il 9 Apr 2015
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.

Accedi per commentare.

Risposte (1)

John D'Errico
John D'Errico il 9 Apr 2015
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.

Categorie

Scopri di più su Systems of Nonlinear Equations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by