Keep only the linear terms in expression

Hi,
During the development of a dynamic model I get an expression for the acceleration (attached as image). I want to have a linear model and therefore want to neglect the nonlinear expressions.
What I really need to do is develop a Taylor series for the expression and leave only the parts of the first order.
This is my experssion:
a = [ hr*diff(dch(t), t) - Vforward(t)*dt(t) - lr*diff(dt(t), t), diff(Vforward(t), t) + dt(t)*(hr*dch(t) - lr*dt(t)), -dch(t)*(hr*dch(t) - lr*dt(t))]
and I've tried to do this:
a_linear = taylor(a,[dch(t) dt(t)],[0 0],'order',2)
but got error:
Error using sym/taylor (line 99)
The value of 'x' is invalid. It
must satisfy the function:
@(x)isvector(x)&&isAllVars(x).
What's the problem?

4 Kommentare

Matt J
Matt J am 14 Dez. 2017
Bearbeitet: Matt J am 14 Dez. 2017
It's not clear why it wouldn't be possible. Since you're the one writing the code for this expression, surely you can put anything in there (and leave anything out) that you wish.
yoni stein
yoni stein am 14 Dez. 2017
I'm writing the code which generates this experssion and I want the Linearization to be automatic.
John D'Errico
John D'Errico am 14 Dez. 2017
Is it possible for MATLAB to read this picture of an equation, know how to interpret it as a model of your process, know what all of the variables mean, and finally know what you want to do? Of course not. Nor can we, since only you have that information, still safely locked in your head.
There is a way to do this however. You need to type in the equation, using correct mathematics as implemented in MATLAB, but only put in the linear parameters as you desire. You know which terms are linear in that expression. You will need to write the code in MATLAB no matter what. So type in only the linear terms, if you are willing to assume the others are unimportant. And only you can make that decision.
Did you really expect more? Be serious. If you just throw out some random expression with variables in it that have no meaning to anybody but you, what do you expect? If you want a better answer, you might read this:
https://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
yoni stein
yoni stein am 14 Dez. 2017
John, I guess I didn't asked as needed and hoped the question will be clear.
I rewritten it.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 14 Dez. 2017

Kommentiert:

am 14 Dez. 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by