How to solve for Z in the following equation?
Mostrar comentarios más antiguos
Hi everyone
Could someone help me solve the following equation for Z? Here y is a voltage measurement and x is a current measurement. I want to calculate Z for a range of (x,y) values.
y = Z/((1+Z*x)*(pi+atan(Z-0.1)))
Really appreciate your help.
Thanks
Respuestas (1)
Andrew Newell
el 23 de En. de 2012
The key is to define a function that is zero for the desired value of Z:
f = @(Z) Z./((1+Z.*x).*(pi+atan(Z-0.1)))-y;
Solving is a bit tricky because the function has a horizontal asymptote, so you'll have to have a reasonable initial guess. Here is a crude first cut:
zguess = y/(1-x*y);
[zsol,fval,exitflag] = fzero(f,zguess);
if exitflag < 0
zguess = -zguess;
[zsol,fval,exitflag] = fzero(f,zguess);
end
Categorías
Más información sobre Numeric Solvers en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!