MATLAB - preventing simplification of equations

1k views Asked by At

Love this site and all the wonderful contributors on it! it has helped me out numerous times, but I can't find what I'm looking for in this instance.

Quick question:

How can I prevent Matlab from automatically 'simplifying' an equation in my matlab m-file?

Example:

Code

syms w l a
V3=(w/(2*l))*(l^2+a^2)

output in command window

V3 =
(w*(a^2 + l^2))/(2*l)

Problem:

The equation V3 is rearranged in its simplest form 'automatically', this makes equations difficult to relate to the referenced equations.

Any help would be much appreciated

Cheers

2

There are 2 answers

2
Roney Michael On BEST ANSWER

One way to achieve what you're trying to do would be to use strings and consequentially using the sym() function as illustrated here to convert them to symbolic equations as and when needed.

In doing so, whenever you need to relate to the referenced equations, you can simply compare their string versions which would remain unchanged.

0
Mahmoud Elzouka On

You can suppress automatic simplification using

sympref('AbbreviateOutput', false)