MATLAB: How to convert y=f(x) to x=f(y) functionMATLABpolynomial I want to express s in terms of x syms s; a=1; b=1.6; x=(b+a)/2+(b-a)/2*s; x=subs(x) s=solve(x,s) Best Answer Try this: syms s x a=1;b=1.6;Eq = x == (b+a)/2+(b-a)/2*s;s=solve(Eq,s)producing: s =(10*x)/3 - 13/3Without the numeric substitutions: syms a b s x Eq = x == (b+a)/2+(b-a)/2*s;s=solve(Eq,s)produces: s =(a + b - 2*x)/(a - b). Related SolutionsMATLAB: Plot x=f(y) In MATLAB, cos3y would be written as cos(3*y)In MATLAB, if y is a vector, instead of using / you should use ./ -- so y./something instead of y/somethingYou have an implicit plot, so you should have a look at fimplicit() MATLAB: Output is giving me “Empty sym: 0-by-1” roots() is not explicitly defined for symbolic expressions, and will not work for scalar symbolic expressions. It is also only defined for polynomials, but g is not a polynomial. Instead useb = solve(x); Related QuestionFprintf %fI cannot get the error.
Best Answer