Help Formatting Relative Velocity Code

7 次查看(过去 30 天)
I am working on a code to solve for the relative velocity of Vb. I then want to find the magnitude and direction of Vb. Here is a picture of the problem:
I am a little lost on part of my code and would really appreciate it if someone could point me in the right direction! I'm not looking for you do to the work for me, just tips and pointers on how to solve this and understand what it all does.
clear all; clc;
Va=80; %cm/s
r=30; %length of link, cm
theta=40*pi/180; %angle of link relative to horizontal, radians
phi=70*pi/180; %direction of Va, radians
r_= ; %r vector, B rel to A
Va_= ; %Va vector
omega_= ; %angular velocity vector, 5 rad/s CW
Vb=Va_+(omega_*r_); %relative velocity vector equation [Vb=Va+V(b/a)]
mag_Vb=abs(sqrt((Vb(1))^2+(Vb(2))^2+(Vb(3))^2));
dir_Vb=atan2(Vb(2),Vb(1)); %radians
dir_Vb=dir_Vb*180/pi; %degrees
I specifically need pointers on r_, Va_, and omega_. Also, does my Vb equation look relatively correct?
Here are the values I have for r_, Va_, and omega_:
r_=[r*cos(theta), r*sin(theta),0]
Va_=[Va*cos(phi),Va*sin(phi),0]
Would omega_=[0,0,-5] since it is going clockwise?
Thank you in advance for any and all help!

采纳的回答

James Tursa
James Tursa 2018-9-19
编辑:James Tursa 2018-9-19
Using your picture, I just called the rotational part of the velocity Vr.
I agree with your Va_ equation for the components, and also Vb_ = Va_ + Vr
For Vr, a simple calculation gives the angle of the Vr vector = 270 deg + theta
Then do your usual cos( ) and sin( ) stuff with this angle along with the magnitude to get Vr.
What sign of omega to use? The way I drew the picture for Vr and the fact that I have 270 deg as part of the angle for Vr, you use a positive value for omega. This was done so that the Vr direction would match the arrow direction of omega in the drawing. But had I used theta + 90 deg for the Vr angle and drawn Vr going up to the left instead of down to the right, then you would use a negative value for omega. Perhaps this would make more sense generally. You can take your pick. You will get the same result either way. Normally one would expect omega = theta_dot which is backwards of what the drawing has. That to me is just a point of confusion that isn't needed. I would have drawn the omega arrow the other way.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics and Optimization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by