How can I take the time derivative of a function?
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Guru Mohanty
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!