Adding velocity directions in phase potrait plot
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi, need some help regarding adding arrows in velocity plot. So my current plot based on the script extract below yields, the "angular velocity graph" (Don't mind the axis name its suppose to be theta), is there a way to add arrows for the velocity directions? I'm visualizing of something like the second image below. I have also treid using the quiver function in MATLAB, it still doesn't seem to work. Original code with the equations of motion is included below.
Current Plot:
Desired Plot:
clear all, close all, clc
m = 0.25;
M = 0.635;
l = 0.5;
g = -9.81;
b = 1;
tspan = 0:.001:50;
y0 = [0; -.01; -pi; 0];
[t,y] = ode45(@(t,y)Equation(y,m,M,l,g,b,0),tspan,y0);
g = y(:,3);
figure(2);
plot(y(:,3),y(:,4));
title('Angular Velocity Graph')
xlabel('Time (s)')
ylabel('Angular Velocity (rad s^{-1})')
function dy = Equation(y,m,M,l,g,b,u)
Sinx = sin(y(3));
Cosx = cos(y(3));
a = ((M+m)*l-m*l*Cosx^2);
dy(1,1) = y(2);
dy(2,1) = (u*l-b*y(2)*l-m*g*l*Cosx*Sinx+m*l^2*y(4)^2*Sinx)/a;
dy(3,1) = y(4);
dy(4,1) = (g*Sinx*(M+m)+Cosx*b*y(2)-Cosx*u-m*l*y(4)^2*Sinx*Cosx)/a;
end
0 Commenti
Risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!