# How do I find unknown parameter from an equation?

3 views (last 30 days)
Vivaan Gandhi on 13 Apr 2021
Commented: Vivaan Gandhi on 13 Apr 2021
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?

Walter Roberson on 13 Apr 2021
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
Vivaan Gandhi on 13 Apr 2021
Thank you so much.

### Community Treasure Hunt

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

Start Hunting!

Translated by