Phase plot adding direction arrows

4 次查看(过去 30 天)
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.
Image 2
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
  1 个评论
David Martin
David Martin 2022-11-8
I have the same question. An eextensive search has come up with nothing.
I have tried quiver, and it has failed. I have tried adding '->' linespec to the plots, but the triangles were all pointing in the same direction.
I tried annotation arrow, but it only accepts two vectors with two elements as inputs for x and y.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by