How can I take the time derivative of a function?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm trying to solve a 1 DOF second order differential equation for theta(t),
theta_dd(t) = -(m1*g*sin(theta)+T2*sin(theta+beta)+m1*x_dd(t))/(m1*l1)
where beta and T2 are both function of theta, and x_dd(t) is a forcing function.
beta = @(theta) asin((l1/l2)*sin(theta));
T2 = @(theta) (m2*ydd+c*yd+k1*y+m2*g)./cos(beta(theta));
T2 is dependent on ydd(t), yd(t), y(t), and beta, again all of which are dependent of theta(t). My question is are how I can use matlab to define the first and second derivative of y(t).
y = @(theta) l1*(1-cos(theta))+l2*(1-cos(beta(theta)));
yd = @(theta) ...;
ydd = @(theta) ...;
I'm going to run this on simulink but i need to provide a function for T2.
Some have recommended using the symbolic toolbox but I'm not sure where to start.
0 commentaires
Réponses (1)
Guru Mohanty
le 8 Mai 2020
Symbolic toolbox can be used in your case. To do this you need to do the following steps.
Here is a sample code for it.
syms theta
beta = asin((11*sin(theta))/12);
y = 11*(1-cos(theta))+12*(1-cos(beta))
yd = diff(y ,theta)
ydd = diff(yd ,theta)
0 commentaires
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!