Keep only the linear terms in expression

1 view (last 30 days)
yoni stein
yoni stein on 14 Dec 2017
Commented: yoni stein on 14 Dec 2017
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 Comments
John D'Errico
John D'Errico on 14 Dec 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 on 14 Dec 2017
John, I guess I didn't asked as needed and hoped the question will be clear.
I rewritten it.

Sign in to comment.

Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!