1

I have a pretty large equation in which I need to solve for a ratio of 2 variables/symbols. A small example would be:

Y = A*Y + B*X

and I want MATLAB to solve this as

Y/X = B/(1-A)

where the answer(Y/X) doesn't self-reference Y or X. Is there a way to make MATLAB do this for me?

I tried using the solve function to solve for y, then x, and then call "simple(y/x)", but the answer still referred to X and Y

jerp
  • 257
  • 5
  • 15

1 Answers1

1

Express the equation in terms of a new variable Z = Y/X instead of Y (using subs to replace Y by Z*X), and then solve for Z (using solve):

>> solve(subs('Y = A*Y + B*X', 'Y', 'Z*X'),'Z')
ans =
    -B/(A - 1)
Luis Mendo
  • 110,752
  • 13
  • 76
  • 147