derivatives of state variables

Dear,
I want to find the derivative of this
α*x_1+b*x_2+q*abs(x_2)*x_2+r*x_3. Where x_1,x_2,x_3 are state variables from aircraft
How can I do in Matlab?

Réponses (1)

Ameer Hamza
Ameer Hamza le 26 Avr 2020

0 votes

Use symbolic toolbox. First define the equation
syms alpha b q r x_1 x_2 x_3
eq = alpha*x_1 + b*x_2 + q*abs(x_2)*x_2 + r*x_3;
and take derivative w.r.t to different variables
>> diff(eq, x_1) % derivative w.r.t x_1
ans =
alpha
>> diff(eq, x_2) % derivative w.r.t x_2
ans =
b + q*abs(x_2) + q*x_2*sign(x_2)
>> diff(eq, x_3) % derivative w.r.t x_3
ans =
r

4 commentaires

RoBoTBoY
RoBoTBoY le 26 Avr 2020
Thanks! But I don't want something like that.
Μy result I want to be something like that in order to confirm it with matlab.
You can also do this
syms alpha b q r x_1(t) x_2(t) x_3(t)
eq = alpha*x_1 + b*x_2 + q*abs(x_2)*x_2 + r*x_3;
deq = diff(eq)
If you run it in live script, it will show you output rendered in mathematical form.
RoBoTBoY
RoBoTBoY le 26 Avr 2020
I think that's what I wanted. thank you very much
Ameer Hamza
Ameer Hamza le 26 Avr 2020
I am glad to be of help.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Question posée :

le 26 Avr 2020

Commenté :

le 26 Avr 2020

Community Treasure Hunt

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

Start Hunting!

Translated by