How to solve for Z in the following equation?
Afficher commentaires plus anciens
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
Réponses (1)
Andrew Newell
le 23 Jan 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
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!