Question

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

Était-ce utile?

La solution 2

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.

Autres conseils

You can suppress automatic simplification using

sympref('AbbreviateOutput', false)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top