Pergunta

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

Foi útil?

Solução 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.

Outras dicas

You can suppress automatic simplification using

sympref('AbbreviateOutput', false)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top