Search code examples
matlabsymbolic-math

Separate and neat display of Equation in MATLAB


I have a simple equation for Delta as shown below:

Delta

Can MATLAB return the parametric form of Delta as below?

Delta separate form


Solution

  • For symbolic expressions, you can use the collect function.

    >> collect(delta,[s1,s2,s3])
    
    ans =
    
    s1/k + s2/k + (-1/k)*s3