How do I find unknown parameter from an equation?

Suppose I am given an equation, z = a*b/(c*d)
Instead of z being the unknown, some term in the RHS is the unknown (let's say 'c') and I am given the values for all others ( let's say z=1, a=2, b=3, d=4).
So how do I find the unknown (here 'c') using the above equation?

 Réponse acceptée

eqn = @(c) z - a.*b./(c.*d);
c = fsolve(eqn, GUESS)
This assumes that the equation is complex enough that you cannot just mentally doing the rewriting
z = a*b/(c*d)
implies z*c*d = a*b
implies c = a*b/(z*d)
There are other important similar cases, where you are given a inputs at a number of locations, and corresponding outputs, and you need to find the value of parameters. For example if you were given a constant a, and constant d, and given one b for each input and one corresponding output z, and the question was to find what single value of c best explained all of the (b,z) pairs, then in such a case you could use the Curvefitting Toolbox, or use Nonlinear Least Squares from the Optimization Toolbox; https://www.mathworks.com/help/optim/nonlinear-least-squares-curve-fitting.html

Plus de réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by