Plotting angular position versus horizontal position of a composite body and labeling specific points
2 views (last 30 days)
Show older comments
I am trying to graph the solution to a system of differential equations. The following code graphs four functions, but they are not labelled. Can I only plot t(y) vs x(y) (angle vs x position) rather than four separate functions? Also, is there a way I can label specific points, for example, the point whose x coordinate is 5? Any help would be appreciated.
syms t(y) x(y)
dt = diff(t); %t is the angle theta
ddt = diff(dt);
dx = diff(x);
ddx = diff(dx);
L = 0.5; g = 9.81;
eq1 = ddt == (4*sin(t)*(5*L*cos(t)*dt^2 + 6*g))/(L*(20*cos(t)^2 - 23))
eq2 = ddx == -(5*sin(t)*(23*L*dt^2 + 24*g*cos(t)))/(6*(20*cos(t)^2 - 23));
[eqn, vars] = reduceDifferentialOrder([eq1 eq2], [t x]);
[M,F] = massMatrixForm(eqn,vars);
f = M\F;
odeFun = odeFunction(f, vars);
ic = [pi/3; 0; t; 0];
ode45(odeFun, [0 10], ic)
0 Comments
Answers (0)
See Also
Categories
Find more on Visual Exploration 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!