function variable = getVariableFromAlgebricEquation(variableName, variablesStruct, equation) % v1^e1 * ... * vn^en = 1 product = 1 ; numberOfVariables = length(equation.variableNames) ; for i = 1 : numberOfVariables variableiName = equation.variableNames(i) ; exponenti = equation.exponents(i) ; if isequal(variableiName, variableName) exponentVariable = exponenti ; else product = product * variablesStruct.(variableiName) ^ exponenti ; end end variable = 1 / product ^ ( 1 / exponentVariable ) ; end