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

Matt J
Matt J 2017년 12월 14일
편집: Matt J 2017년 12월 14일
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 2017년 12월 14일
I'm writing the code which generates this experssion and I want the Linearization to be automatic.
John D'Errico
John D'Errico 2017년 12월 14일
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 2017년 12월 14일
John, I guess I didn't asked as needed and hoped the question will be clear.
I rewritten it.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2017년 12월 14일

댓글:

2017년 12월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by